Extract the dossier_link champ view in a partial

This commit is contained in:
gregoirenovel 2018-12-28 16:16:41 +01:00
parent 004cdd4c43
commit c7f2293c15
2 changed files with 12 additions and 11 deletions

View file

@ -0,0 +1,11 @@
- dossier = Dossier.includes(:procedure).find_by(id: champ.to_s)
- if dossier
- path = dossier_linked_path(current_gestionnaire, dossier)
- if path.present?
= link_to("Dossier nº #{dossier.id}", path, target: '_blank')
- else
Dossier nº #{dossier.id}
%br
= sanitize(dossier.text_summary)
- else
Pas de dossier associé

View file

@ -21,17 +21,7 @@
= "#{c.libelle} :"
%td.rich-text
%span{ class: highlight_if_unseen_class(demande_seen_at, c.updated_at) }
- dossier = Dossier.includes(:procedure).find_by(id: c.to_s)
- if dossier
- path = dossier_linked_path(current_gestionnaire, dossier)
- if path.present?
= link_to("Dossier nº #{dossier.id}", path, target: '_blank')
- else
Dossier nº #{dossier.id}
%br
= sanitize(dossier.text_summary)
- else
Pas de dossier associé
= render partial: "shared/champs/dossier_link/show", locals: { champ: c }
- when TypeDeChamp.type_champs.fetch(:piece_justificative)
%th.libelle
= "#{c.libelle} :"