Procedure show: add notification icon
This commit is contained in:
parent
3e93d21bf5
commit
fbd16b8c75
5 changed files with 29 additions and 11 deletions
|
@ -52,5 +52,10 @@
|
|||
color: rgba(0, 0, 0, 0.6);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.notifications {
|
||||
top: 3px;
|
||||
right: 3px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,12 @@
|
|||
|
||||
i.folder {
|
||||
margin-right: $default-spacer;
|
||||
position: relative;
|
||||
|
||||
.notifications {
|
||||
top: 0px;
|
||||
right: -10px;
|
||||
}
|
||||
}
|
||||
|
||||
.number-col,
|
||||
|
|
|
@ -33,7 +33,7 @@ module NewGestionnaire
|
|||
|
||||
@followed_dossiers = current_gestionnaire
|
||||
.followed_dossiers
|
||||
.includes(:user)
|
||||
.includes(:user, :notifications)
|
||||
.where(procedure: @procedure)
|
||||
.en_cours
|
||||
|
||||
|
|
|
@ -64,16 +64,17 @@ class Dossier < ActiveRecord::Base
|
|||
|
||||
scope :order_by_updated_at, -> (order = :desc) { order(updated_at: order) }
|
||||
|
||||
scope :all_state, -> { not_archived.state_not_brouillon.order_by_updated_at(:asc) }
|
||||
scope :nouveaux, -> { not_archived.state_nouveaux.order_by_updated_at(:asc) }
|
||||
scope :ouvert, -> { not_archived.state_ouvert.order_by_updated_at(:asc) }
|
||||
scope :waiting_for_gestionnaire, -> { not_archived.state_waiting_for_gestionnaire.order_by_updated_at(:asc) }
|
||||
scope :waiting_for_user, -> { not_archived.state_waiting_for_user.order_by_updated_at(:asc) }
|
||||
scope :a_instruire, -> { not_archived.state_a_instruire.order_by_updated_at(:asc) }
|
||||
scope :termine, -> { not_archived.state_termine.order_by_updated_at(:asc) }
|
||||
scope :downloadable, -> { state_not_brouillon.order_by_updated_at(:asc) }
|
||||
scope :en_cours, -> { not_archived.state_en_construction_ou_instruction.order_by_updated_at(:asc) }
|
||||
scope :without_followers, -> { includes(:follows).where(follows: { id: nil }) }
|
||||
scope :all_state, -> { not_archived.state_not_brouillon.order_by_updated_at(:asc) }
|
||||
scope :nouveaux, -> { not_archived.state_nouveaux.order_by_updated_at(:asc) }
|
||||
scope :ouvert, -> { not_archived.state_ouvert.order_by_updated_at(:asc) }
|
||||
scope :waiting_for_gestionnaire, -> { not_archived.state_waiting_for_gestionnaire.order_by_updated_at(:asc) }
|
||||
scope :waiting_for_user, -> { not_archived.state_waiting_for_user.order_by_updated_at(:asc) }
|
||||
scope :a_instruire, -> { not_archived.state_a_instruire.order_by_updated_at(:asc) }
|
||||
scope :termine, -> { not_archived.state_termine.order_by_updated_at(:asc) }
|
||||
scope :downloadable, -> { state_not_brouillon.order_by_updated_at(:asc) }
|
||||
scope :en_cours, -> { not_archived.state_en_construction_ou_instruction.order_by_updated_at(:asc) }
|
||||
scope :without_followers, -> { includes(:follows).where(follows: { id: nil }) }
|
||||
scope :with_unread_notifications, -> { where(notifications: { already_read: false }) }
|
||||
|
||||
accepts_nested_attributes_for :individual
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
%span.badge= @a_suivre_dossiers.count
|
||||
|
||||
%li{ class: (@statut == 'suivis') ? 'active' : nil }>
|
||||
- if @followed_dossiers.with_unread_notifications.present?
|
||||
%span.notifications{ 'aria-label': 'notifications' }
|
||||
= link_to(procedure_path(@procedure, statut: 'suivis')) do
|
||||
= t('pluralize.followed', count: @followed_dossiers.count)
|
||||
%span.badge= @followed_dossiers.count
|
||||
|
@ -23,6 +25,8 @@
|
|||
%span.badge= @termines_dossiers.count
|
||||
|
||||
%li{ class: (@statut == 'tous') ? 'active' : nil }>
|
||||
- if @followed_dossiers.with_unread_notifications.present?
|
||||
%span.notifications{ 'aria-label': 'notifications' }
|
||||
= link_to(procedure_path(@procedure, statut: 'tous')) do
|
||||
tous les dossiers
|
||||
%span.badge= @all_state_dossiers.count
|
||||
|
@ -47,6 +51,8 @@
|
|||
%td.number-col
|
||||
= link_to(dossier_path(@procedure, dossier), class: 'cell-link') do
|
||||
%i.folder
|
||||
- if @followed_dossiers.with_unread_notifications.include?(dossier)
|
||||
%span.notifications{ 'aria-label': 'notifications' }
|
||||
= dossier.id
|
||||
%td= link_to(dossier.user.email, dossier_path(@procedure, dossier), class: 'cell-link')
|
||||
%td.status-col
|
||||
|
|
Loading…
Reference in a new issue