summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/attachments_controller.rb8
-rw-r--r--app/views/attachments/edit_all.html.erb4
-rw-r--r--test/functional/attachments_controller_test.rb3
3 files changed, 11 insertions, 4 deletions
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 @@
-<h2><%= l(:label_edit_attachments) %></h2>
+<h2>
+ <%= safe_join([link_to_attachment_container(@container), l(:label_edit_attachments)].compact, ' ยป ') %>
+</h2>
<%= error_messages_for *@attachments %>
diff --git a/test/functional/attachments_controller_test.rb b/test/functional/attachments_controller_test.rb
index a5d4c1705..cf7e96115 100644
--- a/test/functional/attachments_controller_test.rb
+++ b/test/functional/attachments_controller_test.rb
@@ -463,6 +463,9 @@ class AttachmentsControllerTest < Redmine::ControllerTest
assert_select 'input[name=?][value=?]', 'attachments[4][description]', 'This is a Ruby source file'
end
end
+
+ # Link to the container in heading
+ assert_select 'h2 a', :text => "Feature request #2"
end
def test_edit_all_with_invalid_container_class_should_return_404