Moving humanized_content_type from DocumentablesHelper to Document model. Removing humanized_file_size in favor of direct use of number_to_human_size form ActionViewHelper. Added additional documentens to all concerned views
This commit is contained in:
@@ -37,12 +37,4 @@ module DocumentablesHelper
|
||||
def max_documents_allowed?(documentable)
|
||||
documentable.documents.count >= documentable.class.max_documents_allowed
|
||||
end
|
||||
|
||||
def documentable_humanized_content_type(documentable_class)
|
||||
documentable_class.attachment_content_type.split("/").last.upcase
|
||||
end
|
||||
|
||||
def documentable_humanized_file_size(documentable_class)
|
||||
number_to_human_size(documentable_class.attachment_file_size)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -52,6 +52,10 @@ class Document < ActiveRecord::Base
|
||||
end
|
||||
end
|
||||
|
||||
def humanized_content_type
|
||||
attachment_content_type.split("/").last.upcase
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def documentable_class
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
</p>
|
||||
<% documents.each do |document| %>
|
||||
<p><span class="icon-document"></span>
|
||||
<%= link_to "#{document.title} <small>(#{documentable_humanized_content_type(document)} | \
|
||||
#{documentable_humanized_file_size(document)}</small>)".html_safe,
|
||||
<%= 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") %>
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
<%= render 'legislation/processes/header', process: @process, header: :small %>
|
||||
|
||||
<%= render 'documents/additional_documents', documents: @process.documents %>
|
||||
|
||||
<%= render 'legislation/processes/key_dates', process: @process, phase: :allegations_phase %>
|
||||
|
||||
<div class="column row">
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
<%= render 'legislation/processes/header', process: @process, header: :small %>
|
||||
|
||||
<%= render 'documents/additional_documents', documents: @process.documents %>
|
||||
|
||||
<%= render 'legislation/processes/key_dates', process: @process, phase: :allegations_phase %>
|
||||
|
||||
<div class="column row">
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
<%= render 'legislation/processes/header', process: @process, header: :full %>
|
||||
|
||||
<%= render 'documents/additional_documents', documents: @process.documents %>
|
||||
|
||||
<%= render 'legislation/processes/key_dates', process: @process, phase: @phase %>
|
||||
|
||||
<div class="debate-chooser">
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
<%= render 'legislation/processes/header', process: @process, header: :full %>
|
||||
|
||||
<%= render 'documents/additional_documents', documents: @process.documents %>
|
||||
|
||||
<%= render 'legislation/processes/key_dates', process: @process, phase: @phase %>
|
||||
|
||||
<div class="debate-chooser">
|
||||
|
||||
Reference in New Issue
Block a user