Skip to content

Commit

Permalink
fix(forum_conversation): move script which add d-none class at topic_…
Browse files Browse the repository at this point in the history
…list level instead of posts_list level to prevent duplicate
  • Loading branch information
vincentporte committed Sep 21, 2023
1 parent b360f90 commit d702c43
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,3 @@
{% include "forum_conversation/partials/post_feed_form_collapsable.html" with post_form=form inline=1 %}
</div>
</div>

<script>
document.getElementById(`collapseButtonPost{{topic.pk}}`).setAttribute('aria-expanded', 'false');
document.getElementById(`showmoreposts-button{{topic.pk}}`).className = 'd-none';
</script>
7 changes: 7 additions & 0 deletions lacommunaute/templates/forum_conversation/topic_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,10 @@
{% endif %}
{% endif %}
</div>

<script nonce="{{ request.csp_nonce }}">
var showmorepostsButtons = document.querySelectorAll('.showmoreposts-button')
showmorepostsButtons.forEach((button) => button.addEventListener('click', function () {
button.classList.add('d-none');
}));
</script>

0 comments on commit d702c43

Please sign in to comment.