refactor(piece_justificative): UX follows mockups

This commit is contained in:
Colin Darie 2022-11-09 12:33:20 +01:00
parent 84ca01bdf7
commit b13c5e56f6
39 changed files with 373 additions and 272 deletions

View file

@ -1,28 +1,38 @@
.fr-mb-2w.attachment
.fr-mb-2w.attachment.fr-upload-group{ id: attachment ? dom_id(attachment, :edit) : nil }
- if persisted?
.attachment-actions{ id: dom_id(attachment, :actions) }
.attachment-action
= render Attachment::ShowComponent.new(attachment: attachment, user_can_upload: true)
- if user_can_destroy?
.attachment-action{ "data-turbo": "true" }
= link_to('Supprimer', attachment_path, **remove_button_options)
%div{ id: dom_id(attachment, :persisted_row) }
.flex.flex-gap-2{ class: class_names("attachment-error": attachment.virus_scanner_error?) }
= link_to('Supprimer', destroy_attachment_path, **remove_button_options, class: "fr-btn fr-btn--tertiary fr-btn--sm fr-icon-delete-line", title: "Supprimer le fichier #{attachment.filename}")
.attachment-error.hidden
.attachment-error-message
%p.attachment-error-title
Une erreur sest produite pendant lenvoi du fichier.
%p.attachment-error-description
Une erreur inconnue s'est produite pendant l'envoi du fichier
= button_tag(**retry_button_options) do
%span.icon.retry
Ré-essayer
.fr-py-1v
%span.attachment-filename= attachment.filename.to_s
- if in_progress?
%p.fr-badge.fr-badge--info.fr-badge--sm.fr-badge--no-icon.fr-ml-1w
= progress_bar_label
- if !persisted?
%p.fr-text--sm.fr-text-mention--grey
= t('.max_file_size', max_file_size: number_to_human_size(max_file_size))
- if error?
%p.fr-error-text= error_message
- elsif first?
%p.fr-text--sm.fr-text-mention--grey.fr-mb-1w
- if max_file_size.present?
= t('.max_file_size', max_file_size: number_to_human_size(max_file_size))
- if allowed_formats
Formats supportés :
= allowed_formats.join(', ')
%p= form.file_field(file_field_name, **file_field_options)
- if !as_multiple?
= file_field(champ, file_field_name, **file_field_options)
- if in_progress?
%div{ data: poll_controller_options }
- if attachment.created_at < 30.seconds.ago
.fr-mt-2w
= render partial: "attachments/pending_refresh", url: attachment_path
.attachment-error.hidden
%p.fr-error-text Une erreur sest produite pendant lenvoi du fichier.
= button_tag(**retry_button_options) do
Ré-essayer