RequirementSpecs: Projekte nicht als Dropdown sondern als Input-Filter
[kivitendo-erp.git] / templates / webpages / requirement_spec / show.html
index bc4d5db..c41e87d 100644 (file)
@@ -1,4 +1,5 @@
 [%- USE JSON -%][%- USE HTML %][%- USE L %][%- USE LxERP %][%- USE P -%]
+[% SET sections = SELF.requirement_spec.sections_sorted || [] %]
 
 [%- INCLUDE 'common/flash.html' %]
 
@@ -62,7 +63,7 @@ $(function() {
       metadata: { type: "sections" },
       attr:     { id: "sections", class: "section-context-menu" },
       children: [
-[% FOREACH section = SELF.requirement_spec.sections %]
+[% FOREACH section = sections %]
  [% P.requirement_spec_item_jstree_data(section).json %][% IF !loop.last %],[% END %]
 [% END %]
       ]},
@@ -78,7 +79,7 @@ $(function() {
   ];
 
   var initially_open = ['tb-front', 'tb-back', 'sections'
-[%- FOREACH section = SELF.requirement_spec.sections -%]
+[%- FOREACH section = sections -%]
         , "fb-[% section.id %]"
  [%- FOREACH function_block = section.children -%]
         , "fb-[% function_block.id -%]"
@@ -86,37 +87,14 @@ $(function() {
 [%- END -%]
   ];
 
-  $('#tree')
-  .bind('loaded.jstree', function() {
-    kivi.reinit_widgets();
+  kivi.requirement_spec.initialize_requirement_spec({
+      initially_open:          initially_open
+    , tree_data:               tree_data
+    , is_template:             [% SELF.requirement_spec.is_template ? 'true' : 'false' %]
 [% IF SELF.requirement_spec_item %]
-    $.jstree._reference("#tree").select_node('#fb-[% SELF.requirement_spec_item.id %]', true);
+    , initially_selected_node: '#fb-[% SELF.requirement_spec_item.id %]'
 [% END %]
-  })
-  .jstree({
-    core: {
-      animation: 0,
-      initially_open: initially_open,
-    },
-    json_data: {
-      data: tree_data
-    },
-    crrm: {
-      move: {
-        check_move: kivi.requirement_spec.tree_check_move,
-        open_move:  true
-      }
-    },
-    themes: {
-      theme: "requirement-spec"
-    },
-    plugins: [ "themes", "json_data", "ui", "crrm", "dnd" ]
-  })
-  .bind("move_node.jstree", kivi.requirement_spec.tree_node_moved)
-  .bind("click.jstree",     kivi.requirement_spec.tree_node_clicked);
-
-  kivi.requirement_spec.create_context_menus([% SELF.requirement_spec.is_template ? 'true' : 'false' %]);
-  $('#requirement_spec_tabs').on("tabsbeforeactivate", kivi.requirement_spec.tabs_before_activate);
+  });
 });
 
   -->