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")
|
"direct_upload[resource_relation]": "documents")
|
||||||
end
|
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
|
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>
|
<p>
|
||||||
<strong><%= t('proposals.show.title_external_url') %></strong>
|
<strong><%= t('proposals.show.title_external_url') %></strong>
|
||||||
</p>
|
</p>
|
||||||
<% documents.each do |document| %>
|
<%= render partial: 'documents/additional_document', collection: documents, as: :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 %>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -14,9 +14,7 @@
|
|||||||
<div class="small-12 column">
|
<div class="small-12 column">
|
||||||
<table>
|
<table>
|
||||||
<tbody>
|
<tbody>
|
||||||
<% documents.each do |document| %>
|
<%= render partial: "documents/document", collection: documents %>
|
||||||
<%= render "documents/document", document: document %>
|
|
||||||
<% end %>
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user