Fixed remove entry popup.
This commit is contained in:
@ -307,11 +307,23 @@ var EntryController = function($scope, $http, $rootScope, $filter) {
|
||||
});
|
||||
};
|
||||
|
||||
$scope.removeEntry = function(entry) {
|
||||
$scope.removingEntry = entry;
|
||||
$("#remove_entry").modal({
|
||||
keyboard: false,
|
||||
});
|
||||
};
|
||||
|
||||
$scope.hideRemoveEntryPopup = function() {
|
||||
$scope.removingEntry = null;
|
||||
$("#remove_entry").modal("hide");
|
||||
};
|
||||
|
||||
// Removes an entry.
|
||||
$scope.removeEntry = function(entry, modalScope) {
|
||||
$scope.confirmRemoveEntry = function() {
|
||||
// Cancel current editing.
|
||||
if (!$scope.isNew(entry)) {
|
||||
$http.delete("/api/entries/" + entry.id).success(function (result) {
|
||||
if ($scope.removingEntry) {
|
||||
$http.delete("/api/entries/" + $scope.removingEntry.id).success(function (result) {
|
||||
$.pnotify({
|
||||
type: "success",
|
||||
title: "Delete",
|
||||
@ -319,9 +331,9 @@ var EntryController = function($scope, $http, $rootScope, $filter) {
|
||||
});
|
||||
|
||||
// Send the "entry removed" event.
|
||||
$scope.$emit("entryRemovedEvent", entry);
|
||||
$scope.$emit("entryRemovedEvent", $scope.removingEntry);
|
||||
|
||||
$scope.closeModal(modalScope);
|
||||
$scope.hideRemoveEntryPopup();
|
||||
}).error(function (data) {
|
||||
$.pnotify({
|
||||
type: "error",
|
||||
@ -329,7 +341,7 @@ var EntryController = function($scope, $http, $rootScope, $filter) {
|
||||
text: data
|
||||
});
|
||||
|
||||
$scope.closeModal(modalScope);
|
||||
$scope.hideRemoveEntryPopup();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user