Skip to content

Commit

Permalink
fix django 4.2 js lookup window
Browse files Browse the repository at this point in the history
  • Loading branch information
benzkji committed May 15, 2023
1 parent 46864d5 commit f92becb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion filer_addons/filer_gui/static/admin/filer_gui/js/widgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ var FilerGuiWidgets = (function($){

// Ugly hack to be sure to have a filer-gui lookup dismiss
var is_lookup_original = true;
// var dismiss_lookup_original = window.dismissRelatedImageLookupPopup;
var dismiss_lookup_original = window.dismissRelatedImageLookupPopup;

window.dismissRelatedImageLookupPopup = dissmiss_lookup_window;
Expand Down Expand Up @@ -197,7 +198,6 @@ var FilerGuiWidgets = (function($){

// Ugly hack to be sure to have a filer-gui lookup dismiss
is_lookup_original = false;

// if no _widget init the widget
if(!this._widget) {
// Ugly hack, we need a better way to init an inline add
Expand Down Expand Up @@ -239,6 +239,7 @@ var FilerGuiWidgets = (function($){
win.onunload = dissmiss_related_window;

function dissmiss_related_window(e) {
console.log("dissmisssss");
if(e.target.URL !== 'about:blank') {
win.close();
// window.windowname_to_id was removed in django 3.1 (IE support removed)
Expand All @@ -263,6 +264,7 @@ var FilerGuiWidgets = (function($){
// window.windowname_to_id was removed in django 3.1
// see some lines above for more infos
var id = win.name;
id = id.split('__')[0]; // django 4 introduces multiple lookup windows, id__number, we need the id.
var widget = widget_map[id];

win.close();
Expand Down
1 change: 1 addition & 0 deletions filer_addons/filer_gui/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class Media:
}
js = [
'admin/js/jquery.init.js', # deps: django jquery needed!
'filer/js/addons/popup_handling.js',
'admin/filer_gui/js/dropzone.js',
'admin/filer_gui/js/widgets.js',
]
Expand Down

0 comments on commit f92becb

Please sign in to comment.