Use of pines notify instead of custom function to notify success and/or errors.
This commit is contained in:
@ -14,12 +14,6 @@
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with Accountant. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
// Util function to show a message in message placeholder.
|
||||
function message(alertType, title, message) {
|
||||
$(".alert").alert('close');
|
||||
$("#message-placeholder").append('<div class="alert alert-' + alertType + '"><button type="button" class="close" data-dismiss="alert">×</button><h4>' + title + '</h4>' + message + '</div>');
|
||||
}
|
||||
|
||||
var SchedulerController = function($scope, $http, $rootScope, $filter) {
|
||||
// Operations store and selection
|
||||
$scope.operations = [];
|
||||
@ -109,7 +103,12 @@ var SchedulerController = function($scope, $http, $rootScope, $filter) {
|
||||
}
|
||||
|
||||
$http.put(url, angular.toJson(operation)).success(function(data) {
|
||||
message("success", "Save", data);
|
||||
$.pnotify({
|
||||
type: "success",
|
||||
title: "Save",
|
||||
text: data
|
||||
});
|
||||
|
||||
$scope.$emit("operationSavedEvent", operation);
|
||||
});
|
||||
};
|
||||
@ -163,14 +162,22 @@ var SchedulerController = function($scope, $http, $rootScope, $filter) {
|
||||
// Cancel current editing.
|
||||
if (!$scope.isNew(operation)) {
|
||||
$http.delete("/api/scheduled_operations/" + operation.id).success(function (result) {
|
||||
message("success", "Delete", result);
|
||||
$.pnotify({
|
||||
type: "success",
|
||||
title: "Delete",
|
||||
text: result
|
||||
});
|
||||
|
||||
// Send the "entry removed" event.
|
||||
$scope.$emit("operationRemovedEvent", operation);
|
||||
|
||||
$scope.closeModal(modalScope);
|
||||
}).error(function (data) {
|
||||
message("error", "Delete", data);
|
||||
$.pnotify({
|
||||
type: "error",
|
||||
title: "Delete",
|
||||
text: data
|
||||
});
|
||||
|
||||
$scope.closeModal(modalScope);
|
||||
});
|
||||
|
Reference in New Issue
Block a user