diff --git a/app/controllers/new_gestionnaire/dossiers_controller.rb b/app/controllers/new_gestionnaire/dossiers_controller.rb index 85f753a1a..d4f6d172b 100644 --- a/app/controllers/new_gestionnaire/dossiers_controller.rb +++ b/app/controllers/new_gestionnaire/dossiers_controller.rb @@ -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 diff --git a/app/models/dossier.rb b/app/models/dossier.rb index 45f0c0a0f..50cc36722 100644 --- a/app/models/dossier.rb +++ b/app/models/dossier.rb @@ -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 diff --git a/app/models/notification.rb b/app/models/notification.rb index b2cd552fe..d630ad494 100644 --- a/app/models/notification.rb +++ b/app/models/notification.rb @@ -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? diff --git a/app/views/new_gestionnaire/dossiers/_header.html.haml b/app/views/new_gestionnaire/dossiers/_header.html.haml index 631ac63a4..8d8f3ebb0 100644 --- a/app/views/new_gestionnaire/dossiers/_header.html.haml +++ b/app/views/new_gestionnaire/dossiers/_header.html.haml @@ -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 }