diff --git a/app/assets/stylesheets/new_design/pj.scss b/app/assets/stylesheets/new_design/pj.scss new file mode 100644 index 000000000..b85ce7773 --- /dev/null +++ b/app/assets/stylesheets/new_design/pj.scss @@ -0,0 +1,13 @@ +.pj { + th { + vertical-align: middle; + } + + .dropdown-items a { + flex-direction: column; + } + + .filename { + font-weight: bold; + } +} diff --git a/app/helpers/piece_justificative_helper.rb b/app/helpers/piece_justificative_helper.rb new file mode 100644 index 000000000..d8f0aa7a5 --- /dev/null +++ b/app/helpers/piece_justificative_helper.rb @@ -0,0 +1,5 @@ +module PieceJustificativeHelper + def display_pj_filename(pj) + truncate(pj.original_filename, length: 60) + end +end diff --git a/app/views/new_gestionnaire/dossiers/_pieces_jointes.html.haml b/app/views/new_gestionnaire/dossiers/_pieces_jointes.html.haml index b25240793..c37a65765 100644 --- a/app/views/new_gestionnaire/dossiers/_pieces_jointes.html.haml +++ b/app/views/new_gestionnaire/dossiers/_pieces_jointes.html.haml @@ -1,4 +1,4 @@ -%table.table.vertical +%table.table.vertical.pj %tbody - if dossier.procedure.cerfa_flag? %tr @@ -12,9 +12,22 @@ - 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 + - pjs = dossier.retrieve_all_piece_justificative_by_type(type_de_piece_justificative.id).to_ary.dup + - if pjs.present? + - first_pj = pjs.pop + %td= display_pj_filename(first_pj) + %td= link_to "Télécharger", first_pj.content_url, class: "link", target: :blank + %td + - if pjs.present? + %span.button.dropdown + anciennes versions + .dropdown-content.fade-in-down + %ul.dropdown-items + - pjs.each do |pj| + %li + = link_to pj.content_url, { target: :blank } do + %span.filename= display_pj_filename(pj) + %span + ajoutée le #{pj.created_at.localtime.strftime('%d/%m %H:%M')} + - else + %td Pièce non fournie