procedure: use the attachment view to upload files

This commit is contained in:
Pierre de La Morinerie 2019-10-22 09:05:38 +00:00
parent 1c61f2de58
commit aea93779cc

View file

@ -14,17 +14,11 @@
= f.text_area :description, rows: '6', placeholder: 'Description de la démarche, destinataires, etc. ', class: 'form-control'
%h2.header-section Logo de la démarche
- if @procedure.persisted?
= link_to 'supprimer', delete_logo_admin_procedure_path(@procedure), method: :delete
.pj-input
= f.file_field :logo,
direct_upload: true,
= render 'shared/attachment/edit',
{ form: f,
attached_file: @procedure.logo,
accept: 'image/png, image/jpg, image/jpeg',
style: 'display: inline'
%div{ style: 'margin-top: 5px;' }
%i
Fichier accepté : JPG / JPEG / PNG
user_can_destroy: true }
- if !@procedure.locked?
%h2.header-section Conservation des données
@ -65,21 +59,10 @@
= f.text_field :cadre_juridique, class: 'form-control', placeholder: 'https://www.legifrance.gouv.fr/'
= f.label :deliberation, 'Importer le texte'
- deliberation = @procedure.deliberation
- if !deliberation.attached?
.pj-input
= f.file_field :deliberation,
direct_upload: true
- else
%a{ href: url_for(deliberation), target: '_blank', rel: 'noopener' }
= deliberation.filename.to_s
- if @procedure.persisted?
= link_to 'supprimer', delete_deliberation_admin_procedure_path(@procedure), method: :delete
%br
Modifier :
.pj-input
= f.file_field :deliberation,
direct_upload: true
= render 'shared/attachment/edit',
{ form: f,
attached_file: @procedure.deliberation,
user_can_destroy: true }
%h2.header-section
Notice explicative de la démarche
@ -89,22 +72,10 @@
.notice
%p
Une notice explicative est un document destiné à guider lusager dans sa démarche. Cest un document que vous avez élaboré et qui peut prendre la forme dun fichier doc, dun pdf ou encore de diapositives. Le bouton pour télécharger cette notice apparaît en haut du formulaire pour lusager.
- if !notice.attached?
.pj-input
= f.file_field :notice,
direct_upload: true
- else
%a{ href: url_for(notice), target: '_blank', rel: 'noopener' }
= notice.filename.to_s
- if @procedure.persisted?
\-
= link_to 'supprimer', delete_notice_admin_procedure_path(@procedure), method: :delete
%br
Modifier :
.pj-input
= f.file_field :notice,
direct_upload: true
= render 'shared/attachment/edit',
{ form: f,
attached_file: @procedure.notice,
user_can_destroy: true }
- if !@procedure.locked?
%h2.header-section À qui sadresse ma démarche ?