Add notification for piece justificative

This commit is contained in:
Xavier J 2016-12-26 11:42:02 +01:00
parent 6ed91073c4
commit e5768b6798
4 changed files with 20 additions and 4 deletions

View file

@ -1,10 +1,11 @@
class NotificationService
def initialize type_notif, dossier_id
def initialize type_notif, dossier_id, attribut_change=''
@type_notif = type_notif
@dossier_id = dossier_id
notification.liste.push text_for_notif
notification.liste.push text_for_notif attribut_change
notification.liste = notification.liste.uniq
self
end
@ -22,12 +23,14 @@ class NotificationService
end
end
def text_for_notif
def text_for_notif attribut=''
case @type_notif
when 'commentaire'
"#{notification.liste.size + 1} nouveau(x) commentaire(s) déposé(s)."
when 'cerfa'
"Un nouveau formulaire a été déposé."
when 'piece_justificative'
attribut
else
'Notification par défaut'
end