Commit a64f8194 authored by jplang's avatar jplang

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

git-svn-id: https://svn.redmine.org/redmine/trunk@16652 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent bd16d0c3
......@@ -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
......
......@@ -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,
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment