Extract the pieces jointes part into a partial

This commit is contained in:
gregoirenovel 2017-10-16 17:01:12 +02:00
parent e053a40902
commit d42e438546
3 changed files with 22 additions and 43 deletions

View file

@ -23,24 +23,4 @@
- if @dossier.procedure.cerfa_flag? || @dossier.types_de_piece_justificative.any?
.backoffice-title Pièces jointes
.card
%table.table.vertical
%tbody
- if @dossier.procedure.cerfa_flag?
%tr
%th Formulaire :
%td
- if @dossier.cerfa_available?
= link_to 'Télécharger', @dossier.cerfa.last.content_url, class: 'button', target: :blank
- else
Pièce non fournie
- @dossier.procedure.types_de_piece_justificative.each do |type_de_piece_justificative|
%tr
%th= "#{type_de_piece_justificative.libelle} :"
%td
- pj = @dossier.retrieve_last_piece_justificative_by_type(type_de_piece_justificative.id)
- if pj.present?
Pièce fournie -
= link_to "Consulter", pj.content_url, class: "link", target: :blank
- else
Pièce non fournie
= render partial: "new_gestionnaire/dossiers/pieces_jointes", locals: { dossier: @dossier }

View file

@ -0,0 +1,20 @@
%table.table.vertical
%tbody
- if dossier.procedure.cerfa_flag?
%tr
%th Formulaire :
%td
- if @dossier.cerfa_available?
= link_to "Télécharger", @dossier.cerfa.last.content_url, class: "link", target: :blank
- else
Pièce non fournie
- dossier.procedure.types_de_piece_justificative.each do |type_de_piece_justificative|
%tr
%th= "#{type_de_piece_justificative.libelle} :"
%td
- pj = dossier.retrieve_last_piece_justificative_by_type(type_de_piece_justificative.id)
- if pj.present?
= link_to "Télécharger", pj.content_url, class: "link", target: :blank
- else
Pièce non fournie

View file

@ -22,25 +22,4 @@
- if @dossier.procedure.cerfa_flag? || @dossier.types_de_piece_justificative.any?
.backoffice-title Pièces jointes
.card
%table.table.vertical
%tbody
- if @dossier.procedure.cerfa_flag?
%tr
%th Formulaire :
%td
- if @dossier.cerfa_available?
Pièce fournie -
= link_to "Consulter", @dossier.cerfa.last.content_url, class: "link", target: :blank
- else
Pièce non fournie
- @dossier.procedure.types_de_piece_justificative.each do |type_de_piece_justificative|
%tr
%th= "#{type_de_piece_justificative.libelle} :"
%td
- pj = @dossier.retrieve_last_piece_justificative_by_type(type_de_piece_justificative.id)
- if pj.present?
Pièce fournie -
= link_to "Consulter", pj.content_url, class: "link", target: :blank
- else
Pièce non fournie
= render partial: "pieces_jointes", locals: { dossier: @dossier }