move new files to correct section
This commit is contained in:
parent
e4aec83cf2
commit
cbbbd8e338
11
main.js
11
main.js
@ -549,7 +549,17 @@
|
||||
}
|
||||
|
||||
function moveNewFilesOnVariantChange() {
|
||||
document.querySelectorAll(`input[name^="new_file_type"]`).forEach(el => el.addEventListener("change", function() {
|
||||
let attachmentIndex = this.name.replace(/\D/g,'')
|
||||
|
||||
let from = this.value == "l" ? "history" : "legend"
|
||||
let to = this.value == "l" ? "legend" : "history"
|
||||
let type = attachmentIndex == 1 ? "photo" : "files"
|
||||
let newFiles = [...document.querySelectorAll(`.${from}-${type}-container .file-container-new`)]
|
||||
for (const newFile of newFiles) {
|
||||
document.querySelector(`.${to}-${type}-container .file-list-container`).appendChild(newFile)
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
||||
function removeDeletedFilesFromUglyVersion(removeLink) {
|
||||
@ -569,6 +579,7 @@
|
||||
moveInputValues(form, was, became)
|
||||
prettifyFiles(insertedFileRows)
|
||||
|
||||
moveNewFilesOnVariantChange()
|
||||
$("#cps_main").select2()
|
||||
makeCoordinatesLinks()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user