Skip to content

Commit

Permalink
fix(forum_conversation) script to hide showmoreposts button
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentporte committed Sep 20, 2023
1 parent 21a7ede commit 3fc80ad
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,3 @@
</div>
</div>

<script nonce="{{ request.csp_nonce }}">
document.getElementById(`collapseButtonPost{{topic.pk}}`).setAttribute('aria-expanded', 'false');
document.getElementById(`showmoreposts-button{{topic.pk}}`).className = 'd-none';
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@
id="showmoreposts-button{{topic.pk}}"
hx-target="#showmorepostsarea{{topic.pk}}"
hx-swap="outerHTML"
class="btn btn-secondary btn-sm btn-ico matomo-event justify-content-center w-100 w-sm-auto me-sm-1 mb-2 mb-sm-0"
class="btn btn-secondary btn-sm btn-ico matomo-event justify-content-center w-100 w-sm-auto me-sm-1 mb-2 mb-sm-0 showmoreposts-button"
data-matomo-category="engagement"
data-matomo-action="showmore"
data-matomo-option="post"
onclick=DisabledMe("showmoreposts-button{{topic.pk}}")
aria-label="{% trans "Show me the comment" %}"
role="button"
>
Expand Down Expand Up @@ -66,9 +65,4 @@
{% endif %}


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

8 changes: 8 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,11 @@
{% 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 3fc80ad

Please sign in to comment.