Revision 786437b6
Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt
SL/Controller/RequirementSpecItem.pm | ||
---|---|---|
197 | 197 |
->jstree->create_node('#tree', $insert_after ? ('#fb-' . $insert_after, 'after') : ('#sections', 'last'), $node) |
198 | 198 |
->jstree->select_node('#tree', '#fb-' . $self->item->id); |
199 | 199 |
return $self->add_new_item_form_after_create |
200 |
->reinit_widgets |
|
200 | 201 |
->render($self); |
201 | 202 |
} |
202 | 203 |
|
... | ... | |
208 | 209 |
->replaceWith('#' . $prefix . '_form', $html) |
209 | 210 |
->hide('#section-list-empty') |
210 | 211 |
->jstree->create_node('#tree', $insert_after ? ('#fb-' . $insert_after, 'after') : ('#fb-' . $self->item->parent_id, 'last'), $node) |
212 |
->reinit_widgets |
|
211 | 213 |
->jstree->select_node('#tree', '#fb-' . $self->item->id); |
212 | 214 |
|
213 | 215 |
$self->replace_bottom($self->item->parent) if $type eq 'sub-function-block'; |
... | ... | |
293 | 295 |
->html('#section-header-' . $self->item->id, $html) |
294 | 296 |
->show('#section-header-' . $self->item->id) |
295 | 297 |
->jstree->rename_node('#tree', '#fb-' . $self->item->id, $::request->presenter->requirement_spec_item_tree_node_title($self->item)) |
298 |
->prop('#fb-' . $self->item->id, 'title', $self->item->content_excerpt) |
|
296 | 299 |
->render($self); |
297 | 300 |
} |
298 | 301 |
|
... | ... | |
307 | 310 |
$self->js |
308 | 311 |
->remove('#' . $prefix . '_form') |
309 | 312 |
->replaceWith('#' . $id_prefix . 'top-' . $self->item->id, $html_top) |
313 |
->prop('#fb-' . $self->item->id, 'title', $self->item->content_excerpt) |
|
310 | 314 |
->jstree->rename_node('#tree', '#fb-' . $self->item->id, $::request->presenter->requirement_spec_item_tree_node_title($self->item)); |
311 | 315 |
|
312 | 316 |
$self->replace_bottom($self->item, id_prefix => $id_prefix); |
SL/Controller/RequirementSpecTextBlock.pm | ||
---|---|---|
110 | 110 |
->jstree->create_node('#tree', $insert_after ? ('#tb-' . $insert_after, 'after') : ('#tb-' . ($attributes->{output_position} == 0 ? 'front' : 'back'), 'last'), $node) |
111 | 111 |
->jstree->select_node('#tree', '#tb-' . $self->text_block->id); |
112 | 112 |
$self->add_new_text_block_form(output_position => $self->text_block->output_position, insert_after_id => $self->text_block->id, requirement_spec_id => $self->text_block->requirement_spec_id) |
113 |
->reinit_widgets |
|
113 | 114 |
->render($self); |
114 | 115 |
} |
115 | 116 |
|
... | ... | |
135 | 136 |
->replaceWith('#text-block-' . $self->text_block->id, $html) |
136 | 137 |
->run(SORTABLE_PICTURE_LIST()) |
137 | 138 |
->jstree->rename_node('#tree', '#tb-' . $self->text_block->id, $self->text_block->title) |
139 |
->prop('#tb-' . $self->text_block->id, 'title', $self->text_block->content_excerpt) |
|
138 | 140 |
->render($self); |
139 | 141 |
} |
140 | 142 |
|
SL/DB/RequirementSpecItem.pm | ||
---|---|---|
7 | 7 |
use Rose::DB::Object::Helpers; |
8 | 8 |
use Rose::DB::Object::Util; |
9 | 9 |
|
10 |
use SL::Common (); |
|
10 | 11 |
use SL::DB::MetaSetup::RequirementSpecItem; |
11 | 12 |
use SL::DB::Manager::RequirementSpecItem; |
12 | 13 |
use SL::DB::Helper::ActsAsList; |
... | ... | |
124 | 125 |
return $self->item_type eq 'section' ? 'function-block' : 'sub-function-block'; |
125 | 126 |
} |
126 | 127 |
|
128 |
sub content_excerpt { |
|
129 |
my ($self) = @_; |
|
130 |
|
|
131 |
return Common::truncate($self->description // '', at => 200); |
|
132 |
} |
|
133 |
|
|
134 |
|
|
127 | 135 |
1; |
128 | 136 |
__END__ |
129 | 137 |
|
SL/DB/RequirementSpecTextBlock.pm | ||
---|---|---|
7 | 7 |
use Rose::DB::Object::Helpers; |
8 | 8 |
use Rose::DB::Object::Util; |
9 | 9 |
|
10 |
use SL::Common (); |
|
10 | 11 |
use SL::DB::MetaSetup::RequirementSpecTextBlock; |
11 | 12 |
use SL::DB::Manager::RequirementSpecTextBlock; |
12 | 13 |
use SL::DB::Helper::ActsAsList; |
... | ... | |
65 | 66 |
return [ sort { $a->position <=> $b->position } $self->pictures ]; |
66 | 67 |
} |
67 | 68 |
|
69 |
sub content_excerpt { |
|
70 |
my ($self) = @_; |
|
71 |
|
|
72 |
return Common::truncate($self->text // '', at => 200); |
|
73 |
} |
|
74 |
|
|
68 | 75 |
1; |
SL/Presenter/RequirementSpecItem.pm | ||
---|---|---|
20 | 20 |
|
21 | 21 |
my @children = map { $self->requirement_spec_item_jstree_data($_, %params) } @{ $item->children_sorted }; |
22 | 22 |
my $type = !$item->parent_id ? 'section' : 'function-block'; |
23 |
my $class = $type . '-context-menu'; |
|
23 |
my $class = $type . '-context-menu tooltip';
|
|
24 | 24 |
$class .= ' flagged' if $item->is_flagged; |
25 | 25 |
|
26 | 26 |
return { |
27 | 27 |
data => $self->requirement_spec_item_tree_node_title($item), |
28 | 28 |
metadata => { id => $item->id, type => $type }, |
29 |
attr => { id => "fb-" . $item->id, href => $params{href} || '#', class => $class }, |
|
29 |
attr => { id => "fb-" . $item->id, href => $params{href} || '#', class => $class, title => $item->content_excerpt },
|
|
30 | 30 |
children => \@children, |
31 | 31 |
}; |
32 | 32 |
} |
SL/Presenter/RequirementSpecTextBlock.pm | ||
---|---|---|
14 | 14 |
sub requirement_spec_text_block_jstree_data { |
15 | 15 |
my ($self, $text_block, %params) = @_; |
16 | 16 |
|
17 |
my $class = 'text-block-context-menu'; |
|
17 |
my $class = 'text-block-context-menu tooltip';
|
|
18 | 18 |
$class .= ' flagged' if $text_block->is_flagged; |
19 | 19 |
|
20 | 20 |
return { |
21 | 21 |
data => $text_block->title || '', |
22 | 22 |
metadata => { id => $text_block->id, type => 'text-block' }, |
23 |
attr => { id => "tb-" . $text_block->id, href => $params{href} || '#', class => $class }, |
|
23 |
attr => { id => "tb-" . $text_block->id, href => $params{href} || '#', class => $class, title => $text_block->content_excerpt },
|
|
24 | 24 |
}; |
25 | 25 |
} |
26 | 26 |
|
js/kivi.js | ||
---|---|---|
40 | 40 |
var func = kivi.get_function_by_name('local_reinit_widgets'); |
41 | 41 |
if (func) |
42 | 42 |
func(); |
43 |
|
|
44 |
ns.run_once_for('.tooltip', 'tooltip', function(elt) { |
|
45 |
$(elt).tooltip(); |
|
46 |
}); |
|
43 | 47 |
}; |
44 | 48 |
|
45 | 49 |
ns.submit_ajax_form = function(url, form_selector, additional_data) { |
templates/webpages/requirement_spec/show.html | ||
---|---|---|
86 | 86 |
[%- END -%] |
87 | 87 |
]; |
88 | 88 |
|
89 |
$('#tree').jstree({ |
|
89 |
$('#tree') |
|
90 |
.bind('loaded.jstree', function() { |
|
91 |
kivi.reinit_widgets(); |
|
92 |
[% IF SELF.requirement_spec_item %] |
|
93 |
$.jstree._reference("#tree").select_node('#fb-[% SELF.requirement_spec_item.id %]', true); |
|
94 |
[% END %] |
|
95 |
}) |
|
96 |
.jstree({ |
|
90 | 97 |
core: { |
91 | 98 |
animation: 0, |
92 | 99 |
initially_open: initially_open, |
... | ... | |
107 | 114 |
}) |
108 | 115 |
.bind("move_node.jstree", kivi.requirement_spec.tree_node_moved) |
109 | 116 |
.bind("click.jstree", kivi.requirement_spec.tree_node_clicked); |
110 |
[% IF SELF.requirement_spec_item %] |
|
111 |
$.jstree._reference("#tree").select_node('#fb-[% SELF.requirement_spec_item.id %]', true); |
|
112 |
[% END %] |
|
113 | 117 |
|
114 | 118 |
kivi.requirement_spec.create_context_menus([% SELF.requirement_spec.is_template ? 'true' : 'false' %]); |
115 | 119 |
$('#requirement_spec_tabs').on("tabsbeforeactivate", kivi.requirement_spec.tabs_before_activate); |
Auch abrufbar als: Unified diff
Pflichtenheftitems & -textblöcke: Tooltips im Baum mit Inhaltsauszug anzeigen