Notification: use new notification system

This commit is contained in:
Simon Lehericey 2017-10-23 10:29:46 +02:00 committed by Mathieu Magnin
parent 155a5f7826
commit f7d7cec5ae
4 changed files with 7 additions and 5 deletions

View file

@ -12,7 +12,7 @@
= render partial: "new_gestionnaire/procedures/dossier_actions", locals: { procedure: dossier.procedure, dossier: dossier, dossier_is_followed: current_gestionnaire&.follow?(dossier) } = render partial: "new_gestionnaire/procedures/dossier_actions", locals: { procedure: dossier.procedure, dossier: dossier, dossier_is_followed: current_gestionnaire&.follow?(dossier) }
= render partial: "state_button", locals: { dossier: dossier } = render partial: "state_button", locals: { dossier: dossier }
%ul.tabs %ul.tabs
- notifications_summary = dossier.notifications_summary - notifications_summary = current_gestionnaire.notifications_for_dossier(dossier)
%li{ class: current_page?(dossier_path(dossier.procedure, dossier)) ? 'active' : nil } %li{ class: current_page?(dossier_path(dossier.procedure, dossier)) ? 'active' : nil }
- if notifications_summary[:demande] - if notifications_summary[:demande]
%span.notifications{ 'aria-label': 'notifications' } %span.notifications{ 'aria-label': 'notifications' }

View file

@ -25,7 +25,7 @@
%li %li
%object %object
= link_to(procedure_path(p, statut: 'suivis')) do = link_to(procedure_path(p, statut: 'suivis')) do
- if @notifications_count_per_procedure[p.id].present? - if current_gestionnaire.notifications_per_procedure[p.id].present?
%span.notifications{ 'aria-label': "notifications" } %span.notifications{ 'aria-label': "notifications" }
- followed_count = @followed_dossiers_count_per_procedure[p.id] || 0 - followed_count = @followed_dossiers_count_per_procedure[p.id] || 0
.stats-number .stats-number

View file

@ -15,7 +15,7 @@
%span.badge= @a_suivre_dossiers.count %span.badge= @a_suivre_dossiers.count
%li{ class: (@statut == 'suivis') ? 'active' : nil }> %li{ class: (@statut == 'suivis') ? 'active' : nil }>
- if @followed_dossiers.with_unread_notifications.present? - if current_gestionnaire.notifications_for_procedure(@procedure).present?
%span.notifications{ 'aria-label': 'notifications' } %span.notifications{ 'aria-label': 'notifications' }
= link_to(procedure_path(@procedure, statut: 'suivis')) do = link_to(procedure_path(@procedure, statut: 'suivis')) do
= t('pluralize.followed', count: @followed_dossiers.count) = t('pluralize.followed', count: @followed_dossiers.count)
@ -27,7 +27,7 @@
%span.badge= @termines_dossiers.count %span.badge= @termines_dossiers.count
%li{ class: (@statut == 'tous') ? 'active' : nil }> %li{ class: (@statut == 'tous') ? 'active' : nil }>
- if @followed_dossiers.with_unread_notifications.present? - if current_gestionnaire.notifications_for_procedure(@procedure).present?
%span.notifications{ 'aria-label': 'notifications' } %span.notifications{ 'aria-label': 'notifications' }
= link_to(procedure_path(@procedure, statut: 'tous')) do = link_to(procedure_path(@procedure, statut: 'tous')) do
tous les dossiers tous les dossiers
@ -99,7 +99,7 @@
%td.number-col %td.number-col
= link_to(dossier_path(@procedure, dossier), class: 'cell-link') do = link_to(dossier_path(@procedure, dossier), class: 'cell-link') do
.icon.folder .icon.folder
- if @followed_dossiers.with_unread_notifications.include?(dossier) - if current_gestionnaire.notifications_for_procedure(@procedure).include?(dossier.id)
%span.notifications{ 'aria-label': 'notifications' } %span.notifications{ 'aria-label': 'notifications' }
= dossier.id = dossier.id

View file

@ -1,10 +1,12 @@
describe 'new_gestionnaire/dossiers/show.html.haml', type: :view do describe 'new_gestionnaire/dossiers/show.html.haml', type: :view do
let(:current_gestionnaire) { create(:gestionnaire) }
let(:individual) { nil } let(:individual) { nil }
let(:entreprise) { nil } let(:entreprise) { nil }
let(:dossier) { create(:dossier, :initiated, entreprise: entreprise, individual: individual) } let(:dossier) { create(:dossier, :initiated, entreprise: entreprise, individual: individual) }
before do before do
assign(:dossier, dossier) assign(:dossier, dossier)
view.stub(:current_gestionnaire).and_return(current_gestionnaire)
render render
end end