1 [%- USE HTML -%][%- USE LxERP -%][%- USE L -%]
2 <div class="section-context-menu" id="section-header">
3 [%- INCLUDE 'requirement_spec_item/_section_header.html' %]
6 [%- L.hidden_tag('active_section_id', requirement_spec_item.id) -%]
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 -%]
14 <div id="new_subitem_form" class="subitem-form clearfix">
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),
21 :update => "new_subitem_form",
22 :loading => "$('new_subitem_link').hide();" -%]
25 <script type="text/javascript">
29 selector: '.section-context-menu',
30 callback: function(key, options) {
31 var m = "clicked: " + key;
32 window.console && console.log(m) || alert(m);
35 edit: { name: "[% LxERP.t8('Edit section') %]", icon: "edit", callback: edit_section_header },
36 delete: { name: "[% LxERP.t8('Delete section') %]", icon: "delete" },
38 copy: { name: "[% LxERP.t8('Copy') %]", icon: "copy" },
39 paste: { name: "[% LxERP.t8('Paste') %]", icon: "paste" }
44 selector: '.function-block-context-menu',
45 callback: function(key, options) {
46 var m = "clicked: " + key;
47 window.console && console.log(m) || alert(m);
50 new_item: { name: "[% LxERP.t8('New function block') %]", icon: "add"},
51 new_sub_item: { name: "[% LxERP.t8('New sub function block') %]", icon: "add"},
53 edit: { name: "[% LxERP.t8('Edit') %]", icon: "edit"},
54 delete: { name: "[% LxERP.t8('Delete') %]", icon: "delete"},
56 copy: { name: "[% LxERP.t8('Copy') %]", icon: "copy" },
57 paste: { name: "[% LxERP.t8('Paste') %]", icon: "paste" }
61 $('.section-context-menu').on('click', function(e){
62 console.log('clicked', this);
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());
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']);
83 function cancel_section_form() {
84 var header = $('#section-header');
86 header.append(header.data('old-elements'));
87 header.removeData('old-elements');