Fixed #53 - Cancel button does not work
parent
a48d2175ba
commit
efb38d5825
|
|
@ -1,24 +1,18 @@
|
||||||
if (typeof(django) !== 'undefined' && typeof(django.jQuery) !== 'undefined')
|
if (typeof(django) !== 'undefined' && typeof(django.jQuery) !== 'undefined') {
|
||||||
{
|
|
||||||
(function($) {
|
(function($) {
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
$('.cancel-link').click(function(e) {
|
$('.cancel-link').click(function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var parentWindow = window.parent;
|
var parentWindow = window.parent;
|
||||||
if (parentWindow && typeof(parentWindow.dismissRelatedObjectModal) === 'function') {
|
if (parentWindow && typeof(parentWindow.dismissRelatedObjectModal) === 'function' && parentWindow !== window) {
|
||||||
parentWindow.dismissRelatedObjectModal();
|
parentWindow.dismissRelatedObjectModal();
|
||||||
} else {
|
} else {
|
||||||
// fallback to default behavior
|
// fallback to default behavior
|
||||||
history.back();
|
window.history.back();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
})(django.jQuery);
|
})(django.jQuery);
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue