Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CONVERSATION] masquer le bouton "voir les 999 reponses" (fix) #417

Merged
merged 3 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div id="showmorepostsarea{{topic.pk}}">
{% for post in posts %}
<div class="card post mb-3 {% if post.is_certified %}bg-communaute-lighter border-communaute {% else %}bg-light {% endif %} has-links-inside ms-3"
id="certifiedpostsarea{{post.pk}}">
id="certifiedpostsarea{{post.pk}}">
<div class="card-body">
<div class="row">
<div class="col-12 post-content-wrapper">
Expand Down 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>
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,15 @@

{% if posts_count > 1 %}
<a hx-get="{% url 'forum_conversation_extension:showmore_posts' topic.forum.slug topic.forum.pk topic.slug topic.pk %}"
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"
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"
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 showmoreposts-button"
data-matomo-category="engagement"
data-matomo-action="showmore"
data-matomo-option="post"
aria-label="{% trans "Show me the comment" %}"
role="button"
>
<i class="ri-eye-line font-weight-normal" aria-hidden="true"></i>
<span>
Expand Down Expand Up @@ -64,10 +63,3 @@
{% endif %}
</div>
{% endif %}


<script>
function DisabledMe(id) {
document.getElementById(id).classList.add('disabled');
}
</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>