remove files from ugly version
This commit is contained in:
parent
14ef4a91a0
commit
f54b399411
18
main.js
18
main.js
@ -23,6 +23,8 @@
|
|||||||
"attachment3": "admin_files"
|
"attachment3": "admin_files"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let removedFilesLinks = []
|
||||||
|
|
||||||
class Property {
|
class Property {
|
||||||
id;
|
id;
|
||||||
name;
|
name;
|
||||||
@ -174,6 +176,7 @@
|
|||||||
|
|
||||||
await fetch(removeLink)
|
await fetch(removeLink)
|
||||||
await sendFileDeleted(inputName)
|
await sendFileDeleted(inputName)
|
||||||
|
removedFilesLinks.push(removeLink)
|
||||||
|
|
||||||
fileListContainer.removeChild(fileContainer)
|
fileListContainer.removeChild(fileContainer)
|
||||||
})
|
})
|
||||||
@ -392,6 +395,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function removeDeletedFilesFromUglyVersion(removeLink) {
|
||||||
|
let shortHref = removeLink.split("/").at(-1)
|
||||||
|
document.querySelector(`tr:has(a[href="${shortHref}"])`).remove()
|
||||||
|
}
|
||||||
|
|
||||||
function moveInputValues(form, was, became) {
|
function moveInputValues(form, was, became) {
|
||||||
let inputValues = saveInputValues(was)
|
let inputValues = saveInputValues(was)
|
||||||
form.removeChild(was)
|
form.removeChild(was)
|
||||||
@ -407,6 +415,14 @@
|
|||||||
$("#cps_main").select2()
|
$("#cps_main").select2()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function uglify(form, was, became) {
|
||||||
|
moveInputValues(form, was, became)
|
||||||
|
for (const removedFileLink of removedFilesLinks) {
|
||||||
|
removeDeletedFilesFromUglyVersion(removedFileLink)
|
||||||
|
}
|
||||||
|
removedFilesLinks = []
|
||||||
|
}
|
||||||
|
|
||||||
function createAlwaysPrettifyInput(index) {
|
function createAlwaysPrettifyInput(index) {
|
||||||
let alwaysPrettify = document.createElement("div")
|
let alwaysPrettify = document.createElement("div")
|
||||||
alwaysPrettify.classList.add("always-prettify-container")
|
alwaysPrettify.classList.add("always-prettify-container")
|
||||||
@ -924,7 +940,7 @@
|
|||||||
unglifyButton.type = "button"
|
unglifyButton.type = "button"
|
||||||
unglifyButton.textContent = "Сделать некрасиво"
|
unglifyButton.textContent = "Сделать некрасиво"
|
||||||
unglifyButton.addEventListener("click", () => {
|
unglifyButton.addEventListener("click", () => {
|
||||||
moveInputValues(form, container, oldTable)
|
uglify(form, container, oldTable)
|
||||||
})
|
})
|
||||||
|
|
||||||
let topRowContentWrapper = el.querySelector("div > div > div")
|
let topRowContentWrapper = el.querySelector("div > div > div")
|
||||||
|
Loading…
Reference in New Issue
Block a user