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;
# 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)