Fixed remove entry popup.
This commit is contained in:
parent
5dd9543b38
commit
898357d160
@ -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.
|
// Removes an entry.
|
||||||
$scope.removeEntry = function(entry, modalScope) {
|
$scope.confirmRemoveEntry = function() {
|
||||||
// Cancel current editing.
|
// Cancel current editing.
|
||||||
if (!$scope.isNew(entry)) {
|
if ($scope.removingEntry) {
|
||||||
$http.delete("/api/entries/" + entry.id).success(function (result) {
|
$http.delete("/api/entries/" + $scope.removingEntry.id).success(function (result) {
|
||||||
$.pnotify({
|
$.pnotify({
|
||||||
type: "success",
|
type: "success",
|
||||||
title: "Delete",
|
title: "Delete",
|
||||||
@ -319,9 +331,9 @@ var EntryController = function($scope, $http, $rootScope, $filter) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Send the "entry removed" event.
|
// Send the "entry removed" event.
|
||||||
$scope.$emit("entryRemovedEvent", entry);
|
$scope.$emit("entryRemovedEvent", $scope.removingEntry);
|
||||||
|
|
||||||
$scope.closeModal(modalScope);
|
$scope.hideRemoveEntryPopup();
|
||||||
}).error(function (data) {
|
}).error(function (data) {
|
||||||
$.pnotify({
|
$.pnotify({
|
||||||
type: "error",
|
type: "error",
|
||||||
@ -329,7 +341,7 @@ var EntryController = function($scope, $http, $rootScope, $filter) {
|
|||||||
text: data
|
text: data
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.closeModal(modalScope);
|
$scope.hideRemoveEntryPopup();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -114,7 +114,7 @@
|
|||||||
<span class="fa fa-pencil-square-o"></span>
|
<span class="fa fa-pencil-square-o"></span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button class="btn btn-xs btn-default" data-toggle="modal" data-target="#remove_entry" title="remove">
|
<button class="btn btn-xs btn-default" ng-click="removeEntry(entry)" title="remove">
|
||||||
<span class="fa fa-trash-o"></span>
|
<span class="fa fa-trash-o"></span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
@ -19,19 +19,19 @@
|
|||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<!-- Dialog header with title -->
|
<!-- Dialog header with title -->
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<button class="close" ng-click="dismiss()" aria-hidden="true">×</button>
|
<button class="close" ng-click="hideRemoveEntryPopup()" aria-hidden="true">×</button>
|
||||||
<h4 class="modal-title" id="remove_entry_header">Supprimer l'entrée [[entry.label]]</h4>
|
<h4 class="modal-title" id="remove_entry_header">Supprimer l'entrée #[[removingEntry.id]]</h4>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Dialog body -->
|
<!-- Dialog body -->
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<p>Confirmez-vous la suppression de cette entrée ?</p>
|
<p>Confirmez-vous la suppression de l'entrée « [[ removingEntry.label ]] » ?</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Dialog footer with buttons -->
|
<!-- Dialog footer with buttons -->
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button href="#" class="btn btn-primary" ng-click="dismiss()">Non</button>
|
<button href="#" class="btn btn-primary" ng-click="hideRemoveEntryPopup()">Non</button>
|
||||||
<button href="#" class="btn btn-default" ng-click="removeEntry(entry, this)">Oui</button>
|
<button href="#" class="btn btn-default" ng-click="confirmRemoveEntry()">Oui</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user