This commit is contained in:
Ross
2024-12-30 11:24:45 +00:00
parent 7493d55bc2
commit cb47e488ed
2 changed files with 24 additions and 3 deletions
+12 -2
View File
@@ -23,12 +23,22 @@
</ol> </ol>
{% comment %} Hide the toggle button if there are no users (to add or remove) {% endcomment %} {% comment %} Hide the toggle button if there are no users (to add or remove) {% endcomment %}
{% if current_cid_users or available_cid_users %} <p>{% if current_cid_users or available_cid_users %}
<p><button class="toggle-all-btn">Toggle all</button></p> <button class="toggle-all-btn">Toggle all</button>
{% endif %} {% endif %}
<button class="add-all-btn">Add all</button>
<button class="remove-all-btn">Remove all</button>
</p>
<script> <script>
$(document).ready(() => { $(document).ready(() => {
$(".remove-all-btn").click((el) => {
$(".current .toggle-btn").click();
});
$(".add-all-btn").click((el) => {
$(":not(.current) .toggle-btn").click();
});
$(".toggle-all-btn").click((el) => { $(".toggle-all-btn").click((el) => {
$(".toggle-btn").click(); $(".toggle-btn").click();
}); });
+12 -1
View File
@@ -37,12 +37,23 @@
</ol> </ol>
{% comment %} Hide the toggle button if there are no users (to add or remove) {% endcomment %} {% comment %} Hide the toggle button if there are no users (to add or remove) {% endcomment %}
<p>
{% if current_user_users or available_user_users %} {% if current_user_users or available_user_users %}
<p><button class="toggle-all-btn">Toggle all</button></p> <button class="toggle-all-btn">Toggle all</button>
{% endif %} {% endif %}
<button class="add-all-btn">Add all</button>
<button class="remove-all-btn">Remove all</button>
</p>
<script> <script>
$(document).ready(() => { $(document).ready(() => {
$(".remove-all-btn").click((el) => {
$(".current .toggle-btn").click();
});
$(".add-all-btn").click((el) => {
$("li:not(.current) .toggle-btn").click();
});
$(".toggle-all-btn").click((el) => { $(".toggle-all-btn").click((el) => {
$(".toggle-btn").click(); $(".toggle-btn").click();
}); });