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