refactor(piece_justificative): UX follows mockups
This commit is contained in:
parent
84ca01bdf7
commit
b13c5e56f6
39 changed files with 373 additions and 272 deletions
6
app/views/attachments/_pending_refresh.html.haml
Normal file
6
app/views/attachments/_pending_refresh.html.haml
Normal file
|
@ -0,0 +1,6 @@
|
|||
= render Dsfr::CalloutComponent.new(title: nil) do |c|
|
||||
- c.with_body do
|
||||
L’analyse antivirus de votre ou de vos pièces jointes prend plus de temps que prévu.
|
||||
- c.with_bottom do
|
||||
= button_tag "Rafraîchir le traitement", type: "button", class: "fr-btn", data: { action: 'click->turbo-poll#refresh' }
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
= turbo_stream.remove dom_id(@attachment, :actions)
|
||||
= turbo_stream.dispatch "attachment:destroyed", { target_id: dom_id(@attachment) }
|
||||
= turbo_stream.remove dom_id(@attachment, :persisted_row)
|
||||
|
||||
- if @champ_id
|
||||
= turbo_stream.show "attachment-multiple-empty-#{@champ_id}"
|
||||
|
||||
= turbo_stream.show_all ".attachment-input-#{@attachment.id}"
|
||||
|
|
|
@ -1,2 +1,5 @@
|
|||
= turbo_stream.replace dom_id(@attachment, :show) do
|
||||
= render Attachment::ShowComponent.new(attachment: @attachment, user_can_upload: @user_can_upload)
|
||||
= turbo_stream.replace dom_id(@attachment, :edit) do
|
||||
- if @user_can_edit
|
||||
= render Attachment::EditComponent.new(attachment: @attachment, attached_file: @attachment.record.public_send(@attachment.name), auto_attach_url: @auto_attach_url)
|
||||
- else
|
||||
= render Attachment::ShowComponent.new(attachment: @attachment)
|
||||
|
|
|
@ -2,6 +2,5 @@
|
|||
= turbo_stream.morph @champ.input_group_id do
|
||||
= render EditableChamp::EditableChampComponent.new champ: @champ, form: form
|
||||
|
||||
|
||||
- @champ.piece_justificative_file.attachments.each do |attachment|
|
||||
= turbo_stream.focus_all "button[data-toggle-target=\".attachment-input-#{attachment.id}\"]"
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
= 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
|
||||
= render Attachment::EditComponent.new(form: f, attached_file: @avis.piece_justificative_file, user_can_destroy: true)
|
||||
= render Attachment::EditComponent.new(object: f.object, attached_file: @avis.piece_justificative_file, user_can_destroy: true)
|
||||
|
||||
.flex.justify-between.align-baseline
|
||||
%p.confidentiel.flex
|
||||
|
|
|
@ -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
|
||||
%p.tab-title Ajouter une pièce jointe
|
||||
.form-group
|
||||
= render Attachment::EditComponent.new(form: f, attached_file: avis.introduction_file, user_can_destroy: true)
|
||||
= render Attachment::EditComponent.new(object: f.object, attached_file: avis.introduction_file, user_can_destroy: true)
|
||||
|
||||
- if linked_dossiers.present?
|
||||
= f.check_box :invite_linked_dossiers, {}, true, false
|
||||
|
|
|
@ -348,3 +348,39 @@
|
|||
Des marges verticales ont ici été rajoutées.
|
||||
|
||||
|
||||
|
||||
.container
|
||||
%h1.fr-mt-4w Attachment::EditComponent
|
||||
%span.fr-hint-text Note: direct upload, suppression ne marchent pas comme attendu ici.
|
||||
|
||||
- champ = @dossier.champs_public.first
|
||||
- tdc = @dossier.champs_public.find { _1.type_champ == TypeDeChamp.type_champs.fetch(:piece_justificative) }.type_de_champ
|
||||
|
||||
- if attachment = ActiveStorage::Attachment.last
|
||||
- attachment.update(created_at: 1.second.ago)
|
||||
%h3 New attachment
|
||||
= render Attachment::EditComponent.new(champ:, attached_file: champ.piece_justificative_file, attachment: nil)
|
||||
|
||||
%h3.fr-mt-4w Existing attachment
|
||||
= render Attachment::EditComponent.new(champ:, attached_file: champ.piece_justificative_file, attachment:)
|
||||
|
||||
%h3.fr-mt-4w Existing attachment, antivirus in progress
|
||||
- attachment.blob.metadata[:virus_scan_result] = ActiveStorage::VirusScanner::PENDING
|
||||
- attachment.created_at = Time.zone.now
|
||||
= render Attachment::EditComponent.new(champ:, attached_file: Champ.new.piece_justificative_file, attachment:)
|
||||
|
||||
%h3.fr-mt-4w Existing attachment, antivirus in progress since long time
|
||||
- attachment.blob.metadata[:virus_scan_result] = ActiveStorage::VirusScanner::PENDING
|
||||
- attachment.created_at = 2.minutes.ago
|
||||
= render Attachment::EditComponent.new(champ:, attached_file: Champ.new.piece_justificative_file, attachment:)
|
||||
|
||||
%h3.fr-mt-4w Existing attachment, error
|
||||
- attachment.blob.metadata[:virus_scan_result] = ActiveStorage::VirusScanner::INFECTED
|
||||
= render Attachment::EditComponent.new(champ:, attached_file: Champ.new.piece_justificative_file, attachment:)
|
||||
|
||||
%h3.fr-mt-4w New attachment not on Champ
|
||||
= render Attachment::EditComponent.new(auto_attach_url: "/some-auto-attach-path", attached_file: tdc.piece_justificative_template, attachment: nil)
|
||||
|
||||
%h3.fr-mt-4w Existing attachment not on Champ
|
||||
= render Attachment::EditComponent.new(auto_attach_url: "/some-auto-attach-path", attached_file: tdc.piece_justificative_template, attachment: attachment.reload)
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
- disable_piece_jointe = defined?(disable_piece_jointe) ? disable_piece_jointe : false
|
||||
%div
|
||||
- if !disable_piece_jointe
|
||||
= render Attachment::EditComponent.new(form: f, attached_file: commentaire.piece_jointe)
|
||||
= render Attachment::EditComponent.new(object: f.object, attached_file: commentaire.piece_jointe)
|
||||
|
||||
%div
|
||||
= f.submit t('views.shared.dossiers.messages.form.send_message'), class: 'button primary send', data: { disable: true }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue