Revision 3bbe01f7
Von Moritz Bunkus vor fast 11 Jahren hinzugefügt
SL/Controller/Helper/RequirementSpec.pm | ||
---|---|---|
use strict;
|
||
|
||
use Exporter qw(import);
|
||
our @EXPORT = qw(init_visible_section);
|
||
our @EXPORT = qw(init_visible_section set_function_blocks_tab_menu_class);
|
||
|
||
use SL::DB::Manager::RequirementSpecItem;
|
||
|
||
... | ... | |
return $self->visible_section($self->visible_item->section);
|
||
}
|
||
|
||
sub set_function_blocks_tab_menu_class {
|
||
my $self = shift;
|
||
my %params = Params::Validate::validate(@_, { class => 1 });
|
||
|
||
my $id = '#function-blocks-tab';
|
||
my @other_classes = grep { $_ ne $params{class} } qw(section-context-menu text-block-context-menu);
|
||
|
||
$self->js->removeClass($id, $_) for @other_classes;
|
||
$self->js->addClass($id, $params{class});
|
||
}
|
||
|
||
1;
|
SL/Controller/RequirementSpecItem.pm | ||
---|---|---|
# Show section/item to edit if it is not visible.
|
||
|
||
my $html = $self->render('requirement_spec_item/_section', { output => 0 }, requirement_spec_item => $self->item->section);
|
||
$self->js->html('#column-content', $html);
|
||
$self->set_function_blocks_tab_menu_class(class => 'section-context-menu')
|
||
->html('#column-content', $html);
|
||
}
|
||
|
||
if ($self->item->item_type =~ m/section/) {
|
||
... | ... | |
|
||
} else {
|
||
my $html = $self->render('requirement_spec_item/_no_section', { output => 0 });
|
||
$self->js
|
||
$self->set_function_blocks_tab_menu_class(class => 'section-context-menu')
|
||
->html('#column-content', $html)
|
||
->val('#current_content_type', '')
|
||
->val('#current_content_id', '')
|
||
... | ... | |
# Pasting the very first section?
|
||
if (!@{ $self->sections }) {
|
||
my $html = $self->render('requirement_spec_item/_section', { output => 0 }, requirement_spec_item => $self->item);
|
||
$self->js->html('#column-content', $html)
|
||
->jstree->select_node('#tree', '#fb-' . $self->item->id)
|
||
$self->set_function_blocks_tab_menu_class(class => 'section-context-menu')
|
||
->html('#column-content', $html)
|
||
->jstree->select_node('#tree', '#fb-' . $self->item->id)
|
||
}
|
||
|
||
# Update the current view if required.
|
||
... | ... | |
my ($self, $item, $item_to_select) = @_;
|
||
|
||
my $html = $self->render('requirement_spec_item/_section', { output => 0 }, requirement_spec_item => $item);
|
||
$self->js->html('#column-content', $html);
|
||
$self->set_function_blocks_tab_menu_class(class => 'section-context-menu')
|
||
->html('#column-content', $html);
|
||
$self->select_node($item_to_select || $item);
|
||
}
|
||
|
||
... | ... | |
my $new_section = $self->item->section;
|
||
my $html = $self->render('requirement_spec_item/_section', { output => 0 }, requirement_spec_item => $new_section);
|
||
|
||
return $self->js
|
||
return $self->set_function_blocks_tab_menu_class(class => 'section-context-menu')
|
||
->html('#column-content', $html)
|
||
->val('#current_content_type', 'section')
|
||
->val('#current_content_id', $new_section->id)
|
SL/Controller/RequirementSpecTextBlock.pm | ||
---|---|---|
|
||
use SL::ClientJS;
|
||
use SL::Clipboard;
|
||
use SL::Controller::Helper::RequirementSpec;
|
||
use SL::DB::RequirementSpec;
|
||
use SL::DB::RequirementSpecPredefinedText;
|
||
use SL::DB::RequirementSpecTextBlock;
|
||
... | ... | |
->val('#current_content_id', $params{id});
|
||
}
|
||
|
||
return $self->js;
|
||
return $self->set_function_blocks_tab_menu_class(class => 'text-block-context-menu');
|
||
}
|
||
|
||
1;
|
templates/webpages/requirement_spec/show.html | ||
---|---|---|
[%- END %]
|
||
</ul>
|
||
|
||
<div id="function-blocks-tab">
|
||
<div id="function-blocks-tab" class="section-context-menu">
|
||
[%- UNLESS SELF.requirement_spec.is_template %]
|
||
<div id="requirement_spec_version">
|
||
[%- 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