Pflichtenheftitems & -textblöcke: Tooltips im Baum mit Inhaltsauszug anzeigen gefixt
authorMoritz Bunkus <m.bunkus@linet-services.de>
Fri, 16 Aug 2013 13:47:39 +0000 (15:47 +0200)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Tue, 1 Apr 2014 11:10:20 +0000 (13:10 +0200)
Tooltips am <li> haben das Problem, dass sie bei sehr hohen
<li>s (gerade bei ganzen Abschnitten, aber auch bei Funktionsblöcken
mit sehr vielen Unterfunktionsblöcken) unterhalb des <li> angezeigt
werden.

Mit diesem Fix werden sie unterhalb des <a> innerhalb des <li>
angezeigt, der nur die eine Textzeile hoch ist.

SL/Controller/RequirementSpecItem.pm
SL/Controller/RequirementSpecTextBlock.pm
js/requirement_spec.js
templates/webpages/requirement_spec/show.html

index d6b343f..ffdf56e 100644 (file)
@@ -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);
index 9f70e1b..02a27a5 100644 (file)
@@ -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);
 }
 
index ccc4525..96a2cba 100644 (file)
@@ -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 ------------------------------
 // -------------------------------------------------------------------------
index bc4d5db..93aad7d 100644 (file)
@@ -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);
+  });
 });
 
   -->