style(demande): homogeneize "blank" champs and not attached files champs

This commit is contained in:
Colin Darie 2023-06-27 17:38:37 +02:00
parent da9f76a538
commit 1bdc6c02c6
6 changed files with 16 additions and 10 deletions

View file

@ -1,3 +1,4 @@
--- ---
en: en:
blank: "blank (optional)" blank: "blank (optional)"
blank_attachment: "document not supplied (optional)"

View file

@ -1,3 +1,4 @@
--- ---
fr: fr:
blank: "non saisi (facultatif)" blank: "non saisi (facultatif)"
blank_attachment: "pièce justificative non saisie (facultative)"

View file

@ -14,10 +14,10 @@
%span{ class: highlight_if_unseen_class(@demande_seen_at, champ.updated_at) } %span{ class: highlight_if_unseen_class(@demande_seen_at, champ.updated_at) }
= t(:updated_at, scope: [:views, :shared, :dossiers, :form], datetime: try_format_datetime(champ.updated_at)) = t(:updated_at, scope: [:views, :shared, :dossiers, :form], datetime: try_format_datetime(champ.updated_at))
- if champ.blank? && ![TypeDeChamp.type_champs.fetch(:piece_justificative), TypeDeChamp.type_champs.fetch(:titre_identite)].include?(champ.type_champ) - if champ.blank?
.champ-content.fr-text-mention--grey{ class: [highlight_if_unseen_class(@demande_seen_at, champ.updated_at), champ.type_champ] } .champ-content.fr-text-mention--grey{ class: [highlight_if_unseen_class(@demande_seen_at, champ.updated_at), champ.type_champ] }
%p %p
%em= t('.blank') %em= t(champ.type_de_champ.piece_justificative? ? '.blank_attachment' : '.blank')
- else - else
.champ-content{ class: [highlight_if_unseen_class(@demande_seen_at, champ.updated_at), champ.type_champ] } .champ-content{ class: [highlight_if_unseen_class(@demande_seen_at, champ.updated_at), champ.type_champ] }
- case champ.type_champ - case champ.type_champ

View file

@ -43,6 +43,10 @@ class Champs::PieceJustificativeChamp < Champ
mandatory? && !piece_justificative_file.attached? mandatory? && !piece_justificative_file.attached?
end end
def blank?
piece_justificative_file.blank?
end
def for_export def for_export
piece_justificative_file.map { _1.filename.to_s }.join(', ') piece_justificative_file.map { _1.filename.to_s }.join(', ')
end end

View file

@ -37,6 +37,10 @@ class Champs::TitreIdentiteChamp < Champ
mandatory? && !piece_justificative_file.attached? mandatory? && !piece_justificative_file.attached?
end end
def blank?
piece_justificative_file.blank?
end
def for_export def for_export
piece_justificative_file.attached? ? "présent" : "absent" piece_justificative_file.attached? ? "présent" : "absent"
end end

View file

@ -1,8 +1,4 @@
- pj = champ.piece_justificative_file
- if pj.attached?
.fr-downloads-group .fr-downloads-group
%ul %ul
- pj.attachments.each do |attachment| - champ.piece_justificative_file.attachments.each do |attachment|
%li= render Attachment::ShowComponent.new(attachment:, new_tab: true) %li= render Attachment::ShowComponent.new(attachment:, new_tab: true)
- else
Pièce justificative non fournie