Feature #28947 » show_existing_attachments_on_wiki_editing_page.patch
| app/helpers/attachments_helper.rb | ||
|---|---|---|
|
# 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
|
||
| app/views/wiki/edit.html.erb | ||
|---|---|---|
|
<p><label><%=l(:label_attachment_plural)%></label><%= render :partial => 'attachments/form' %></p>
|
||
|
</div>
|
||
|
<% if @page.attachments.present? %>
|
||
|
<fieldset class="collapsible collapsed">
|
||
|
<legend onclick="toggleFieldset(this);"><%= l(:label_attachment_plural) %> (<%= @page.attachments.length %>)</legend>
|
||
|
<div style="display: none;">
|
||
|
<%= link_to_attachments @page, :thumbnails => true, :deletable => false %>
|
||
|
</div>
|
||
|
</fieldset>
|
||
|
<% end %>
|
||
|
<p>
|
||
|
<%= submit_tag l(:button_save) %>
|
||
|
<%= preview_link({:controller => 'wiki', :action => 'preview', :project_id => @project, :id => @page.title }, 'wiki_form') %>
|
||
| test/functional/wiki_controller_test.rb | ||
|---|---|---|
|
: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}
|
||
- « Previous
- 1
- 2
- Next »