diff options
Diffstat (limited to 'website/static/admin/js/cancel.js')
-rw-r--r-- | website/static/admin/js/cancel.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/website/static/admin/js/cancel.js b/website/static/admin/js/cancel.js new file mode 100644 index 0000000..04ec812 --- /dev/null +++ b/website/static/admin/js/cancel.js @@ -0,0 +1,13 @@ +(function($) { + 'use strict'; + $(function() { + $('.cancel-link').on('click', function(e) { + e.preventDefault(); + if (window.location.search.indexOf('&_popup=1') === -1) { + window.history.back(); // Go back if not a popup. + } else { + window.close(); // Otherwise, close the popup. + } + }); + }); +})(django.jQuery); |