refactor(gallery): move methods in private
This commit is contained in:
parent
3bc232e81e
commit
4f42e00f4e
1 changed files with 18 additions and 16 deletions
|
@ -20,22 +20,6 @@ class Attachment::GalleryItemComponent < ApplicationComponent
|
|||
from_dossier? ? attachment.record.libelle : 'Pièce jointe au message'
|
||||
end
|
||||
|
||||
def from_dossier?
|
||||
attachment.record.class.in?([Champs::PieceJustificativeChamp, Champs::TitreIdentiteChamp])
|
||||
end
|
||||
|
||||
def from_messagerie?
|
||||
attachment.record.is_a?(Commentaire)
|
||||
end
|
||||
|
||||
def from_messagerie_instructeur?
|
||||
from_messagerie? && attachment.record.instructeur.present?
|
||||
end
|
||||
|
||||
def from_messagerie_usager?
|
||||
from_messagerie? && attachment.record.instructeur.nil?
|
||||
end
|
||||
|
||||
def origin
|
||||
case
|
||||
when from_dossier?
|
||||
|
@ -81,4 +65,22 @@ class Attachment::GalleryItemComponent < ApplicationComponent
|
|||
"fr-badge--new" => seen_at.present? && updated_at&.>(seen_at)
|
||||
)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def from_dossier?
|
||||
attachment.record.class.in?([Champs::PieceJustificativeChamp, Champs::TitreIdentiteChamp])
|
||||
end
|
||||
|
||||
def from_messagerie?
|
||||
attachment.record.is_a?(Commentaire)
|
||||
end
|
||||
|
||||
def from_messagerie_instructeur?
|
||||
from_messagerie? && attachment.record.instructeur.present?
|
||||
end
|
||||
|
||||
def from_messagerie_usager?
|
||||
from_messagerie? && attachment.record.instructeur.nil?
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue