diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss index 06fdfd396..fc5ac0c6a 100644 --- a/app/assets/stylesheets/layout.scss +++ b/app/assets/stylesheets/layout.scss @@ -2395,3 +2395,29 @@ table { } } } + +.additional-document-link { + background: $highlight-soft; + border: 1px solid $highlight; + display: block; + margin: $line-height / 2 0; + padding: $line-height / 2; + position: relative; + + a { + word-wrap: break-word; + } + + .icon-document { + color: #007bb7; + display: inline-block; + font-size: rem-calc(24); + line-height: $line-height; + vertical-align: middle; + } +} + +.document-divider { + background: #fafafa; + border-bottom: 1px solid #eee; +} diff --git a/app/assets/stylesheets/participation.scss b/app/assets/stylesheets/participation.scss index a887d83de..456b10506 100644 --- a/app/assets/stylesheets/participation.scss +++ b/app/assets/stylesheets/participation.scss @@ -311,7 +311,9 @@ .proposal-form, .proposal-edit, .polls-form, -.poll-question-form { +.poll-question-form, +.legislation-process-new, +.legislation-process-edit { @include direct-uploads; } diff --git a/app/controllers/admin/legislation/processes_controller.rb b/app/controllers/admin/legislation/processes_controller.rb index 5d8d828cd..aef452322 100644 --- a/app/controllers/admin/legislation/processes_controller.rb +++ b/app/controllers/admin/legislation/processes_controller.rb @@ -52,7 +52,8 @@ class Admin::Legislation::ProcessesController < Admin::Legislation::BaseControll :allegations_phase_enabled, :draft_publication_enabled, :result_publication_enabled, - :published + :published, + documents_attributes: [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy] ) end end diff --git a/app/helpers/documentables_helper.rb b/app/helpers/documentables_helper.rb index 3fe56abd2..8e832535f 100644 --- a/app/helpers/documentables_helper.rb +++ b/app/helpers/documentables_helper.rb @@ -38,4 +38,11 @@ module DocumentablesHelper 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 diff --git a/app/models/legislation/process.rb b/app/models/legislation/process.rb index b6043df57..03c8e3095 100644 --- a/app/models/legislation/process.rb +++ b/app/models/legislation/process.rb @@ -1,6 +1,10 @@ class Legislation::Process < ActiveRecord::Base acts_as_paranoid column: :hidden_at include ActsAsParanoidAliases + include Documentable + documentable max_documents_allowed: 3, + max_file_size: 3.megabytes, + accepted_content_types: [ "application/pdf" ] PHASES_AND_PUBLICATIONS = %i(debate_phase allegations_phase draft_publication result_publication).freeze diff --git a/app/views/admin/legislation/processes/_form.html.erb b/app/views/admin/legislation/processes/_form.html.erb index 205d97361..43de37aa2 100644 --- a/app/views/admin/legislation/processes/_form.html.erb +++ b/app/views/admin/legislation/processes/_form.html.erb @@ -152,6 +152,13 @@ +
+ <%= t('proposals.show.title_external_url') %> +
+ <% documents.each do |document| %> ++ <%= link_to "#{document.title} (#{documentable_humanized_content_type(document)} | \ + #{documentable_humanized_file_size(document)})".html_safe, + document.attachment.url, + target: "_blank", + title: t("shared.target_blank_html") %> +
+ <% end %> +