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 diff --git a/app/views/attachments/edit_all.html.erb b/app/views/attachments/edit_all.html.erb index de089eae5..47ecc6a02 100644 --- a/app/views/attachments/edit_all.html.erb +++ b/app/views/attachments/edit_all.html.erb @@ -1,4 +1,6 @@ -