diff options
author | Evan McMahon <emcmahonzx@gmail.com> | 2018-03-29 10:30:55 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-29 10:30:55 +0300 |
commit | d39efe6aef436049037f5788ac248bb3f8de8722 (patch) | |
tree | b83a7fe93dd1ef74cb9fc630b9a4e33776a3c84e | |
parent | 8c0d012dfeaef1df3646a5042c62fea43f7e54ee (diff) | |
parent | 40e961e6fe36f7ca2061f5fd93bbf0b3c2771c42 (diff) |
Merge pull request #384 from tdtgit/delete-link-confirm
Users should be warned before they delete users or links
-rw-r--r-- | public/js/AdminCtrl.js | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/public/js/AdminCtrl.js b/public/js/AdminCtrl.js index 2fbbd2c..ddfd928 100644 --- a/public/js/AdminCtrl.js +++ b/public/js/AdminCtrl.js @@ -264,14 +264,16 @@ polr.controller('AdminCtrl', function($scope, $compile, $timeout) { // Delete user $scope.deleteUser = function($event, user_id) { - var el = $($event.target); - - apiCall('admin/delete_user', { - 'user_id': user_id, - }, function(new_status) { - toastr.success('User successfully deleted.', 'Success'); - $scope.reloadUserTables(); - }); + if(confirm("Are you sure to delete this user?")){ + var el = $($event.target); + + apiCall('admin/delete_user', { + 'user_id': user_id, + }, function(new_status) { + toastr.success('User successfully deleted.', 'Success'); + $scope.reloadUserTables(); + }); + } }; $scope.changeUserRole = function(role, user_id) { @@ -305,14 +307,16 @@ polr.controller('AdminCtrl', function($scope, $compile, $timeout) { // Delete link $scope.deleteLink = function($event, link_ending) { - var el = $($event.target); - - apiCall('admin/delete_link', { - 'link_ending': link_ending, - }, function(new_status) { - toastr.success('Link successfully deleted.', 'Success'); - $scope.reloadLinkTables(); - }); + if(confirm("Are you sure to delete this link?")){ + var el = $($event.target); + + apiCall('admin/delete_link', { + 'link_ending': link_ending, + }, function(new_status) { + toastr.success('Link successfully deleted.', 'Success'); + $scope.reloadLinkTables(); + }); + } }; // Disable and enable links |