Only enable notification ack button if there are any unread ones
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<div class="text-left">
|
||||
<h1>{{ 'notifications.title' | tr }}
|
||||
|
||||
<button class="btn btn-primary btn-outline pull-right" ng-click="clearAll()" ng-disabled="clearAllBusy"><i class="fa fa-circle-notch fa-spin" ng-show="clearAllBusy"></i><i class="fa fa-check" ng-hide="clearAllBusy"></i> {{ 'notifications.markAllAsRead' | tr }}</button>
|
||||
<button class="btn btn-primary btn-outline pull-right" ng-click="clearAll()" ng-disabled="!hasUnread || clearAllBusy"><i class="fa fa-circle-notch fa-spin" ng-show="clearAllBusy"></i><i class="fa fa-check" ng-hide="clearAllBusy"></i> {{ 'notifications.markAllAsRead' | tr }}</button>
|
||||
<button class="btn btn-default btn-outline pull-right" ng-click="showNextPage()" ng-disabled="busy || perPage > notifications.length">{{ 'main.pagination.next' | tr }} <i class="fa fa-angle-double-right"></i></button>
|
||||
<button class="btn btn-default btn-outline pull-right" ng-click="showPrevPage()" ng-disabled="busy || currentPage <= 1"><i class="fa fa-angle-double-left"></i> {{ 'main.pagination.prev' | tr }}</button>
|
||||
</h1>
|
||||
|
||||
@@ -9,6 +9,7 @@ angular.module('Application').controller('NotificationsController', ['$scope', '
|
||||
$scope.notifications = [];
|
||||
$scope.activeNotification = null;
|
||||
$scope.busy = true;
|
||||
$scope.hasUnread = false;
|
||||
$scope.currentPage = 1;
|
||||
$scope.perPage = 20;
|
||||
|
||||
@@ -27,6 +28,7 @@ angular.module('Application').controller('NotificationsController', ['$scope', '
|
||||
});
|
||||
|
||||
$scope.notifications = result;
|
||||
$scope.hasUnread = !!result.find(function (n) { return !n.acknowledged; });
|
||||
|
||||
$scope.busy = false;
|
||||
});
|
||||
@@ -76,6 +78,7 @@ angular.module('Application').controller('NotificationsController', ['$scope', '
|
||||
}, function (error) {
|
||||
if (error) console.error(error);
|
||||
|
||||
$scope.hasUnread = false;
|
||||
$scope.clearAllBusy = false;
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user