mirror of
https://git.dotclear.org/dev/dotclear.git
synced 2024-12-27 04:00:13 +00:00
UX: Add a required attribute to password of the chosen action is delete on blogs page management
This commit is contained in:
parent
227cccc332
commit
7ae2acbd3a
1 changed files with 12 additions and 0 deletions
|
@ -11,6 +11,18 @@ dotclear.ready(() => {
|
|||
dotclear.condSubmit('#form-blogs td input[type=checkbox]', '#form-blogs #do-action');
|
||||
dotclear.responsiveCellHeaders(document.querySelector('#form-blogs table'), '#form-blogs table', 1);
|
||||
|
||||
// If password is mandatory for action, set the field as required
|
||||
const password = document.getElementById('pwd');
|
||||
const action = document.querySelector('select[name="action"]');
|
||||
if (password && action) {
|
||||
const setRequired = () => {
|
||||
if (action.value === 'delete') password.setAttribute('required', 'required');
|
||||
else password.removeAttribute('required');
|
||||
};
|
||||
setRequired();
|
||||
action.addEventListener('change', setRequired);
|
||||
}
|
||||
|
||||
// Ask confirmation before blog(s) deletion
|
||||
document.getElementById('form-blogs')?.addEventListener('submit', (event) => {
|
||||
if (document.querySelector('select[name="action"]')?.value === 'delete') {
|
||||
|
|
Loading…
Reference in a new issue