templates/forum/forum_post/layout/_report_script.html.twig line 1

Open in your IDE?
  1. <script>
  2.     const hidden_reportEntity = document.getElementById("forum_report_report_entity");
  3.     const hidden_reportRubriqueID = document.getElementById("forum_report_rubrique_id");
  4. </script>
  5. {# --------- COMMENT REPORT --------- #}
  6. <script>
  7.     const reportPostCommentBtn = document.querySelectorAll('.report_comment');
  8.     reportPostCommentBtn.forEach(button => {
  9.         button.addEventListener('click', () => {
  10.             let commentId = button.getAttribute('data-comment-id');
  11.             hidden_reportEntity.value = "comment";
  12.             hidden_reportRubriqueID.value = commentId;
  13.         });
  14.     });
  15. </script>
  16. {# --------- POST REPORT --------- #}
  17. <script>
  18.     const reportPostBtn = document.querySelectorAll('.report_post');
  19.     reportPostBtn.forEach(button => {
  20.         button.addEventListener('click', () => {
  21.             let postID = button.getAttribute('data-post-id');
  22.             hidden_reportEntity.value = "post";
  23.             hidden_reportRubriqueID.value = postID;
  24.         });
  25.     });
  26. </script>
  27. {# --------- COMMENT REPLY --------- #}
  28. <script>
  29.     const reportPostCommentReplyBtn = document.querySelectorAll('.report_reply');
  30.     reportPostCommentReplyBtn.forEach(button => {
  31.         button.addEventListener('click', () => {
  32.             let replyId = button.getAttribute('data-reply-id');
  33.             hidden_reportEntity.value = "reply";
  34.             hidden_reportRubriqueID.value = replyId;
  35.         });
  36.     });
  37. </script>