download a dossier as zip with all attachments

This commit is contained in:
clemkeirua 2019-07-01 15:55:37 +02:00
parent 5a70ae7a8f
commit 25f81f1d3c
14 changed files with 194 additions and 2 deletions

View file

@ -5,6 +5,9 @@ module Gestionnaires
include CreateAvisConcern
include DossierHelper
include ActionController::Streaming
include Zipline
after_action :mark_demande_as_read, only: :show
after_action :mark_messagerie_as_read, only: [:messagerie, :create_commentaire]
after_action :mark_avis_as_read, only: [:avis, :create_avis]
@ -172,6 +175,14 @@ module Gestionnaires
render layout: "print"
end
def telecharger_pjs
return head(:forbidden) if !Flipflop.download_as_zip_enabled? || !dossier.attachments_downloadable?
files = ActiveStorage::DownloadableFile.create_list_from_dossier(dossier)
zipline(files, "dossier-#{dossier.id}.zip")
end
private
def dossier