From 81d6e193e5bb57b51970d6bd421d2850ed066bd5 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Fri, 28 Dec 2018 16:18:58 +0100 Subject: [PATCH] Extract the piece_justificative champ view in a partial --- app/views/shared/champs/piece_justificative/_show.html.haml | 5 +++++ app/views/shared/dossiers/_champs.html.haml | 6 +----- 2 files changed, 6 insertions(+), 5 deletions(-) create mode 100644 app/views/shared/champs/piece_justificative/_show.html.haml diff --git a/app/views/shared/champs/piece_justificative/_show.html.haml b/app/views/shared/champs/piece_justificative/_show.html.haml new file mode 100644 index 000000000..6c0e1cf7e --- /dev/null +++ b/app/views/shared/champs/piece_justificative/_show.html.haml @@ -0,0 +1,5 @@ +- pj = champ.piece_justificative_file +- if pj.attached? + = render partial: "shared/champs/piece_justificative/pj_link", locals: { champ: champ, user_can_upload: false } +- else + Pièce justificative non fournie diff --git a/app/views/shared/dossiers/_champs.html.haml b/app/views/shared/dossiers/_champs.html.haml index 698aee6fd..9703e0351 100644 --- a/app/views/shared/dossiers/_champs.html.haml +++ b/app/views/shared/dossiers/_champs.html.haml @@ -27,11 +27,7 @@ = "#{c.libelle} :" %td.rich-text %span{ class: highlight_if_unseen_class(demande_seen_at, c.updated_at) } - - pj = c.piece_justificative_file - - if pj.attached? - = render partial: "shared/champs/piece_justificative/pj_link", locals: { champ: c, user_can_upload: false } - - else - Pièce justificative non fournie + = render partial: "shared/champs/piece_justificative/show", locals: { champ: c } - when TypeDeChamp.type_champs.fetch(:textarea) %th.libelle = "#{c.libelle} :"