added notification_count
This commit is contained in:
parent
43474a6c92
commit
dec91d474d
|
@ -47,6 +47,14 @@ module ApplicationHelper
|
|||
count.count
|
||||
end
|
||||
|
||||
def notification_count
|
||||
return 0 unless user_signed_in?
|
||||
count = Notification.for(current_user).where(new: true)
|
||||
return nil if count.nil?
|
||||
return nil unless count.count > 0
|
||||
count.count
|
||||
end
|
||||
|
||||
def privileged?(user)
|
||||
(current_user && (current_user == user || current_user.admin?)) ? true : false
|
||||
end
|
||||
|
|
|
@ -1 +1 @@
|
|||
= nav_entry "Notifications", "/notifications/index"
|
||||
= nav_entry "Notifications", "/notifications/index", badge: notification_count
|
|
@ -60,3 +60,4 @@
|
|||
ago
|
||||
.notification--icon
|
||||
%i.fa.fa-comments
|
||||
- Notification.for(current_user).update_all(new: false)
|
Loading…
Reference in New Issue