From ed1c6ec5150d38eae97722dfd83272341a91f846 Mon Sep 17 00:00:00 2001 From: Colin Darie Date: Mon, 7 Nov 2022 16:09:15 +0100 Subject: [PATCH] =?UTF-8?q?style(piece=5Fjustificative):=20use=20DSFR=20T?= =?UTF-8?q?=C3=A9l=C3=A9chargement=20de=20fichiers=20for=20instructeurs=20?= =?UTF-8?q?&=20experts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/assets/stylesheets/card.scss | 2 +- app/assets/stylesheets/rich_text.scss | 2 +- .../show_component/show_component.html.haml | 61 ++++++++++--------- .../piece_justificative/_show.html.haml | 6 +- .../shared/dossiers/_champ_row.html.haml | 2 +- 5 files changed, 39 insertions(+), 34 deletions(-) diff --git a/app/assets/stylesheets/card.scss b/app/assets/stylesheets/card.scss index 0a772dc09..30b09f156 100644 --- a/app/assets/stylesheets/card.scss +++ b/app/assets/stylesheets/card.scss @@ -59,7 +59,7 @@ } } - ul { + :not(.fr-downloads-group) > ul { list-style-type: disc; list-style-position: inside; padding-left: $default-padding; diff --git a/app/assets/stylesheets/rich_text.scss b/app/assets/stylesheets/rich_text.scss index fc4df0388..7f6f1559c 100644 --- a/app/assets/stylesheets/rich_text.scss +++ b/app/assets/stylesheets/rich_text.scss @@ -1,6 +1,6 @@ @import "constants"; -.rich-text { +.rich-text:not(.piece_justificative) { i { font-style: italic; } diff --git a/app/components/attachment/show_component/show_component.html.haml b/app/components/attachment/show_component/show_component.html.haml index c95a6cf99..2c1ffb439 100644 --- a/app/components/attachment/show_component/show_component.html.haml +++ b/app/components/attachment/show_component/show_component.html.haml @@ -1,31 +1,34 @@ -.attachment-link{ id: dom_id(attachment, :show) } - - if should_display_link? - = link_to url_for(attachment.blob), target: '_blank', rel: 'noopener', title: "Télécharger la pièce jointe" do - %span.icon.attached +.attachment-link.fr-download{ id: dom_id(attachment, :show) } + %p + - if should_display_link? + = link_to url_for(attachment.blob), download: "", class: "fr-download__link", title: "Télécharger la pièce jointe" do + = attachment.filename.to_s + %span.fr-download__detail + = helpers.download_details(attachment) + + - if !attachment.virus_scanner.started? + (ce fichier n’a pas été analysé par notre antivirus, téléchargez-le avec précaution) + + - else + %span{ data: poll_controller_options } = attachment.filename.to_s - - if !attachment.virus_scanner.started? - (ce fichier n’a pas été analysé par notre antivirus, téléchargez-le avec précaution) - - - else - %span{ data: poll_controller_options } - = attachment.filename.to_s - %span.fr-text-mention--grey - - if attachment.virus_scanner.pending? - (analyse antivirus en cours - = link_to "rafraichir", attachment_path, data: { action: 'turbo-poll#refresh' } - ) - - elsif attachment.watermark_pending? - (traitement de la pièce en cours - = link_to "rafraichir", attachment_path, data: { action: 'turbo-poll#refresh' } - ) - - elsif attachment.virus_scanner.infected? - - if user_can_upload? - (virus détecté, merci d’envoyer un autre fichier) - - else - (virus détecté, le téléchargement de ce fichier est bloqué) - - elsif attachment.virus_scanner.corrupt? - - if user_can_upload? - (le fichier est corrompu, merci d’envoyer un autre fichier) - - else - (le fichier est corrompu, le téléchargement est bloqué) + %span.fr-text-mention--grey + - if attachment.virus_scanner.pending? + (analyse antivirus en cours + = link_to "rafraichir", attachment_path, data: { action: 'turbo-poll#refresh' } + ) + - elsif attachment.watermark_pending? + (traitement de la pièce en cours + = link_to "rafraichir", attachment_path, data: { action: 'turbo-poll#refresh' } + ) + - elsif attachment.virus_scanner.infected? + - if user_can_upload? + (virus détecté, merci d’envoyer un autre fichier) + - else + (virus détecté, le téléchargement de ce fichier est bloqué) + - elsif attachment.virus_scanner.corrupt? + - if user_can_upload? + (le fichier est corrompu, merci d’envoyer un autre fichier) + - else + (le fichier est corrompu, le téléchargement est bloqué) diff --git a/app/views/shared/champs/piece_justificative/_show.html.haml b/app/views/shared/champs/piece_justificative/_show.html.haml index c4cd50bfe..ca4d4bd43 100644 --- a/app/views/shared/champs/piece_justificative/_show.html.haml +++ b/app/views/shared/champs/piece_justificative/_show.html.haml @@ -1,6 +1,8 @@ - pj = champ.piece_justificative_file - if pj.attached? - - pj.attachments.each do |attachment| - = render Attachment::ShowComponent.new(attachment:) + .fr-downloads-group + %ul + - pj.attachments.each do |attachment| + %li= render Attachment::ShowComponent.new(attachment:) - else Pièce justificative non fournie diff --git a/app/views/shared/dossiers/_champ_row.html.haml b/app/views/shared/dossiers/_champ_row.html.haml index 1757203bd..2d35d4302 100644 --- a/app/views/shared/dossiers/_champ_row.html.haml +++ b/app/views/shared/dossiers/_champ_row.html.haml @@ -15,7 +15,7 @@ - else %td.libelle{ class: repetition ? 'padded' : '' } = "#{c.libelle} :" - %td.rich-text + %td.rich-text{ class: c.type_champ } %div{ class: highlight_if_unseen_class(demande_seen_at, c.updated_at) } - case c.type_champ - when TypeDeChamp.type_champs.fetch(:carte)