->html('#section-header-' . $self->item->id, $html)
->show('#section-header-' . $self->item->id)
->jstree->rename_node('#tree', '#fb-' . $self->item->id, $::request->presenter->requirement_spec_item_tree_node_title($self->item))
- ->prop('#fb-' . $self->item->id, 'title', $self->item->content_excerpt)
+ ->prop('#fb-' . $self->item->id . ' a', 'title', $self->item->content_excerpt)
+ ->addClass('#fb-' . $self->item->id . ' a', 'tooltip')
+ ->reinit_widgets
->render($self);
}
$self->js
->remove('#' . $prefix . '_form')
->replaceWith('#' . $id_prefix . 'top-' . $self->item->id, $html_top)
- ->prop('#fb-' . $self->item->id, 'title', $self->item->content_excerpt)
+ ->prop('#fb-' . $self->item->id . ' a', 'title', $self->item->content_excerpt)
+ ->addClass('#fb-' . $self->item->id . ' a', 'tooltip')
+ ->reinit_widgets
->jstree->rename_node('#tree', '#fb-' . $self->item->id, $::request->presenter->requirement_spec_item_tree_node_title($self->item));
$self->replace_bottom($self->item, id_prefix => $id_prefix);
->replaceWith('#text-block-' . $self->text_block->id, $html)
->run(SORTABLE_PICTURE_LIST())
->jstree->rename_node('#tree', '#tb-' . $self->text_block->id, $self->text_block->title)
- ->prop('#tb-' . $self->text_block->id, 'title', $self->text_block->content_excerpt)
+ ->prop('#tb-' . $self->text_block->id . ' a', 'title', $self->text_block->content_excerpt)
+ ->addClass('#tb-' . $self->text_block->id . ' a', 'tooltip')
+ ->reinit_widgets
->render($self);
}
}, kivi.eval_json_result);
};
+ns.setup_tooltip_for_tree_node = function(li) {
+ $(li).find('a').prop('title', $(li).prop('title')).tooltip();
+ $(li).prop('title', '');
+};
+
+ns.tree_loaded = function(event) {
+ var id = $('#tree').data('initially_selected_node');
+ if (id)
+ $.jstree._reference("#tree").select_node(id, true);
+
+ $('#tree li[title!=""]').each(function(idx, elt) {
+ ns.setup_tooltip_for_tree_node(elt);
+ });
+};
+
+ns.tree_node_created = function(event, data) {
+ console.info("created ", data);
+ if (data && data.rslt && data.rslt.obj)
+ ns.setup_tooltip_for_tree_node(data.rslt.obj);
+};
+
+ns.initialize_requirement_spec = function(data) {
+ $('#tree').data('initially_selected_node', data.initially_selected_node);
+
+ $('#tree')
+ .bind('create_node.jstree', ns.tree_node_created)
+ .bind('move_node.jstree', ns.tree_node_moved)
+ .bind('click.jstree', ns.tree_node_clicked)
+ .bind('loaded.jstree', ns.tree_loaded)
+ .jstree({
+ core: {
+ animation: 0,
+ initially_open: data.initially_open,
+ },
+ json_data: {
+ data: data.tree_data
+ },
+ crrm: {
+ move: {
+ check_move: ns.tree_check_move,
+ open_move: true
+ }
+ },
+ themes: {
+ theme: "requirement-spec"
+ },
+ plugins: [ "themes", "json_data", "ui", "crrm", "dnd" ]
+ });
+
+ ns.create_context_menus(data.is_template);
+ $('#requirement_spec_tabs').on("tabsbeforeactivate", ns.tabs_before_activate);
+};
+
// -------------------------------------------------------------------------
// ------------------------------ text blocks ------------------------------
// -------------------------------------------------------------------------
[%- 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);
+ });
});
-->