8a209d3733ee0805db41a0b58305d94004231b50
[kivitendo-erp.git] / SL / Presenter / RequirementSpecTextBlock.pm
1 package SL::Presenter::RequirementSpecTextBlock;
2
3 use strict;
4
5 use parent qw(Exporter);
6
7 use Exporter qw(import);
8 our @EXPORT = qw(requirement_spec_text_block_jstree_data);
9
10 use Carp;
11
12 use SL::JSON;
13
14 sub requirement_spec_text_block_jstree_data {
15   my ($self, $text_block, %params) = @_;
16
17   my $class  = 'text-block-context-menu tooltip';
18   $class    .= ' flagged' if $text_block->is_flagged;
19
20   return {
21     data     => $text_block->title || '',
22     metadata => { id =>         $text_block->id, type => 'text-block' },
23     attr     => { id => "tb-" . $text_block->id, href => $params{href} || '#', class => $class, title => $text_block->content_excerpt },
24   };
25 }
26
27 1;