From 4d4f330b0c7430224dcb298824db8830fb1f838c Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 10 Jun 2017 10:48:34 +0000 Subject: Highlight menu item when viewing an attachment (#25988). git-svn-id: http://svn.redmine.org/redmine/trunk@16652 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/attachments_controller.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'app') 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 -- cgit v1.2.3