@@ -48,8 +55,8 @@ $(function() {
metadata: { type: "text-blocks-front" },
attr: { id: "tb-front", class: "text-block-context-menu" },
children: [
-[% FOREACH tb = SELF.requirement_spec.text_blocks_for_position(0) %]
- [% P.requirement_spec_text_block_jstree_data(tb).json %][% IF !loop.last %],[% END %]
+[% FOREACH tb = SELF.requirement_spec.text_blocks_sorted(output_position=0) %]
+ [% tb.presenter.jstree_data.json %][% IF !loop.last %],[% END %]
[% END %]
]},
@@ -57,8 +64,8 @@ $(function() {
metadata: { type: "sections" },
attr: { id: "sections", class: "section-context-menu" },
children: [
-[% FOREACH section = SELF.requirement_spec.sections %]
- [% P.requirement_spec_item_jstree_data(section).json %][% IF !loop.last %],[% END %]
+[% FOREACH section = sections %]
+ [% section.presenter.jstree_data.json %][% IF !loop.last %],[% END %]
[% END %]
]},
@@ -66,43 +73,35 @@ $(function() {
metadata: { type: "text-blocks-back" },
attr: { id: "tb-back", class: "text-block-context-menu" },
children: [
-[% FOREACH tb = SELF.requirement_spec.text_blocks_for_position(1) %]
- [% P.requirement_spec_text_block_jstree_data(tb).json %][% IF !loop.last %],[% END %]
+[% FOREACH tb = SELF.requirement_spec.text_blocks_sorted(output_position=1) %]
+ [% tb.presenter.jstree_data.json %][% IF !loop.last %],[% END %]
[% END %]
- ]}];
+ ]}
+ ];
- $('#tree').jstree({
- core: {
- animation: 0,
- initially_open: [ "tb-front", "tb-back", "sections"
-[%- FOREACH section = SELF.requirement_spec.sections -%]
+ var initially_open = ['tb-front', 'tb-back', 'sections'
+[%- FOREACH section = sections -%]
, "fb-[% section.id %]"
[%- FOREACH function_block = section.children -%]
, "fb-[% function_block.id -%]"
[%- END -%]
[%- END -%]
- ]},
- json_data: {
- data: tree_data
- },
- crrm: {
- move: {
- check_move: requirement_spec_tree_check_move,
- open_move: true
- }
- },
- themes: {
- theme: "requirement-spec"
- },
- plugins: [ "themes", "json_data", "ui", "crrm", "dnd" ]
- })
- .bind("move_node.jstree", requirement_spec_tree_node_moved)
- .bind("click.jstree", requirement_spec_tree_node_clicked);
+ ];
+
+ kivi.requirement_spec.initialize_requirement_spec({
+ initially_open: initially_open
+ , tree_data: tree_data
+ , is_template: [% SELF.requirement_spec.is_template ? 'true' : 'false' %]
+ , html_template_exists: [% SELF.html_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 %]
-
- create_requirement_spec_context_menus();
+ , time_based_units: {
+ [% FOREACH unit = SELF.time_based_units %]
+ [% UNLESS loop.first %], [% END %] "[% JavaScript.escape(unit.name) %]": true
+ [% END %]
+ }
+ });
});
-->