Revision 3bbe01f7
Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt
SL/Controller/Helper/RequirementSpec.pm | ||
---|---|---|
3 | 3 |
use strict; |
4 | 4 |
|
5 | 5 |
use Exporter qw(import); |
6 |
our @EXPORT = qw(init_visible_section); |
|
6 |
our @EXPORT = qw(init_visible_section set_function_blocks_tab_menu_class);
|
|
7 | 7 |
|
8 | 8 |
use SL::DB::Manager::RequirementSpecItem; |
9 | 9 |
|
... | ... | |
22 | 22 |
return $self->visible_section($self->visible_item->section); |
23 | 23 |
} |
24 | 24 |
|
25 |
sub set_function_blocks_tab_menu_class { |
|
26 |
my $self = shift; |
|
27 |
my %params = Params::Validate::validate(@_, { class => 1 }); |
|
28 |
|
|
29 |
my $id = '#function-blocks-tab'; |
|
30 |
my @other_classes = grep { $_ ne $params{class} } qw(section-context-menu text-block-context-menu); |
|
31 |
|
|
32 |
$self->js->removeClass($id, $_) for @other_classes; |
|
33 |
$self->js->addClass($id, $params{class}); |
|
34 |
} |
|
35 |
|
|
25 | 36 |
1; |
SL/Controller/RequirementSpecItem.pm | ||
---|---|---|
226 | 226 |
# Show section/item to edit if it is not visible. |
227 | 227 |
|
228 | 228 |
my $html = $self->render('requirement_spec_item/_section', { output => 0 }, requirement_spec_item => $self->item->section); |
229 |
$self->js->html('#column-content', $html); |
|
229 |
$self->set_function_blocks_tab_menu_class(class => 'section-context-menu') |
|
230 |
->html('#column-content', $html); |
|
230 | 231 |
} |
231 | 232 |
|
232 | 233 |
if ($self->item->item_type =~ m/section/) { |
... | ... | |
329 | 330 |
|
330 | 331 |
} else { |
331 | 332 |
my $html = $self->render('requirement_spec_item/_no_section', { output => 0 }); |
332 |
$self->js
|
|
333 |
$self->set_function_blocks_tab_menu_class(class => 'section-context-menu')
|
|
333 | 334 |
->html('#column-content', $html) |
334 | 335 |
->val('#current_content_type', '') |
335 | 336 |
->val('#current_content_id', '') |
... | ... | |
466 | 467 |
# Pasting the very first section? |
467 | 468 |
if (!@{ $self->sections }) { |
468 | 469 |
my $html = $self->render('requirement_spec_item/_section', { output => 0 }, requirement_spec_item => $self->item); |
469 |
$self->js->html('#column-content', $html) |
|
470 |
->jstree->select_node('#tree', '#fb-' . $self->item->id) |
|
470 |
$self->set_function_blocks_tab_menu_class(class => 'section-context-menu') |
|
471 |
->html('#column-content', $html) |
|
472 |
->jstree->select_node('#tree', '#fb-' . $self->item->id) |
|
471 | 473 |
} |
472 | 474 |
|
473 | 475 |
# Update the current view if required. |
... | ... | |
532 | 534 |
my ($self, $item, $item_to_select) = @_; |
533 | 535 |
|
534 | 536 |
my $html = $self->render('requirement_spec_item/_section', { output => 0 }, requirement_spec_item => $item); |
535 |
$self->js->html('#column-content', $html); |
|
537 |
$self->set_function_blocks_tab_menu_class(class => 'section-context-menu') |
|
538 |
->html('#column-content', $html); |
|
536 | 539 |
$self->select_node($item_to_select || $item); |
537 | 540 |
} |
538 | 541 |
|
... | ... | |
569 | 572 |
my $new_section = $self->item->section; |
570 | 573 |
my $html = $self->render('requirement_spec_item/_section', { output => 0 }, requirement_spec_item => $new_section); |
571 | 574 |
|
572 |
return $self->js
|
|
575 |
return $self->set_function_blocks_tab_menu_class(class => 'section-context-menu')
|
|
573 | 576 |
->html('#column-content', $html) |
574 | 577 |
->val('#current_content_type', 'section') |
575 | 578 |
->val('#current_content_id', $new_section->id) |
SL/Controller/RequirementSpecTextBlock.pm | ||
---|---|---|
10 | 10 |
|
11 | 11 |
use SL::ClientJS; |
12 | 12 |
use SL::Clipboard; |
13 |
use SL::Controller::Helper::RequirementSpec; |
|
13 | 14 |
use SL::DB::RequirementSpec; |
14 | 15 |
use SL::DB::RequirementSpecPredefinedText; |
15 | 16 |
use SL::DB::RequirementSpecTextBlock; |
... | ... | |
337 | 338 |
->val('#current_content_id', $params{id}); |
338 | 339 |
} |
339 | 340 |
|
340 |
return $self->js;
|
|
341 |
return $self->set_function_blocks_tab_menu_class(class => 'text-block-context-menu');
|
|
341 | 342 |
} |
342 | 343 |
|
343 | 344 |
1; |
templates/webpages/requirement_spec/show.html | ||
---|---|---|
17 | 17 |
[%- END %] |
18 | 18 |
</ul> |
19 | 19 |
|
20 |
<div id="function-blocks-tab"> |
|
20 |
<div id="function-blocks-tab" class="section-context-menu">
|
|
21 | 21 |
[%- UNLESS SELF.requirement_spec.is_template %] |
22 | 22 |
<div id="requirement_spec_version"> |
23 | 23 |
[%- INCLUDE 'requirement_spec/_version.html' requirement_spec=SELF.requirement_spec -%] |
Auch abrufbar als: Unified diff
Pflichtenhefte: Kontextmenüs für Items/Textblöcke auf größerer Fläche anzeigen