Merge pull request #4118 from Keirua/feat/message-zip-50mb+
Ajout d'un message lorsque le dossier fait plus de 50Mo
This commit is contained in:
commit
bdd716b2db
2 changed files with 8 additions and 3 deletions
|
@ -15,6 +15,8 @@ class Dossier < ApplicationRecord
|
||||||
INSTRUCTION_COMMENCEE = TERMINE + [states.fetch(:en_instruction)]
|
INSTRUCTION_COMMENCEE = TERMINE + [states.fetch(:en_instruction)]
|
||||||
SOUMIS = EN_CONSTRUCTION_OU_INSTRUCTION + TERMINE
|
SOUMIS = EN_CONSTRUCTION_OU_INSTRUCTION + TERMINE
|
||||||
|
|
||||||
|
TAILLE_MAX_ZIP = 50.megabytes
|
||||||
|
|
||||||
has_one :etablissement, dependent: :destroy
|
has_one :etablissement, dependent: :destroy
|
||||||
has_one :individual, dependent: :destroy
|
has_one :individual, dependent: :destroy
|
||||||
has_one :attestation, dependent: :destroy
|
has_one :attestation, dependent: :destroy
|
||||||
|
@ -461,7 +463,7 @@ class Dossier < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def attachments_downloadable?
|
def attachments_downloadable?
|
||||||
!PiecesJustificativesService.liste_pieces_justificatives(self).empty? && PiecesJustificativesService.pieces_justificatives_total_size(self) < 50.megabytes
|
!PiecesJustificativesService.liste_pieces_justificatives(self).empty? && PiecesJustificativesService.pieces_justificatives_total_size(self) < Dossier::TAILLE_MAX_ZIP
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -18,13 +18,16 @@
|
||||||
= link_to "Tout le dossier", print_gestionnaire_dossier_path(dossier.procedure, dossier), target: "_blank", rel: "noopener", class: "menu-item menu-link"
|
= link_to "Tout le dossier", print_gestionnaire_dossier_path(dossier.procedure, dossier), target: "_blank", rel: "noopener", class: "menu-item menu-link"
|
||||||
%li
|
%li
|
||||||
= link_to "Uniquement cet onglet", "#", onclick: "window.print()", class: "menu-item menu-link"
|
= link_to "Uniquement cet onglet", "#", onclick: "window.print()", class: "menu-item menu-link"
|
||||||
- if Flipflop.download_as_zip_enabled? && dossier.attachments_downloadable?
|
- if Flipflop.download_as_zip_enabled? && !PiecesJustificativesService.liste_pieces_justificatives(dossier).empty?
|
||||||
%span.dropdown.print-menu-opener
|
%span.dropdown.print-menu-opener
|
||||||
%button.button.dropdown-button.icon-only
|
%button.button.dropdown-button.icon-only
|
||||||
%span.icon.attachment
|
%span.icon.attachment
|
||||||
%ul.print-menu.dropdown-content
|
%ul.print-menu.dropdown-content
|
||||||
%li
|
%li
|
||||||
|
- if PiecesJustificativesService.pieces_justificatives_total_size(dossier) < Dossier::TAILLE_MAX_ZIP
|
||||||
= link_to "Télécharger toutes les pièces jointes", telecharger_pjs_gestionnaire_dossier_path(dossier.procedure, dossier), target: "_blank", rel: "noopener", class: "menu-item menu-link"
|
= link_to "Télécharger toutes les pièces jointes", telecharger_pjs_gestionnaire_dossier_path(dossier.procedure, dossier), target: "_blank", rel: "noopener", class: "menu-item menu-link"
|
||||||
|
- else
|
||||||
|
%p.menu-item Le téléchargement des pièces jointes est désactivé pour les dossiers de plus de #{number_to_human_size Dossier::TAILLE_MAX_ZIP}.
|
||||||
|
|
||||||
|
|
||||||
= render partial: "gestionnaires/procedures/dossier_actions", locals: { procedure: dossier.procedure, dossier: dossier, dossier_is_followed: current_gestionnaire&.follow?(dossier) }
|
= render partial: "gestionnaires/procedures/dossier_actions", locals: { procedure: dossier.procedure, dossier: dossier, dossier_is_followed: current_gestionnaire&.follow?(dossier) }
|
||||||
|
|
Loading…
Reference in a new issue