parent
5ac7369bf5
commit
9cb1366d36
3 changed files with 11 additions and 7 deletions
|
@ -8,9 +8,10 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="right-controls">
|
||||
<a href="javascript:void(0)" ng-if="canDismiss(notification)" ng-click="dismissNotification(notification)">
|
||||
<a href="javascript:void(0)" ng-if="canDismiss(notification)" ng-click="dismissNotification(notification)" ng-show="!dismissing">
|
||||
Dismiss Notification
|
||||
</a>
|
||||
<span class="cor-loader-inline" ng-show="dismissing"></span>
|
||||
<button class="btn" ng-class="'btn-' + action.kind" ng-repeat="action in getActions(notification)" ng-click="action.handler(notification)">
|
||||
{{ action.title }}
|
||||
</button>
|
||||
|
|
|
@ -13,6 +13,8 @@ angular.module('quay').directive('notificationView', function () {
|
|||
'parent': '=parent'
|
||||
},
|
||||
controller: function($scope, $element, $window, $location, UserService, NotificationService, ApiService) {
|
||||
$scope.dismissing = false;
|
||||
|
||||
var stringStartsWith = function (str, prefix) {
|
||||
return str.slice(0, prefix.length) == prefix;
|
||||
};
|
||||
|
@ -51,6 +53,7 @@ angular.module('quay').directive('notificationView', function () {
|
|||
};
|
||||
|
||||
$scope.dismissNotification = function(notification) {
|
||||
$scope.dismissing = true;
|
||||
NotificationService.dismissNotification(notification);
|
||||
};
|
||||
|
||||
|
|
|
@ -140,14 +140,14 @@ function($rootScope, $interval, UserService, ApiService, StringBuilderService, P
|
|||
'uuid': notification.id
|
||||
};
|
||||
|
||||
ApiService.updateUserNotification(notification, params, function() {
|
||||
ApiService.updateUserNotification(notification, params).then(function(resp) {
|
||||
var index = $.inArray(notification, notificationService.notifications);
|
||||
if (index >= 0) {
|
||||
notificationService.notifications.splice(index, 1);
|
||||
}
|
||||
|
||||
notificationService.update();
|
||||
}, ApiService.errorDisplay('Could not update notification'));
|
||||
|
||||
var index = $.inArray(notification, notificationService.notifications);
|
||||
if (index >= 0) {
|
||||
notificationService.notifications.splice(index, 1);
|
||||
}
|
||||
};
|
||||
|
||||
notificationService.getActions = function(notification) {
|
||||
|
|
Reference in a new issue