Pflichtenhefte bearbeiten
[kivitendo-erp.git] / templates / webpages / requirement_spec_item / _single_section.html
1 [%- USE HTML -%][%- USE LxERP -%][%- USE L -%]
2 <div class="section-context-menu" id="section-header">
3  [%- INCLUDE 'requirement_spec_item/_section_header.html' %]
4 </div>
5
6 [%- L.hidden_tag('active_section_id', requirement_spec_item.id) -%]
7
8 <ul id="section" class="section function-block-context-menu">
9   [%- FOREACH subitem = requirement_spec_item.children -%]
10     [%- INCLUDE 'requirement_spec_item/_single_subitem.html' requirement_spec_item=subitem -%]
11   [%- END -%]
12 </ul>
13
14 <div id="new_subitem_form" class="subitem-form clearfix">
15 </div>
16 <div id="new_subitem_link" class="highlight-box" style="[%- 'display:none' IF requirement_spec_item.children.size -%]">
17   [%#- link_to_remote LxERP.t8("FIXME no_function_blocks_have_been_created_for_this_section_yet) + " " + t(:create_a_function_block_now"),
18                       :url    => new_requirement_spec_requirement_spec_item_url(requirement_spec_item.requirement_spec,
19                       :requirement_spec_item_id => requirement_spec_item.id),
20                       :method => :get,
21                       :update => "new_subitem_form",
22                       :loading => "$('new_subitem_link').hide();" -%]
23 </div>
24
25 <script type="text/javascript">
26  <!--
27 $(function(){
28     $.contextMenu({
29         selector: '.section-context-menu',
30         callback: function(key, options) {
31             var m = "clicked: " + key;
32             window.console && console.log(m) || alert(m);
33         },
34         items: {
35           edit:   { name: "[% LxERP.t8('Edit section') %]", icon: "edit", callback: edit_section_header },
36           delete: { name: "[% LxERP.t8('Delete section') %]", icon: "delete" },
37           sep1:   "---------",
38           copy:   { name: "[% LxERP.t8('Copy') %]", icon: "copy" },
39           paste:  { name: "[% LxERP.t8('Paste') %]", icon: "paste" }
40         }
41       });
42
43     $.contextMenu({
44         selector: '.function-block-context-menu',
45         callback: function(key, options) {
46             var m = "clicked: " + key;
47             window.console && console.log(m) || alert(m);
48         },
49         items: {
50           new_item:     { name: "[% LxERP.t8('New function block') %]",     icon: "add"},
51           new_sub_item: { name: "[% LxERP.t8('New sub function block') %]", icon: "add"},
52           sep1:   "---------",
53           edit:   { name: "[% LxERP.t8('Edit') %]",   icon: "edit"},
54           delete: { name: "[% LxERP.t8('Delete') %]", icon: "delete"},
55           sep2:   "---------",
56           copy:   { name: "[% LxERP.t8('Copy') %]", icon: "copy" },
57           paste:  { name: "[% LxERP.t8('Paste') %]", icon: "paste" }
58         }
59     });
60
61     $('.section-context-menu').on('click', function(e){
62         console.log('clicked', this);
63     });
64 });
65
66 function edit_section_header() {
67   $.post("controller.pl?action=RequirementSpecItem/edit_section&id=" + encodeURIComponent($('#active_section_id').val()), function(data) {
68     var header = $('#section-header');
69     header.data('old-elements', header.children().detach());
70     header.html(data);
71   });
72 }
73
74 function submit_section_form() {
75   $.post("controller.pl?action=RequirementSpecItem/update_section&id=" + $('#section-form form').serialize(), function(data) {
76     var header = $('#section-header');
77     header.removeData('old-elements');
78     header.html(data['header_html']);
79     $('#tree').jstree('rename_node', '#fb-' + data['id'], data['node_name']);
80   });
81 }
82
83 function cancel_section_form() {
84   var header = $('#section-header');
85   header.empty();
86   header.append(header.data('old-elements'));
87   header.removeData('old-elements');
88 }
89 -->
90 </script>