1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-02-06 09:03:25 +00:00

Highlight menu item when viewing an attachment (#25988).

git-svn-id: http://svn.redmine.org/redmine/trunk@16652 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2017-06-10 10:48:34 +00:00
parent 8a3c24762d
commit 4d4f330b0c
3 changed files with 25 additions and 0 deletions

View File

@ -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

View File

@ -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,

View File

@ -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