From 3bbe01f72076071001aee77c1c8b9bce00c6d7c2 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 18 Jul 2013 15:36:37 +0200 Subject: [PATCH] =?utf8?q?Pflichtenhefte:=20Kontextmen=C3=BCs=20f=C3=BCr?= =?utf8?q?=20Items/Textbl=C3=B6cke=20auf=20gr=C3=B6=C3=9Ferer=20Fl=C3=A4ch?= =?utf8?q?e=20anzeigen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Controller/Helper/RequirementSpec.pm | 13 ++++++++++++- SL/Controller/RequirementSpecItem.pm | 15 +++++++++------ SL/Controller/RequirementSpecTextBlock.pm | 3 ++- templates/webpages/requirement_spec/show.html | 2 +- 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/SL/Controller/Helper/RequirementSpec.pm b/SL/Controller/Helper/RequirementSpec.pm index b24c4aa80..3ba23fbec 100644 --- a/SL/Controller/Helper/RequirementSpec.pm +++ b/SL/Controller/Helper/RequirementSpec.pm @@ -3,7 +3,7 @@ package SL::Controller::Helper::RequirementSpec; 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; @@ -22,4 +22,15 @@ sub init_visible_section { 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; diff --git a/SL/Controller/RequirementSpecItem.pm b/SL/Controller/RequirementSpecItem.pm index 6b833f7bf..ce24e3138 100644 --- a/SL/Controller/RequirementSpecItem.pm +++ b/SL/Controller/RequirementSpecItem.pm @@ -226,7 +226,8 @@ sub action_ajax_edit { # 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/) { @@ -329,7 +330,7 @@ sub action_ajax_delete { } 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', '') @@ -466,8 +467,9 @@ sub action_ajax_paste { # 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. @@ -532,7 +534,8 @@ sub render_list { 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); } @@ -569,7 +572,7 @@ sub ensure_section_is_shown { 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) diff --git a/SL/Controller/RequirementSpecTextBlock.pm b/SL/Controller/RequirementSpecTextBlock.pm index 9be5a2948..7faf16d66 100644 --- a/SL/Controller/RequirementSpecTextBlock.pm +++ b/SL/Controller/RequirementSpecTextBlock.pm @@ -10,6 +10,7 @@ use Time::HiRes (); use SL::ClientJS; use SL::Clipboard; +use SL::Controller::Helper::RequirementSpec; use SL::DB::RequirementSpec; use SL::DB::RequirementSpecPredefinedText; use SL::DB::RequirementSpecTextBlock; @@ -337,7 +338,7 @@ sub show_list { ->val('#current_content_id', $params{id}); } - return $self->js; + return $self->set_function_blocks_tab_menu_class(class => 'text-block-context-menu'); } 1; diff --git a/templates/webpages/requirement_spec/show.html b/templates/webpages/requirement_spec/show.html index f5321180f..9a173a5aa 100644 --- a/templates/webpages/requirement_spec/show.html +++ b/templates/webpages/requirement_spec/show.html @@ -17,7 +17,7 @@ [%- END %] -
+
[%- UNLESS SELF.requirement_spec.is_template %]
[%- INCLUDE 'requirement_spec/_version.html' requirement_spec=SELF.requirement_spec -%] -- 2.20.1