Changeset - 6d7e96b4c8da
[Not reviewed]
0 1 0
Brett Smith (brett) - 5 years ago 2017-05-23 16:13:04
brett@sfconservancy.org
admin: Fix query parameter manipulation in showAddAnotherPopup.

This should fix the bug in, i.e., adding tags from the blog entry admin
page.
1 file changed with 10 insertions and 14 deletions:
0 comments (0 inline, 0 general)
www/conservancy/static/admin/js/admin/RelatedObjectLookups.js
Show inline comments
 
// Handles related-objects functionality: lookup link for raw_id_admin=True
 
// and Add Another links.
 

	
 
function showRelatedObjectLookupPopup(triggeringLink) {
 
    var name = triggeringLink.id.replace(/^lookup_/, '');
 
function showPopupFromLink(elem, nameTrimRegexp, popupParamName) {
 
    var name = elem.id.replace(nameTrimRegexp, '');
 
    // IE doesn't like periods in the window name, so convert temporarily.
 
    name = name.replace(/\./g, '___');
 
    var href;
 
    if (triggeringLink.href.search(/\?/) >= 0) {
 
        href = triggeringLink.href + '&pop=1';
 
    } else {
 
        href = triggeringLink.href + '?pop=1';
 
    }
 
    var win = window.open(href, name, 'height=500,width=740,resizable=yes,scrollbars=yes');
 
    var url = new URL(elem.href);
 
    url.searchParams.set(popupParamName, '1');
 
    var win = window.open(url.toString(), name, 'height=500,width=800,resizable=yes,scrollbars=yes');
 
    win.focus();
 
    return false;
 
}
 

	
 
function showRelatedObjectLookupPopup(triggeringLink) {
 
    return showPopupFromLink(triggeringLink, /^lookup_/, 'pop');
 
}
 

	
 
function dismissRelatedLookupPopup(win, chosenId) {
 
    var name = win.name.replace(/___/g, '.');
 
    var elem = document.getElementById(name);
...
 
@@ -28,11 +28,7 @@ function dismissRelatedLookupPopup(win, chosenId) {
 
}
 

	
 
function showAddAnotherPopup(triggeringLink) {
 
    var name = triggeringLink.id.replace(/^add_/, '');
 
    name = name.replace(/\./g, '___');
 
    var win = window.open(triggeringLink.href + '?_popup=1', name, 'height=500,width=800,resizable=yes,scrollbars=yes');
 
    win.focus();
 
    return false;
 
    return showPopupFromLink(triggeringLink, /^add_/, '_popup');
 
}
 

	
 
function dismissAddAnotherPopup(win, newId, newRepr) {
0 comments (0 inline, 0 general)