app/assets/javascripts/headmin.js in headmin-0.5.3 vs app/assets/javascripts/headmin.js in headmin-0.5.4
- old
+ new
@@ -10209,21 +10209,21 @@
}
hidePlaceholder() {
this.placeholderTarget.classList.add("d-none");
}
enableItem(item) {
- item.querySelector(`input[name*='_destroy']`).value = false;
+ item.querySelector("input[name*='_destroy']").value = false;
item.classList.remove("d-none");
}
createItem(item) {
const template = this.templateTarget;
const html = this.randomizeIds(template);
this.thumbnailsTarget.insertAdjacentHTML("beforeend", html);
const newItem = this.itemTargets.pop();
- newItem.querySelector(`input[name*="[blob_id]"]`).value = item.blobId;
- newItem.querySelector(`input[name*="[_destroy]"]`).value = false;
- const editButton = newItem.querySelector(`[data-media-target="editButton"]`);
+ newItem.querySelector('input[name*="[blob_id]"]').value = item.blobId;
+ newItem.querySelector('input[name*="[_destroy]"]').value = false;
+ const editButton = newItem.querySelector('[data-media-target="editButton"]');
editButton.setAttribute("href", editButton.getAttribute("href").replace("$1", item.blobId));
const oldThumbnail = newItem.querySelector(".h-thumbnail");
const newThumbnail = item.thumbnail.cloneNode(true);
oldThumbnail.parentNode.replaceChild(newThumbnail, oldThumbnail);
}
@@ -10239,29 +10239,29 @@
items.forEach((item) => {
this.removeItem(item);
});
}
removeItem(item) {
- item.querySelector(`input[name*='_destroy']`).value = 1;
+ item.querySelector("input[name*='_destroy']").value = 1;
item.classList.add("d-none");
this.resetPositions();
this.syncIds();
this.togglePlaceholder();
}
itemByBlobId(blobId) {
return this.itemTargets.find((item) => {
- return item.querySelector(`input[name*='blob_id']`).value === blobId;
+ return item.querySelector("input[name*='blob_id']").value === blobId;
});
}
activeItems() {
return this.itemTargets.filter((item) => {
- return item.querySelector(`input[name$='[_destroy]']`).value === "false";
+ return item.querySelector("input[name$='[_destroy]']").value === "false";
});
}
activeIds() {
return this.activeItems().map((item) => {
- return item.querySelector(`input[name$='[blob_id]']`).value;
+ return item.querySelector("input[name$='[blob_id]']").value;
});
}
};
// app/assets/javascripts/headmin/controllers/media_modal_controller.js
@@ -15862,12 +15862,12 @@
if (this.textareaTarget.getAttribute("maxlength")) {
this.updateCountLength();
}
}
updateCountLength() {
- const current_length = this.textareaTarget.value.length;
- const maximum_length = this.textareaTarget.getAttribute("maxlength");
- this.countTarget.textContent = `${current_length}/${maximum_length}`;
+ const currentLength = this.textareaTarget.value.length;
+ const maximumLength = this.textareaTarget.getAttribute("maxlength");
+ this.countTarget.textContent = `${currentLength}/${maximumLength}`;
}
};
// app/assets/javascripts/headmin/index.js
var Headmin = class {