dossier: refactor piece_justificative export helpers

This commit is contained in:
Pierre de La Morinerie 2020-06-24 11:31:36 +00:00
parent b83a76a0a1
commit 84149218db
2 changed files with 3 additions and 2 deletions

View file

@ -701,7 +701,8 @@ class Dossier < ApplicationRecord
end
def attachments_downloadable?
!PiecesJustificativesService.liste_pieces_justificatives(self).empty? && PiecesJustificativesService.pieces_justificatives_total_size(self) < Dossier::TAILLE_MAX_ZIP
PiecesJustificativesService.liste_pieces_justificatives(self).present? \
&& PiecesJustificativesService.pieces_justificatives_total_size(self) < Dossier::TAILLE_MAX_ZIP
end
def linked_dossiers_for(instructeur)

View file

@ -12,7 +12,7 @@
%li
= link_to "Export GeoJSON", geo_data_instructeur_dossier_path(dossier.procedure, dossier), target: "_blank", rel: "noopener", class: "menu-item menu-link"
- if !PiecesJustificativesService.liste_pieces_justificatives(dossier).empty?
- if PiecesJustificativesService.liste_pieces_justificatives(dossier).present?
%span.dropdown.print-menu-opener
%button.button.dropdown-button.icon-only
%span.icon.attached