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:
Manuel Ortega
2017-10-21 16:53:41 +02:00
parent b8a45eda58
commit 3531060476
4 changed files with 12 additions and 12 deletions

View File

@@ -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

View File

@@ -0,0 +1,3 @@
<p><span class="icon-document"></span>&nbsp;
<%= document_item_link(document) %>
</p>

View File

@@ -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>&nbsp;
<%= 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>

View File

@@ -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>