Notification: instruction -> avis

This commit is contained in:
Simon Lehericey 2017-09-27 11:55:56 +02:00
parent f5a227fa92
commit 04d1e0f0e8
4 changed files with 7 additions and 7 deletions

View file

@ -20,7 +20,7 @@ module NewGestionnaire
def avis
@dossier = dossier
dossier.notifications.instruction.mark_as_read
dossier.notifications.avis.mark_as_read
end
def follow

View file

@ -96,7 +96,7 @@ class Dossier < ActiveRecord::Base
{
demande: unread_notifications.select(&:demande?).present?,
instruction: unread_notifications.select(&:instruction?).present?,
avis: unread_notifications.select(&:avis?).present?,
messagerie: unread_notifications.select(&:messagerie?).present?
}
end

View file

@ -9,14 +9,14 @@ class Notification < ActiveRecord::Base
}
DEMANDE = %w(cerfa piece_justificative champs submitted)
INSTRUCTION = %w(avis)
AVIS = %w(avis)
MESSAGERIE = %w(commentaire)
belongs_to :dossier
scope :unread, -> { where(already_read: false) }
scope :demande, -> { where(type_notif: DEMANDE) }
scope :instruction, -> { where(type_notif: INSTRUCTION) }
scope :avis, -> { where(type_notif: AVIS) }
scope :messagerie, -> { where(type_notif: MESSAGERIE) }
scope :mark_as_read, -> { update_all(already_read: true) }
@ -24,8 +24,8 @@ class Notification < ActiveRecord::Base
Notification::DEMANDE.include?(type_notif)
end
def instruction?
Notification::INSTRUCTION.include?(type_notif)
def avis?
Notification::AVIS.include?(type_notif)
end
def messagerie?

View file

@ -18,7 +18,7 @@
%li{ class: current_page?(annotations_privees_dossier_path(dossier.procedure, dossier)) ? 'active' : nil }
= link_to "Annotations Privées", annotations_privees_dossier_path(dossier.procedure, dossier)
%li{ class: current_page?(avis_dossier_path(dossier.procedure, dossier)) ? 'active' : nil }
- if notifications_summary[:instruction]
- if notifications_summary[:avis]
%span.notifications{ 'aria-label': 'notifications' }
= link_to "Avis Externes", avis_dossier_path(dossier.procedure, dossier)
%li{ class: current_page?(messagerie_dossier_path(dossier.procedure, dossier)) ? 'active' : nil }