From: Moritz Bunkus Date: Fri, 16 Aug 2013 13:47:39 +0000 (+0200) Subject: Pflichtenheftitems & -textblöcke: Tooltips im Baum mit Inhaltsauszug anzeigen gefixt X-Git-Tag: release-3.2.0beta~467^2~66 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=9bbb6912f72c14e23a25ec0a26e8d68b45b224b8;p=kivitendo-erp.git Pflichtenheftitems & -textblöcke: Tooltips im Baum mit Inhaltsauszug anzeigen gefixt Tooltips am
  • haben das Problem, dass sie bei sehr hohen
  • s (gerade bei ganzen Abschnitten, aber auch bei Funktionsblöcken mit sehr vielen Unterfunktionsblöcken) unterhalb des
  • angezeigt werden. Mit diesem Fix werden sie unterhalb des innerhalb des
  • angezeigt, der nur die eine Textzeile hoch ist. --- diff --git a/SL/Controller/RequirementSpecItem.pm b/SL/Controller/RequirementSpecItem.pm index d6b343f0e..ffdf56e7b 100644 --- a/SL/Controller/RequirementSpecItem.pm +++ b/SL/Controller/RequirementSpecItem.pm @@ -295,7 +295,9 @@ sub action_ajax_update { ->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); } @@ -310,7 +312,9 @@ sub action_ajax_update { $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); diff --git a/SL/Controller/RequirementSpecTextBlock.pm b/SL/Controller/RequirementSpecTextBlock.pm index 9f70e1bab..02a27a537 100644 --- a/SL/Controller/RequirementSpecTextBlock.pm +++ b/SL/Controller/RequirementSpecTextBlock.pm @@ -136,7 +136,9 @@ sub action_ajax_update { ->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); } diff --git a/js/requirement_spec.js b/js/requirement_spec.js index ccc452536..96a2cba15 100644 --- a/js/requirement_spec.js +++ b/js/requirement_spec.js @@ -102,6 +102,59 @@ ns.tree_node_clicked = function(event) { }, 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 ------------------------------ // ------------------------------------------------------------------------- diff --git a/templates/webpages/requirement_spec/show.html b/templates/webpages/requirement_spec/show.html index bc4d5dbd3..93aad7d79 100644 --- a/templates/webpages/requirement_spec/show.html +++ b/templates/webpages/requirement_spec/show.html @@ -86,37 +86,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); + }); }); -->