feat(core): add notification feedback with angular-ui-notification (#1532)

Added visual notification for user/article updates
angular-ui-notification config added to core client config
Notification idea from #369
This commit is contained in:
Sujeeth
2016-10-10 17:51:44 -04:00
committed by Michael Leanos
parent 5725c449c7
commit 607ed061e3
26 changed files with 122 additions and 137 deletions

View File

@@ -5,14 +5,13 @@
.module('articles.admin')
.controller('ArticlesAdminController', ArticlesAdminController);
ArticlesAdminController.$inject = ['$scope', '$state', '$window', 'articleResolve', 'Authentication'];
ArticlesAdminController.$inject = ['$scope', '$state', '$window', 'articleResolve', 'Authentication', 'Notification'];
function ArticlesAdminController($scope, $state, $window, article, Authentication) {
function ArticlesAdminController($scope, $state, $window, article, Authentication, Notification) {
var vm = this;
vm.article = article;
vm.authentication = Authentication;
vm.error = null;
vm.form = {};
vm.remove = remove;
vm.save = save;
@@ -22,6 +21,7 @@
if ($window.confirm('Are you sure you want to delete?')) {
vm.article.$remove(function() {
$state.go('admin.articles.list');
Notification.success({ message: '<i class="glyphicon glyphicon-ok"></i> Article deleted successfully!' });
});
}
}
@@ -40,10 +40,11 @@
function successCallback(res) {
$state.go('admin.articles.list'); // should we send the User to the list or the updated Article's view?
Notification.success({ message: '<i class="glyphicon glyphicon-ok"></i> Article saved successfully!' });
}
function errorCallback(res) {
vm.error = res.data.message;
Notification.error({ message: res.data.message, title: '<i class="glyphicon glyphicon-remove"></i> Article save error!' });
}
}
}