refactor(gallery): use gallery component in gallery demande

This commit is contained in:
Eric Leroy-Terquem 2024-09-09 10:33:31 +02:00
parent 664ef63e74
commit 3560d73b58
No known key found for this signature in database
GPG key ID: 53D8FAECEF207605
4 changed files with 23 additions and 27 deletions

View file

@ -4,14 +4,17 @@ class Attachment::GalleryItemComponent < ApplicationComponent
include GalleryHelper
attr_reader :attachment
def initialize(attachment:)
def initialize(attachment:, gallery_demande: false)
@attachment = attachment
@gallery_demande = gallery_demande
end
def blob
attachment.blob
end
def gallery_demande? = @gallery_demande
def libelle
attachment.record.class.in?([Champs::PieceJustificativeChamp, Champs::TitreIdentiteChamp]) ? attachment.record.libelle : 'Pièce jointe au message'
end