From b70b070d5c5a9ff86e69dd21dbbc597886893918 Mon Sep 17 00:00:00 2001 From: Alexis Lahouze Date: Wed, 27 Jan 2016 21:33:23 +0100 Subject: [PATCH] Use angular-ui-notification instead of angular-pnotify. --- accountant/frontend/static/js/accounts.js | 16 ++++------------ accountant/frontend/static/js/app.js | 2 +- accountant/frontend/static/js/operations.js | 16 ++++------------ accountant/frontend/static/js/scheduler.js | 16 ++++------------ 4 files changed, 13 insertions(+), 37 deletions(-) diff --git a/accountant/frontend/static/js/accounts.js b/accountant/frontend/static/js/accounts.js index e61ba8c..c103df1 100644 --- a/accountant/frontend/static/js/accounts.js +++ b/accountant/frontend/static/js/accounts.js @@ -36,8 +36,8 @@ accountantApp .controller( "AccountController", [ - "$scope", "Account", "notify", - function($scope, Account, notify) { + "$scope", "Account", "Notification", + function($scope, Account, Notification) { /* * Return the class for an account current value compared to authorized @@ -122,11 +122,7 @@ accountantApp return 0; }); - notify({ - message: "Account #" + data.id + " saved.", - classes: "alert-success", - position: "right" - }); + Notification.success("Account #" + data.id + " saved."); return data; }); @@ -143,11 +139,7 @@ accountantApp function(result) { if(result) { account.$delete().then(function() { - notify({ - message: "Account #" + id + " deleted.", - classes: "alert-success", - position: "right" - }); + Notification.success("Account #" + id + " deleted."); // Remove account from array. $scope.accounts.splice($index, 1); diff --git a/accountant/frontend/static/js/app.js b/accountant/frontend/static/js/app.js index 04d99ee..cbab7a7 100644 --- a/accountant/frontend/static/js/app.js +++ b/accountant/frontend/static/js/app.js @@ -19,7 +19,7 @@ var accountantApp = angular.module("accountantApp", [ "mgcrea.ngStrap", "highcharts-ng", "http-auth-interceptor", - "cgNotify", + 'ui-notification', "Storage.Service", "xeditable" ]) diff --git a/accountant/frontend/static/js/operations.js b/accountant/frontend/static/js/operations.js index 3efa50c..a787063 100644 --- a/accountant/frontend/static/js/operations.js +++ b/accountant/frontend/static/js/operations.js @@ -333,8 +333,8 @@ accountantApp */ .controller( "OperationController", [ - "$scope", "$rootScope", "$routeParams", "notify", "Account", "Operation", - function($scope, $rootScope, $routeParams, notify, Account, Operation) { + "$scope", "$rootScope", "$routeParams", "Notification", "Account", "Operation", + function($scope, $rootScope, $routeParams, Notification, Account, Operation) { // List of operations. $scope.operations = []; @@ -409,11 +409,7 @@ accountantApp operation.confirmed = true; return operation.$save().then(function(data) { - notify({ - message: "Operation #" + data.id + " saved.", - classes: "alert-success", - position: "right" - }); + Notification.success("Operation #" + data.id + " saved."); $scope.$emit("operationSavedEvent", data); }); @@ -430,11 +426,7 @@ accountantApp function(result) { if(result) { operation.$delete().then(function() { - notify({ - message: "Operation #" + id + " deleted.", - classes: "alert-success", - position: "right" - }); + Notification.success("Operation #" + id + " deleted."); // Remove operation from array. $scope.operation.splice($index, 1); diff --git a/accountant/frontend/static/js/scheduler.js b/accountant/frontend/static/js/scheduler.js index a2fbe2c..8cb312d 100644 --- a/accountant/frontend/static/js/scheduler.js +++ b/accountant/frontend/static/js/scheduler.js @@ -26,8 +26,8 @@ accountantApp .controller( "SchedulerController", [ - "$scope", "$rootScope", "$routeParams", "notify", "ScheduledOperation", - function($scope, $rootScope, $routeParams, notify, ScheduledOperation) { + "$scope", "$rootScope", "$routeParams", "Notification", "ScheduledOperation", + function($scope, $rootScope, $routeParams, Notification, ScheduledOperation) { // Operation store. $scope.operations = []; @@ -66,11 +66,7 @@ accountantApp } return operation.$save().then(function(data) { - notify({ - message: "Operation #" + data.id + " saved.", - classes: "alert-success", - position: "right" - }); + Notification.success("Operation #" + data.id + " saved."); }); }; @@ -96,11 +92,7 @@ accountantApp function(result) { if(result) { operation.$delete().then(function() { - notify({ - message: "Operation #" + id + " deleted.", - classes: "alert-success", - position: "right" - }); + Notification.success("Operation #" + id + " deleted."); // Remove account from array. $scope.operations.splice($index, 1);