Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c680bb5461 | |||
| ce32a56cdf | |||
| 7137cbab08 | |||
| 3f7b1e54e9 |
@@ -1,16 +1,24 @@
|
|||||||
(function($) {
|
if (typeof(django) !== 'undefined' && typeof(django.jQuery) !== 'undefined')
|
||||||
'use strict';
|
{
|
||||||
$(function() {
|
(function($) {
|
||||||
$('.cancel-link').click(function(e) {
|
|
||||||
e.preventDefault();
|
'use strict';
|
||||||
var parentWindow = window.parent;
|
|
||||||
if (parentWindow && typeof(parentWindow.dismissRelatedObjectModal) === 'function') {
|
$(document).ready(function() {
|
||||||
parentWindow.dismissRelatedObjectModal();
|
|
||||||
} else {
|
$('.cancel-link').click(function(e) {
|
||||||
// fallback to default behavior
|
e.preventDefault();
|
||||||
history.back();
|
var parentWindow = window.parent;
|
||||||
}
|
if (parentWindow && typeof(parentWindow.dismissRelatedObjectModal) === 'function') {
|
||||||
return false;
|
parentWindow.dismissRelatedObjectModal();
|
||||||
|
} else {
|
||||||
|
// fallback to default behavior
|
||||||
|
history.back();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
|
||||||
})(django.jQuery);
|
})(django.jQuery);
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/* global opener */
|
(function() {
|
||||||
(function($) {
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function getModalWindowData()
|
function getModalWindowData()
|
||||||
@@ -48,5 +48,5 @@
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
})(django.jQuery);
|
|
||||||
|
|
||||||
|
})();
|
||||||
@@ -61,7 +61,7 @@ if (typeof(django) !== 'undefined' && typeof(django.jQuery) !== 'undefined')
|
|||||||
// create a random parameter and append it to the src url to prevent it
|
// create a random parameter and append it to the src url to prevent it
|
||||||
// this workaround doesn't work with related lookup url
|
// this workaround doesn't work with related lookup url
|
||||||
var iframeSrcRandom = String(Math.round(Math.random() * 999999));
|
var iframeSrcRandom = String(Math.round(Math.random() * 999999));
|
||||||
if( iframeSrc.indexOf('?') === -1 ){
|
if (iframeSrc.indexOf('?') === -1) {
|
||||||
iframeSrc += '?_modal=' + iframeSrcRandom;
|
iframeSrc += '?_modal=' + iframeSrcRandom;
|
||||||
} else {
|
} else {
|
||||||
iframeSrc += '&_modal=' + iframeSrcRandom;
|
iframeSrc += '&_modal=' + iframeSrcRandom;
|
||||||
@@ -86,7 +86,7 @@ if (typeof(django) !== 'undefined' && typeof(django.jQuery) !== 'undefined')
|
|||||||
{
|
{
|
||||||
// set current window as iframe opener because
|
// set current window as iframe opener because
|
||||||
// the callback is called on the opener window
|
// the callback is called on the opener window
|
||||||
iframeEl.load(function(){
|
iframeEl.on('load', function() {
|
||||||
var iframeObj = $(this).get(0);
|
var iframeObj = $(this).get(0);
|
||||||
var iframeWindow = iframeObj.contentWindow;
|
var iframeWindow = iframeObj.contentWindow;
|
||||||
iframeWindow.opener = window;
|
iframeWindow.opener = window;
|
||||||
@@ -129,5 +129,4 @@ if (typeof(django) !== 'undefined' && typeof(django.jQuery) !== 'undefined')
|
|||||||
});
|
});
|
||||||
|
|
||||||
})(django.jQuery);
|
})(django.jQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
__version__ = '0.8.0'
|
__version__ = '0.8.2'
|
||||||
|
|||||||
Reference in New Issue
Block a user