|
@@ -36,8 +36,10 @@ function showAdminPopup(triggeringLink, name_regexp) {
|
|
|
} else {
|
|
|
href += '&_popup=1';
|
|
|
}
|
|
|
- var win = window.open(href, name, 'height=500,width=800,resizable=yes,scrollbars=yes');
|
|
|
- win.focus();
|
|
|
+
|
|
|
+ // Django JET
|
|
|
+ showRelatedPopup(name, href);
|
|
|
+
|
|
|
return false;
|
|
|
}
|
|
|
|
|
@@ -53,15 +55,19 @@ function dismissRelatedLookupPopup(win, chosenId) {
|
|
|
} else {
|
|
|
document.getElementById(name).value = chosenId;
|
|
|
}
|
|
|
- win.close();
|
|
|
+
|
|
|
+ // Django JET
|
|
|
+ closeRelatedPopup(win);
|
|
|
}
|
|
|
|
|
|
function showRelatedObjectPopup(triggeringLink) {
|
|
|
var name = triggeringLink.id.replace(/^(change|add|delete)_/, '');
|
|
|
name = id_to_windowname(name);
|
|
|
var href = triggeringLink.href;
|
|
|
- var win = window.open(href, name, 'height=500,width=800,resizable=yes,scrollbars=yes');
|
|
|
- win.focus();
|
|
|
+
|
|
|
+ // Django JET
|
|
|
+ showRelatedPopup(name, href);
|
|
|
+
|
|
|
return false;
|
|
|
}
|
|
|
|
|
@@ -94,7 +100,9 @@ function dismissAddRelatedObjectPopup(win, newId, newRepr) {
|
|
|
SelectBox.add_to_cache(toId, o);
|
|
|
SelectBox.redisplay(toId);
|
|
|
}
|
|
|
- win.close();
|
|
|
+
|
|
|
+ // Django JET
|
|
|
+ closeRelatedPopup(win);
|
|
|
}
|
|
|
|
|
|
function dismissChangeRelatedObjectPopup(win, objId, newRepr, newId) {
|
|
@@ -109,7 +117,9 @@ function dismissChangeRelatedObjectPopup(win, objId, newRepr, newId) {
|
|
|
this.value = newId;
|
|
|
}
|
|
|
});
|
|
|
- win.close();
|
|
|
+
|
|
|
+ // Django JET
|
|
|
+ closeRelatedPopup(win);
|
|
|
};
|
|
|
|
|
|
function dismissDeleteRelatedObjectPopup(win, objId) {
|
|
@@ -122,9 +132,38 @@ function dismissDeleteRelatedObjectPopup(win, objId) {
|
|
|
django.jQuery(this).remove();
|
|
|
}
|
|
|
}).trigger('change');
|
|
|
- win.close();
|
|
|
+
|
|
|
+ // Django JET
|
|
|
+ closeRelatedPopup(win);
|
|
|
};
|
|
|
|
|
|
// Kept for backward compatibility
|
|
|
showAddAnotherPopup = showRelatedObjectPopup;
|
|
|
dismissAddAnotherPopup = dismissAddRelatedObjectPopup;
|
|
|
+
|
|
|
+// Django JET
|
|
|
+
|
|
|
+opener = parent.window;
|
|
|
+
|
|
|
+function showRelatedPopup(name, href) {
|
|
|
+ django.jQuery(function($) {
|
|
|
+ var $container = $('.related-popup-container');
|
|
|
+ var $loading = $container.find('.loading-indicator');
|
|
|
+ var $popup = $('<iframe>').attr('name', name).attr('src', href).addClass('related-popup').on('load', function() {
|
|
|
+ $popup.add($('.related-popup-back')).fadeIn(200, 'swing', function() {
|
|
|
+ $loading.hide();
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ $loading.show();
|
|
|
+ $container.fadeIn(200, 'swing', function() {
|
|
|
+ $('.related-popup-container').append($popup);
|
|
|
+ });
|
|
|
+ $('body').addClass('non-scrollable');
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+function closeRelatedPopup(win) {
|
|
|
+ jet.jQuery('select').trigger('select:init');
|
|
|
+ jet.jQuery(win.parent).trigger('related-popup:close');
|
|
|
+}
|