diff --git a/app/helpers/attachments_helper.rb b/app/helpers/attachments_helper.rb index 36cf0d4fe..e2290d7a8 100644 --- a/app/helpers/attachments_helper.rb +++ b/app/helpers/attachments_helper.rb @@ -31,8 +31,9 @@ module AttachmentsHelper # Options: # :author -- author names are not displayed if set to false # :thumbails -- display thumbnails if enabled in settings + # :deletable -- delete links are not displayed if set to false def link_to_attachments(container, options = {}) - options.assert_valid_keys(:author, :thumbnails) + options.assert_valid_keys(:author, :thumbnails, :deletable) attachments = if container.attachments.loaded? container.attachments diff --git a/app/views/wiki/edit.html.erb b/app/views/wiki/edit.html.erb index a1fc3d005..a1d4b2754 100644 --- a/app/views/wiki/edit.html.erb +++ b/app/views/wiki/edit.html.erb @@ -33,6 +33,15 @@

<%= render :partial => 'attachments/form' %>

+<% if @page.attachments.present? %> + +<% end %> +

<%= submit_tag l(:button_save) %> <%= preview_link({:controller => 'wiki', :action => 'preview', :project_id => @project, :id => @page.title }, 'wiki_form') %> diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb index 193efb0b7..df7bc7d9f 100644 --- a/test/functional/wiki_controller_test.rb +++ b/test/functional/wiki_controller_test.rb @@ -313,6 +313,17 @@ class WikiControllerTest < Redmine::ControllerTest :text => WikiPage.find_by_title('Another_page').content.text end + def test_edit_attachments + @request.session[:user_id] = 2 + get :edit, :params => {:project_id => 'ecookbook', :id => 'Page_with_an_inline_image'} + + assert_select 'fieldset.collapsible' do + assert_select 'div.attachments' do + assert_select 'a.icon.icon-attachment', WikiPage.find_by_title('Page_with_an_inline_image').attachments.first.filename + end + end + end + def test_edit_section @request.session[:user_id] = 2 get :edit, :params => {:project_id => 'ecookbook', :id => 'Page_with_sections', :section => 2}