From 887b8d2fdf0604c6fac624b3e3d8ca43dd525346 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Wed, 12 Dec 2018 18:51:34 +0000 Subject: Adds a link to container on attachments edit form. git-svn-id: http://svn.redmine.org/redmine/trunk@17722 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/attachments_controller.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 9c0bf15ba..552ff9cff 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -164,8 +164,10 @@ class AttachmentsController < ApplicationController # Returns the menu item that should be selected when viewing an attachment def current_menu_item - if @attachment - case @attachment.container + container = @attachment.try(:container) || @container + + if container + case container when WikiPage :wiki when Message @@ -173,7 +175,7 @@ class AttachmentsController < ApplicationController when Project, Version :files else - @attachment.container.class.name.pluralize.downcase.to_sym + container.class.name.pluralize.downcase.to_sym end end end -- cgit v1.2.3