diff --git a/app/views/dossiers/_infos_dossier.html.haml b/app/views/dossiers/_infos_dossier.html.haml index a14e46c4b..5da92d8d8 100644 --- a/app/views/dossiers/_infos_dossier.html.haml +++ b/app/views/dossiers/_infos_dossier.html.haml @@ -47,9 +47,7 @@ - else Pas de dossier associé - elsif champ.type_champ == 'piece_justificative' - - pj = champ.piece_justificative_file - %a{ href: url_for(pj), target: '_blank' } - = pj.filename.to_s + = render partial: "shared/champs/piece_justificative/pj_link", locals: { champ: champ, user_can_upload: true } - elsif champ.type_champ == 'textarea' = simple_format(champ.decorate.value) - else diff --git a/app/views/new_gestionnaire/dossiers/_champs.html.haml b/app/views/new_gestionnaire/dossiers/_champs.html.haml index a0e203778..2cdda4cb3 100644 --- a/app/views/new_gestionnaire/dossiers/_champs.html.haml +++ b/app/views/new_gestionnaire/dossiers/_champs.html.haml @@ -36,8 +36,7 @@ %td.rich-text - pj = c.piece_justificative_file - if pj.attached? - %a{ href: url_for(pj), target: '_blank' } - = pj.filename.to_s + = render partial: "shared/champs/piece_justificative/pj_link", locals: { champ: c, user_can_upload: false } - else Pièce justificative non fournie - when "textarea" diff --git a/app/views/shared/champs/piece_justificative/_pj_link.html.haml b/app/views/shared/champs/piece_justificative/_pj_link.html.haml new file mode 100644 index 000000000..d808058a4 --- /dev/null +++ b/app/views/shared/champs/piece_justificative/_pj_link.html.haml @@ -0,0 +1,18 @@ +- pj = champ.piece_justificative_file +- if champ.virus_scan.present? + - if champ.virus_scan.safe? + = link_to pj.filename.to_s, url_for(pj), target: '_blank' + - else + = pj.filename.to_s + - if champ.virus_scan.pending? + (analyse antivirus en cours + = link_to "rafraichir", request.path + ) + - elsif champ.virus_scan.infected? + - if user_can_upload + (virus détecté, merci d'envoyer un autre fichier) + - else + (virus détecté, le téléchargement de ce fichier est bloqué) +- else + = link_to pj.filename.to_s, url_for(pj), target: '_blank' + (ce fichier n'a pas été analysé par notre antivirus, téléchargez-le avec précaution) diff --git a/app/views/shared/dossiers/editable_champs/_piece_justificative.html.haml b/app/views/shared/dossiers/editable_champs/_piece_justificative.html.haml index c541ffdda..ce4b05fa3 100644 --- a/app/views/shared/dossiers/editable_champs/_piece_justificative.html.haml +++ b/app/views/shared/dossiers/editable_champs/_piece_justificative.html.haml @@ -10,8 +10,7 @@ id: "champs_#{champ.id}", direct_upload: true - else - %a{ href: url_for(pj), target: '_blank' } - = pj.filename.to_s + = render partial: "shared/champs/piece_justificative/pj_link", locals: { champ: champ, user_can_upload: true } %br Modifier : = form.file_field :piece_justificative_file,