Browse Source

Make whole topic row selectable in moderation mode

Fixes #538
Peter Justin 3 years ago
parent
commit
319aa34ac3

+ 1 - 1
flaskbb/templates/forum/_forum_row.html

@@ -1,4 +1,4 @@
-<div class="row forum-row hover">
+<div class="row forum-row hover {{ forum_row_css_class }}">
 
     <div class="{% if with_checkbox %}col-7{% else %}col-8{% endif %} col-sm-4 topic-info">
         <div class="topic-status">

+ 1 - 0
flaskbb/templates/forum/edit_forum.html

@@ -28,6 +28,7 @@
 
             <div class="card-body forum-body">
                 {% set with_checkbox = True %}
+                {% set forum_row_css_class = 'set-checkbox' %}
                 {% include theme("forum/_forum_meta.html") %}
 
                 {% for topic, last_post, topicread in topics.items %}

+ 8 - 0
flaskbb/themes/aurora/src/app/flaskbb.js

@@ -218,6 +218,14 @@ document.addEventListener("DOMContentLoaded", function (event) {
         })
     );
 
+    // listen on set-checkbox to check the nearest checkbox
+    document.querySelectorAll(".set-checkbox").forEach((el) =>
+        el.addEventListener("click", (event) => {
+            const cb = el.querySelector("input.action-checkbox");
+            cb.checked = !cb.checked;
+        })
+    );
+
     document.querySelectorAll("time").forEach((el) => {
         let date = new Date(el.getAttribute("datetime"));
         const options = {