summaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2017-06-10 10:48:34 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2017-06-10 10:48:34 +0000
commit4d4f330b0c7430224dcb298824db8830fb1f838c (patch)
tree7067966de61dcfdcb0cf8f038458fd694fe96c8f /app/controllers
parent8a3c24762d91ecaea4d55734173da6b9fa7aa3ea (diff)
downloadredmine-4d4f330b0c7430224dcb298824db8830fb1f838c.tar.gz
redmine-4d4f330b0c7430224dcb298824db8830fb1f838c.zip
Highlight menu item when viewing an attachment (#25988).
git-svn-id: http://svn.redmine.org/redmine/trunk@16652 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/attachments_controller.rb16
1 files changed, 16 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