diff options
author | Einar Egilsson <einar@einaregilsson.com> | 2015-09-09 14:53:22 +0000 |
---|---|---|
committer | Einar Egilsson <einar@einaregilsson.com> | 2015-09-09 14:53:22 +0000 |
commit | 8a77401f48360fe0d5501d4fd6b4cc194279d4f0 (patch) | |
tree | 6c6069b54de898c72a2281caa9702039df8a2bfb /js/controllers/deleteredirect.js | |
parent | a7506a34544f4df3ba65a854c81fadcca2eb303f (diff) |
Plenty of changes
Diffstat (limited to 'js/controllers/deleteredirect.js')
-rw-r--r-- | js/controllers/deleteredirect.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/js/controllers/deleteredirect.js b/js/controllers/deleteredirect.js new file mode 100644 index 0000000..f480339 --- /dev/null +++ b/js/controllers/deleteredirect.js @@ -0,0 +1,25 @@ +redirectorApp.controller('DeleteRedirectCtrl', ['$scope', function($s) { + + // Ok, this is pretty ugly. But I want to make this controller to control + // everything about the deleting process, so I make this available on + // the parent scope, so the RedirectListCtrl can access it. + $s.$parent.confirmDeleteRedirect = function(index) { + $s.redirect = $s.redirects[index]; + $s.deleteIndex = index; + $s.$parent.showDeleteForm = true; + }; + + $s.cancelDelete = function(index) { + delete $s.redirect; + delete $s.deletingIndex; + $s.$parent.showDeleteForm = false; + } + + $s.deleteRedirect = function() { + $s.redirects.splice($s.deletingIndex, 1); + delete $s.redirect; + delete $s.deletingIndex; + $s.$parent.showDeleteForm = false; + $s.saveChanges(); + }; +}]);
\ No newline at end of file |