-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve users autoblocks config form
- Loading branch information
1 parent
ca40ee6
commit 3a3c01b
Showing
5 changed files
with
33 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
app/packs/src/decidim/decidim_awesome/admin/users_autoblocks.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
document.addEventListener("DOMContentLoaded", () => { | ||
const configCheckBox = document.getElementById("users_autoblocks_config_perform_block"); | ||
|
||
configCheckBox.addEventListener("change", (event) => { | ||
const form = event.currentTarget.form; | ||
const submitButton = form.querySelector("[data-perform-block-message]"); | ||
const messages = JSON.parse(submitButton.dataset.performBlockMessage); | ||
const justificationMessage = form.querySelector("[data-justification-message]"); | ||
|
||
if (event.target.checked) { | ||
submitButton.setAttribute("data-confirm", submitButton.dataset.confirmMessage); | ||
justificationMessage.classList.remove("hidden"); | ||
justificationMessage.querySelector("input").required = true; | ||
} else { | ||
submitButton.removeAttribute("data-confirm"); | ||
justificationMessage.classList.add("hidden"); | ||
justificationMessage.querySelector("input").required = false; | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters