diff options
-rw-r--r-- | app/controllers/attachments_controller.rb | 16 | ||||
-rw-r--r-- | lib/redmine.rb | 1 | ||||
-rw-r--r-- | test/functional/attachments_controller_test.rb | 8 |
3 files changed, 25 insertions, 0 deletions
diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 8f3fcd82e..78043956f 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -154,6 +154,22 @@ class AttachmentsController < ApplicationController end end + # Returns the menu item that should be selected when viewing an attachment + def current_menu_item + if @attachment + case @attachment.container + when WikiPage + :wiki + when Message + :boards + when Project, Version + :files + else + @attachment.container.class.name.pluralize.downcase.to_sym + end + end + end + private def find_attachment diff --git a/lib/redmine.rb b/lib/redmine.rb index 729fcb561..d9f57ddc5 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -272,6 +272,7 @@ Redmine::MenuManager.map :project_menu do |menu| :parent => :new_object menu.push :new_file, {:controller => 'files', :action => 'new'}, :param => :project_id, :caption => :label_attachment_new, :parent => :new_object + menu.push :overview, { :controller => 'projects', :action => 'show' } menu.push :activity, { :controller => 'activities', :action => 'index' } menu.push :roadmap, { :controller => 'versions', :action => 'index' }, :param => :project_id, diff --git a/test/functional/attachments_controller_test.rb b/test/functional/attachments_controller_test.rb index 3eba761ae..1e8f368f4 100644 --- a/test/functional/attachments_controller_test.rb +++ b/test/functional/attachments_controller_test.rb @@ -272,6 +272,14 @@ class AttachmentsControllerTest < Redmine::ControllerTest assert_response 403 end + def test_show_issue_attachment_should_highlight_issues_menu_item + get :show, :params => { + :id => 4 + } + assert_response :success + assert_select '#main-menu a.issues.selected' + end + def test_show_invalid_should_respond_with_404 get :show, :params => { :id => 999 |