urls and files: hide custom slug field when generating automatically
This commit is contained in:
parent
1e00834324
commit
33947012e4
@ -14,16 +14,38 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
const autogenUrlCheckbox = document.querySelector<HTMLInputElement>('#field-autogen_url');
|
||||
const slugField = document.querySelector<HTMLInputElement>('#field-slug');
|
||||
|
||||
if (expireAfterDaysField) {
|
||||
neverExpireCheckbox?.addEventListener('change', () => {
|
||||
if (expireAfterDaysField && neverExpireCheckbox) {
|
||||
const updateExpireAfterDaysField = () => {
|
||||
expireAfterDaysField.disabled = neverExpireCheckbox.checked;
|
||||
});
|
||||
|
||||
const parent = expireAfterDaysField.parentElement?.parentElement;
|
||||
if (parent) {
|
||||
if (neverExpireCheckbox.checked) {
|
||||
parent.classList.add('hidden');
|
||||
} else {
|
||||
parent.classList.remove('hidden');
|
||||
}
|
||||
}
|
||||
};
|
||||
neverExpireCheckbox.addEventListener('change', updateExpireAfterDaysField);
|
||||
updateExpireAfterDaysField();
|
||||
}
|
||||
|
||||
if (slugField) {
|
||||
autogenUrlCheckbox?.addEventListener('change', () => {
|
||||
if (slugField && autogenUrlCheckbox) {
|
||||
const updateSlugField = () => {
|
||||
slugField.disabled = autogenUrlCheckbox.checked;
|
||||
});
|
||||
|
||||
const parent = slugField.parentElement?.parentElement;
|
||||
if (parent) {
|
||||
if (autogenUrlCheckbox.checked) {
|
||||
parent.classList.add('hidden');
|
||||
} else {
|
||||
parent.classList.remove('hidden');
|
||||
}
|
||||
}
|
||||
};
|
||||
autogenUrlCheckbox.addEventListener('change', updateSlugField);
|
||||
updateSlugField();
|
||||
}
|
||||
|
||||
let uploadForm: UploadForm | undefined;
|
||||
|
@ -5,9 +5,20 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
const autogenUrlCheckbox = document.querySelector<HTMLInputElement>('#field-autogen_url');
|
||||
const slugField = document.querySelector<HTMLInputElement>('#field-slug');
|
||||
|
||||
if (slugField) {
|
||||
autogenUrlCheckbox?.addEventListener('change', () => {
|
||||
if (slugField && autogenUrlCheckbox) {
|
||||
const updateSlugField = () => {
|
||||
slugField.disabled = autogenUrlCheckbox.checked;
|
||||
});
|
||||
|
||||
const parent = slugField.parentElement?.parentElement;
|
||||
if (parent) {
|
||||
if (autogenUrlCheckbox.checked) {
|
||||
parent.classList.add('hidden');
|
||||
} else {
|
||||
parent.classList.remove('hidden');
|
||||
}
|
||||
}
|
||||
};
|
||||
autogenUrlCheckbox.addEventListener('change', updateSlugField);
|
||||
updateSlugField();
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user