Dispatcher: Requests auf controller.pl ohne action auf Loginseite redirecten
[kivitendo-erp.git] / SL / Presenter / RequirementSpecItem.pm
index cdf05cf..faafd26 100644 (file)
@@ -5,20 +5,28 @@ use strict;
 use parent qw(Exporter);
 
 use Exporter qw(import);
-our @EXPORT = qw(requirement_spec_item_jstree_data requirement_spec_item_dependency_list);
+our @EXPORT = qw(requirement_spec_item_tree_node_title requirement_spec_item_jstree_data requirement_spec_item_dependency_list);
 
 use Carp;
 
+sub requirement_spec_item_tree_node_title {
+  my ($self, $item) = @_;
+
+  return join(' ', map { $_ || '' } ($item->fb_number, $self->truncate($item->parent_id ? $item->description_as_stripped_html : $item->title, at => 30)));
+}
+
 sub requirement_spec_item_jstree_data {
   my ($self, $item, %params) = @_;
 
-  my @children = map { $self->requirement_spec_item_jstree_data($_, %params) } @{ $item->sorted_children };
-  my $type     = !$item->parent_id ? 'section' : 'functionblock';
+  my @children = map { $self->requirement_spec_item_jstree_data($_, %params) } @{ $item->children_sorted };
+  my $type     = !$item->parent_id ? 'section' : 'function-block';
+  my $class    = $type . '-context-menu tooltip';
+  $class      .= ' flagged' if $item->is_flagged;
 
   return {
-    data     => join(' ', map { $_ || '' } ($item->fb_number, $item->title)),
+    data     => $self->requirement_spec_item_tree_node_title($item),
     metadata => { id =>         $item->id, type => $type },
-    attr     => { id => "fb-" . $item->id, href => $params{href} || '#' },
+    attr     => { id => "fb-" . $item->id, href => $params{href} || '#', class => $class, title => $item->content_excerpt },
     children => \@children,
   };
 }