Use angular-ui-notification instead of angular-pnotify.

This commit is contained in:
Alexis Lahouze 2016-01-27 21:33:23 +01:00
parent 2fd235bb5f
commit b70b070d5c
4 changed files with 13 additions and 37 deletions

View File

@ -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);

View File

@ -19,7 +19,7 @@ var accountantApp = angular.module("accountantApp", [
"mgcrea.ngStrap",
"highcharts-ng",
"http-auth-interceptor",
"cgNotify",
'ui-notification',
"Storage.Service",
"xeditable"
])

View File

@ -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);

View File

@ -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);