X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/c1569bc195865fa5c25c6945bbad78c872fa2046..442b26e2b4f442a41fbe5fa256b12c0e01219190:/SL/Presenter/RequirementSpecItem.pm diff --git a/SL/Presenter/RequirementSpecItem.pm b/SL/Presenter/RequirementSpecItem.pm index cdf05cf36..b7f377e2c 100644 --- a/SL/Presenter/RequirementSpecItem.pm +++ b/SL/Presenter/RequirementSpecItem.pm @@ -5,20 +5,26 @@ 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 : $item->title, at => 30), '<' . $item->id . '>')); +} + 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 $type = !$item->parent_id ? 'section' : 'function-block'; 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 => $type . '-context-menu' }, children => \@children, }; }