Added partial in order to show documents collection. Added DocumentsHelper method in order to show documents link with humanized file type and file size
This commit is contained in:
@@ -54,4 +54,11 @@ module DocumentsHelper
|
||||
"direct_upload[resource_relation]": "documents")
|
||||
end
|
||||
|
||||
def document_item_link(document)
|
||||
link_to "#{document.title} <small>(#{document.humanized_content_type} | \
|
||||
#{number_to_human_size(document.attachment_file_size)}</small>)".html_safe,
|
||||
document.attachment.url,
|
||||
target: "_blank",
|
||||
title: t("shared.target_blank_html")
|
||||
end
|
||||
end
|
||||
|
||||
3
app/views/documents/_additional_document.html.erb
Normal file
3
app/views/documents/_additional_document.html.erb
Normal file
@@ -0,0 +1,3 @@
|
||||
<p><span class="icon-document"></span>
|
||||
<%= document_item_link(document) %>
|
||||
</p>
|
||||
@@ -6,15 +6,7 @@
|
||||
<p>
|
||||
<strong><%= t('proposals.show.title_external_url') %></strong>
|
||||
</p>
|
||||
<% documents.each do |document| %>
|
||||
<p><span class="icon-document"></span>
|
||||
<%= link_to "#{document.title} <small>(#{document.humanized_content_type} | \
|
||||
#{number_to_human_size(document.attachment_file_size)}</small>)".html_safe,
|
||||
document.attachment.url,
|
||||
target: "_blank",
|
||||
title: t("shared.target_blank_html") %>
|
||||
</p>
|
||||
<% end %>
|
||||
<%= render partial: 'documents/additional_document', collection: documents, as: :document %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
<div class="small-12 column">
|
||||
<table>
|
||||
<tbody>
|
||||
<% documents.each do |document| %>
|
||||
<%= render "documents/document", document: document %>
|
||||
<% end %>
|
||||
<%= render partial: "documents/document", collection: documents %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user