Display virus scan status with pj champs

This commit is contained in:
Mathieu Magnin 2018-05-11 14:59:20 +02:00
parent cd4615b10d
commit 6289a719ef
4 changed files with 21 additions and 7 deletions

View file

@ -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

View file

@ -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"

View file

@ -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)

View file

@ -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,