Add disable all button to email notification settings

This commit is contained in:
rubenwardy 2024-03-05 18:05:13 +00:00
parent 76638ad878
commit a94c398633
2 changed files with 16 additions and 1 deletions

@ -0,0 +1,10 @@
// @author rubenwardy
// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3-or-Later
"use strict";
const disableAll = document.getElementById("disable-all");
disableAll.classList.remove("d-none");
disableAll.addEventListener("click", () => {
document.querySelectorAll("input[type='checkbox']").forEach(x => { x.checked = false; });
});

@ -4,6 +4,10 @@
{{ _("Email and Notifications - %(username)s", username=user.username) }}
{% endblock %}
{% block scriptextra %}
<script src="/static/js/email_disable_all.js"></script>
{% endblock %}
{% block pane %}
<h2 class="mt-0">{{ _("Email and Notifications") }}</h2>
@ -36,6 +40,7 @@
<p>
{{ _("Configure whether certain types of notifications are sent immediately, or as part of a daily digest.") }}
<button type="button" id="disable-all" class="btn btn-sm btn-secondary d-none ms-5">{{ _("Disable all") }}</button>
</p>
<table class="table">
@ -60,7 +65,7 @@
</table>
<p class="mt-5">
{{ render_submit_field(form.submit, tabindex=280) }}
{{ render_submit_field(form.submit, tabindex=280, class_="btn btn-lg btn-primary") }}
</p>
</form>
{% endblock %}