refactor(attachment): use new components
This commit is contained in:
parent
2ce389d474
commit
bc77390cfe
17 changed files with 23 additions and 29 deletions
|
@ -18,7 +18,7 @@
|
|||
|
||||
- if commentaire.piece_jointe.attached?
|
||||
.attachment-link
|
||||
= render partial: "shared/attachment/show", locals: { attachment: commentaire.piece_jointe.attachment }
|
||||
= render Attachment::ShowComponent.new(attachment: commentaire.piece_jointe.attachment)
|
||||
|
||||
- if show_reply_button?
|
||||
= button_tag type: 'button', class: 'button small message-answer-button', onclick: 'document.querySelector("#commentaire_body").focus()' do
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
= tag[:description]
|
||||
|
||||
%h3.header-subsection Logo de l'attestation
|
||||
= image_upload_and_render f, @attestation_template.logo, false
|
||||
= render Attachment::EditComponent.image(f, @attestation_template.logo, false)
|
||||
|
||||
%p.notice
|
||||
Formats acceptés : JPG / JPEG / PNG.
|
||||
|
@ -33,7 +33,7 @@
|
|||
Dimensions conseillées : au minimum 500 px de largeur ou de hauteur, poids maximum : 0,5 Mo.
|
||||
|
||||
%h3.header-subsection Tampon de l'attestation
|
||||
= image_upload_and_render f, @attestation_template.signature, false
|
||||
= render Attachment::EditComponent.image(f, @attestation_template.signature, false)
|
||||
|
||||
%p.notice
|
||||
Formats acceptés : JPG / JPEG / PNG.
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
= f.select :zone_id, grouped_options_for_zone
|
||||
|
||||
%h3.header-subsection Logo de la démarche
|
||||
= image_upload_and_render f, @procedure.logo
|
||||
= render Attachment::EditComponent.image(f, @procedure.logo)
|
||||
|
||||
%h3.header-subsection Conservation des données
|
||||
= f.label :duree_conservation_dossiers_dans_ds do
|
||||
|
@ -55,7 +55,7 @@
|
|||
= f.text_field :cadre_juridique, class: 'form-control', placeholder: 'https://www.legifrance.gouv.fr/'
|
||||
|
||||
= f.label :deliberation, 'Importer le texte'
|
||||
= text_upload_and_render f, @procedure.deliberation
|
||||
= render Attachment::EditComponent.text(f, @procedure.deliberation)
|
||||
|
||||
%h3.header-subsection
|
||||
RGPD
|
||||
|
@ -73,7 +73,7 @@
|
|||
%p.notice
|
||||
Formats acceptés : .doc, .odt, .pdf, .ppt, .pptx
|
||||
- notice = @procedure.notice
|
||||
= text_upload_and_render f, @procedure.notice
|
||||
= render Attachment::EditComponent.text(f, @procedure.notice)
|
||||
|
||||
- if !@procedure.locked?
|
||||
%h3.header-subsection À qui s’adresse ma démarche ?
|
||||
|
|
|
@ -12,12 +12,12 @@
|
|||
%p.introduction= @avis.introduction
|
||||
|
||||
- if @avis.introduction_file.attached?
|
||||
= render partial: 'shared/attachment/show', locals: { attachment: @avis.introduction_file.attachment }
|
||||
= render Attachment::ShowComponent.new(attachment: @avis.introduction_file.attachment)
|
||||
%br/
|
||||
|
||||
= form_for @avis, url: expert_avis_path(@avis.procedure, @avis), html: { class: 'form', data: { persisted_content_id: @avis.id } } do |f|
|
||||
= f.text_area :answer, rows: 3, placeholder: 'Votre avis', required: true, class: 'persisted-input'
|
||||
= text_upload_and_render f, @avis.piece_justificative_file
|
||||
= render Attachment::EditComponent.text(f, @avis.piece_justificative_file)
|
||||
|
||||
.flex.justify-between.align-baseline
|
||||
%p.confidentiel.flex
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
= f.text_area :introduction, rows: 3, value: avis.introduction || 'Bonjour, merci de me donner votre avis sur ce dossier.', required: true
|
||||
%p.tab-title Ajouter une pièce jointe
|
||||
.form-group
|
||||
= text_upload_and_render f, avis.introduction_file
|
||||
= render Attachment::EditComponent.text(f, avis.introduction_file)
|
||||
|
||||
- if linked_dossiers.present?
|
||||
= f.check_box :invite_linked_dossiers, {}, true, false
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
= f.text_area :introduction, rows: 3, value: avis.introduction || 'Bonjour, merci de me donner votre avis sur ce dossier.', required: true, class: 'persisted-input'
|
||||
%p.tab-title Ajouter une pièce jointe
|
||||
.form-group
|
||||
= text_upload_and_render f, avis.introduction_file
|
||||
= render Attachment::EditComponent.text(f, avis.introduction_file)
|
||||
|
||||
- if linked_dossiers.present?
|
||||
= f.check_box :invite_linked_dossiers, {}, true, false
|
||||
|
|
|
@ -33,6 +33,6 @@
|
|||
%span.waiting
|
||||
= t('en_attente', scope: 'views.shared.avis')
|
||||
- if avis.piece_justificative_file.attached?
|
||||
= render partial: 'shared/attachment/show', locals: { attachment: avis.piece_justificative_file.attachment }
|
||||
= render Attachment::ShowComponent.new(attachment: avis.piece_justificative_file.attachment)
|
||||
.answer-body
|
||||
= simple_format(avis.answer)
|
||||
|
|
|
@ -12,12 +12,12 @@
|
|||
%p.introduction= @avis.introduction
|
||||
|
||||
- if @avis.introduction_file.attached?
|
||||
= render partial: 'shared/attachment/show', locals: { attachment: @avis.introduction_file.attachment }
|
||||
= render Attachment::ShowComponent.new(attachment: @avis.introduction_file.attachment)
|
||||
%br/
|
||||
|
||||
= form_for @avis, url: instructeur_avis_path(@avis.procedure, @avis), html: { class: 'form' } do |f|
|
||||
= f.text_area :answer, rows: 3, placeholder: 'Votre avis', required: true
|
||||
= text_upload_and_render f, @avis.piece_justificative_file
|
||||
= render Attachment::EditComponent.text(f, @avis.piece_justificative_file)
|
||||
|
||||
.flex.justify-between.align-baseline
|
||||
%p.confidentiel.flex
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
%p= message.body
|
||||
.answer.flex.align-start
|
||||
- if message.piece_jointe.present?
|
||||
= render partial: 'shared/attachment/show', locals: { attachment: message.piece_jointe.attachment }
|
||||
= render Attachment::ShowComponent.new(attachment: message.piece_jointe.attachment)
|
||||
- else
|
||||
.page-title.center
|
||||
%h2 Il n'y a aucun dossier en brouillon dans vos groupes instructeurs
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
= render partial: "dossiers_filter", locals: { procedure: @procedure, procedure_presentation: @procedure_presentation, current_filters: @current_filters, statut: @statut, displayed_fields_options: @displayed_fields_options }
|
||||
- if @dossiers_count > 0
|
||||
.dossiers-export
|
||||
= render partial: "dossiers_export", locals: { procedure: @procedure, exports: @exports, statut: @statut, count: @dossiers_count }
|
||||
= render Dossiers::ExportComponent.new(procedure: @procedure, exports: @exports, statut: @statut, count: @dossiers_count)
|
||||
|
||||
%table.table.dossiers-table.hoverable
|
||||
%thead
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
= f.text_area :introduction, rows: 3, value: avis.introduction || 'Bonjour, merci de me donner votre avis sur ce dossier.', required: true, class: "persisted-input"
|
||||
%p.tab-title Ajouter une pièce jointe
|
||||
.form-group
|
||||
= text_upload_and_render f, avis.introduction_file
|
||||
= render Attachment::EditComponent.text(f, avis.introduction_file)
|
||||
|
||||
- if linked_dossiers.present?
|
||||
= f.check_box :invite_linked_dossiers, {}, true, false
|
||||
|
|
|
@ -41,11 +41,11 @@
|
|||
|
|
||||
= link_to(t('revoke', scope: 'helpers.label'), revoquer_instructeur_avis_path(avis.procedure, avis), data: { confirm: t('revoke', scope: 'helpers.confirmation', email: avis.expert.email) }, method: :patch)
|
||||
- if avis.introduction_file.attached?
|
||||
= render partial: 'shared/attachment/show', locals: { attachment: avis.introduction_file.attachment }
|
||||
= render Attachment::ShowComponent.new(attachment: avis.introduction_file.attachment)
|
||||
.answer-body.mb-3
|
||||
%p #{t('views.instructeurs.avis.introduction_file_explaination')} #{avis.claimant.email}
|
||||
|
||||
- if avis.piece_justificative_file.attached?
|
||||
= render partial: 'shared/attachment/show', locals: { attachment: avis.piece_justificative_file.attachment }
|
||||
= render Attachment::ShowComponent.new(attachment: avis.piece_justificative_file.attachment)
|
||||
.answer-body
|
||||
= simple_format(avis.answer)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
- pj = champ.piece_justificative_file
|
||||
- if pj.attached?
|
||||
= render partial: "shared/attachment/show", locals: { attachment: pj.attachment }
|
||||
= render Attachment::ShowComponent.new(attachment: pj.attachment)
|
||||
- else
|
||||
Pièce justificative non fournie
|
||||
|
|
|
@ -8,4 +8,4 @@
|
|||
%td.libelle Justificatif :
|
||||
%td
|
||||
.action
|
||||
= render partial: 'shared/attachment/show', locals: { attachment: dossier.justificatif_motivation.attachment }
|
||||
= render Attachment::ShowComponent.new(attachment: dossier.justificatif_motivation.attachment)
|
||||
|
|
|
@ -1,4 +1 @@
|
|||
= render 'shared/attachment/edit',
|
||||
{ form: form,
|
||||
attached_file: champ.piece_justificative_file,
|
||||
template: champ.type_de_champ.piece_justificative_template, user_can_destroy: true }
|
||||
= render Attachment::EditComponent.new(form: form, attached_file: champ.piece_justificative_file, template: champ.type_de_champ.piece_justificative_template, user_can_destroy: true)
|
||||
|
|
|
@ -1,4 +1 @@
|
|||
= render 'shared/attachment/edit',
|
||||
{ form: form,
|
||||
attached_file: champ.piece_justificative_file,
|
||||
user_can_destroy: true }
|
||||
= render Attachment::EditComponent.new(form: form, attached_file: champ.piece_justificative_file, user_can_destroy: true)
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
- if dossier.present? && dossier.justificatif_motivation.attached?
|
||||
= render partial: "shared/attachment/show", locals: { attachment: dossier.justificatif_motivation.attachment }
|
||||
= render Attachment::ShowComponent.new(attachment: dossier.justificatif_motivation.attachment)
|
||||
|
|
Loading…
Reference in a new issue