Adding facade dossiers_unread_notifications (last)
This commit is contained in:
parent
9ed1fc5125
commit
442dd5b7b6
3 changed files with 19 additions and 6 deletions
|
@ -148,6 +148,12 @@
|
|||
font-size: 12px;
|
||||
text-align: left;
|
||||
}
|
||||
.dossier-index, .updated-at-index {
|
||||
display: inline-block;
|
||||
color: #FFFFFF;
|
||||
font-size: 15px;
|
||||
text-align: left;
|
||||
}
|
||||
.type-notif {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
|
|
@ -38,6 +38,14 @@ class DossiersListFacades
|
|||
current_devise_profil.notifications
|
||||
end
|
||||
|
||||
def last_unread_notifications
|
||||
last_unread_notifications = []
|
||||
dossiers_with_unread_notifications.each do |dossier|
|
||||
last_unread_notifications << dossier.notifications.last
|
||||
end
|
||||
return last_unread_notifications
|
||||
end
|
||||
|
||||
def dossiers_with_unread_notifications
|
||||
(unread_notifications.inject([]) { |acc, notif| acc.push(notif.dossier) }).uniq
|
||||
end
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
= @facade_data_view.total_new_dossier
|
||||
NOUVEAUX DOSSIERS
|
||||
%div.nouvelles-notifications
|
||||
- new_notifications = @facade_data_view.unread_notifications.count
|
||||
- new_notifications = @facade_data_view.dossiers_with_unread_notifications.count
|
||||
- if new_notifications > 1
|
||||
= "#{new_notifications} DOSSIERS MODIFIÉS"
|
||||
- elsif new_notifications == 1
|
||||
|
@ -35,12 +35,11 @@
|
|||
.badge.progress-bar-warning{title: 'Notifications'}
|
||||
= procedure[:unread_notifications]
|
||||
#notifications_list.hidden
|
||||
- if @facade_data_view.unread_notifications.empty?
|
||||
- if @facade_data_view.dossiers_with_unread_notifications.empty?
|
||||
.no-notification= "Aucune notification pour le moment."
|
||||
- else
|
||||
- @facade_data_view.unread_notifications.each do |notification|
|
||||
- @facade_data_view.last_unread_notifications.each do |notification|
|
||||
= link_to backoffice_dossier_path(notification.dossier.id) do
|
||||
.notification
|
||||
.dossier= notification.decorate.index_display[:dossier]
|
||||
.updated-at= notification.decorate.index_display[:date]
|
||||
= render partial: "layouts/left_panels/type_notif_fa", locals: {notification: notification}
|
||||
.dossier-index= notification.decorate.index_display[:dossier]
|
||||
.updated-at-index= notification.decorate.index_display[:date]
|
||||
|
|
Loading…
Reference in a new issue