Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: address failing gulp ci jobs. #1437

Merged
merged 1 commit into from
Nov 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions filer/static/filer/js/addons/dropzone.init.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ djQuery(function ($) {

// Handle initialization of the dropzone on dynamic formsets (i.e. Django admin inlines)
$(document).on('formset:added', function (ev, row) {
if(ev.detail && ev.detail.formsetName) {
var dropzones, rowIdx, row_;
if (ev.detail && ev.detail.formsetName) {
/*
Django 4.1 changed the event type being fired when adding
a new formset from a jQuery to a vanilla JavaScript event.
Expand All @@ -172,16 +173,17 @@ djQuery(function ($) {
In this case we find the newly added row and initialize the
dropzone on any dropzoneSelector on that row.
*/
let rowIdx = parseInt(

rowIdx = parseInt(
document.getElementById(
'id_' + event.detail.formsetName + '-TOTAL_FORMS'
).value, 10
) - 1;
let row_ = document.getElementById(event.detail.formsetName + '-' + rowIdx);
var dropzones = $(row_).find(dropzoneSelector)
row_ = document.getElementById(event.detail.formsetName + '-' + rowIdx);
dropzones = $(row_).find(dropzoneSelector);

} else {
var dropzones = $(row).find(dropzoneSelector);
dropzones = $(row).find(dropzoneSelector);
}

dropzones.each(createDropzone);
Expand Down
Loading