Feature #28947 » show_existing_attachments_on_wiki_editing_page.patch
| app/helpers/attachments_helper.rb | ||
|---|---|---|
| 31 | 31 |
# Options: |
| 32 | 32 |
# :author -- author names are not displayed if set to false |
| 33 | 33 |
# :thumbails -- display thumbnails if enabled in settings |
| 34 |
# :deletable -- delete links are not displayed if set to false |
|
| 34 | 35 |
def link_to_attachments(container, options = {})
|
| 35 |
options.assert_valid_keys(:author, :thumbnails) |
|
| 36 |
options.assert_valid_keys(:author, :thumbnails, :deletable)
|
|
| 36 | 37 | |
| 37 | 38 |
attachments = if container.attachments.loaded? |
| 38 | 39 |
container.attachments |
| app/views/wiki/edit.html.erb | ||
|---|---|---|
| 33 | 33 |
<p><label><%=l(:label_attachment_plural)%></label><%= render :partial => 'attachments/form' %></p> |
| 34 | 34 |
</div> |
| 35 | 35 | |
| 36 |
<% if @page.attachments.present? %> |
|
| 37 |
<fieldset class="collapsible collapsed"> |
|
| 38 |
<legend onclick="toggleFieldset(this);"><%= l(:label_attachment_plural) %> (<%= @page.attachments.length %>)</legend> |
|
| 39 |
<div style="display: none;"> |
|
| 40 |
<%= link_to_attachments @page, :thumbnails => true, :deletable => false %> |
|
| 41 |
</div> |
|
| 42 |
</fieldset> |
|
| 43 |
<% end %> |
|
| 44 | ||
| 36 | 45 |
<p> |
| 37 | 46 |
<%= submit_tag l(:button_save) %> |
| 38 | 47 |
<%= preview_link({:controller => 'wiki', :action => 'preview', :project_id => @project, :id => @page.title }, 'wiki_form') %>
|
| test/functional/wiki_controller_test.rb | ||
|---|---|---|
| 313 | 313 |
:text => WikiPage.find_by_title('Another_page').content.text
|
| 314 | 314 |
end |
| 315 | 315 | |
| 316 |
def test_edit_attachments |
|
| 317 |
@request.session[:user_id] = 2 |
|
| 318 |
get :edit, :params => {:project_id => 'ecookbook', :id => 'Page_with_an_inline_image'}
|
|
| 319 | ||
| 320 |
assert_select 'fieldset.collapsible' do |
|
| 321 |
assert_select 'div.attachments' do |
|
| 322 |
assert_select 'a.icon.icon-attachment', WikiPage.find_by_title('Page_with_an_inline_image').attachments.first.filename
|
|
| 323 |
end |
|
| 324 |
end |
|
| 325 |
end |
|
| 326 | ||
| 316 | 327 |
def test_edit_section |
| 317 | 328 |
@request.session[:user_id] = 2 |
| 318 | 329 |
get :edit, :params => {:project_id => 'ecookbook', :id => 'Page_with_sections', :section => 2}
|
- « Previous
- 1
- 2
- Next »