1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-19 13:54:25 +01:00

improved numerous notifications display

This commit is contained in:
Sylvain 2016-12-19 17:08:11 +01:00
parent 7926d7a04a
commit 9bfaaaccd9
5 changed files with 22 additions and 2 deletions

View File

@ -1,5 +1,9 @@
# Changelog Fab Manager
## next release
- Mask new notifications alerts when more than 3
- Fix a bug: display more than 15 unread notifications (number on the bell icon & full list)
## v2.4.8 2016 December 15
- Added asterisks on mandatory fields in member's form

View File

@ -260,7 +260,9 @@ Application.Controllers.controller 'ApplicationController', ["$rootScope", "$sco
getNotifications = ->
$rootScope.toCheckNotifications = true
unless $rootScope.checkNotificationsIsInit or !$rootScope.currentUser
$scope.notifications = Notification.query {is_read: false}
setTimeout ->
$scope.notifications = Notification.query {is_read: false}
, 2000
$scope.$watch 'notifications', (newValue, oldValue) ->
diff = []
angular.forEach newValue, (value) ->
@ -273,6 +275,9 @@ Application.Controllers.controller 'ApplicationController', ["$rootScope", "$sco
unless find
diff.push(value)
remain = 3
if diff.length >= remain
diff.splice(remain, (diff.length - remain), {message: {description: _t('and_NUMBER_other_notifications', {NUMBER: diff.length - remain})}})
angular.forEach diff, (notification, key) ->
growl.info(notification.message.description)

View File

@ -4,7 +4,11 @@ class API::NotificationsController < API::ApiController
def index
if params[:is_read]
@notifications = current_user.notifications.where(is_read: params[:is_read] == 'true').page(params[:page]).per(15).order('created_at DESC')
if params[:is_read] == 'true'
@notifications = current_user.notifications.where(is_read: true).page(params[:page]).per(15).order('created_at DESC')
else
@notifications = current_user.notifications.where(is_read: false).order('created_at DESC')
end
else
@notifications = current_user.notifications.order('created_at DESC')
end

View File

@ -103,6 +103,9 @@ en:
# Fab-manager's version
version: "Version:"
# Notifications
and_NUMBER_other_notifications: "and {{NUMBER}} other notifications..." # angular interpolation
about:
# about page
read_the_fablab_policy: "Read the FabLab policy"

View File

@ -102,6 +102,10 @@ fr:
# Fab-manager's version
version: "Version :"
# Notifications
and_NUMBER_other_notifications: "et {{NUMBER}} autres notifications ..." # angular interpolation
about:
# page à propos
read_the_fablab_policy: "Consulter les règles d'utilisation du Fab Lab"