-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(home): afficher les questions en attente de réponse sur la page …
…d'accueil (#830) ## Description 🎸 Valoriser les questions en attente de réponse dès la page d'acceuil, et permettre d'y répondre directement 🎸 Allègement de l'affichage, les questions en attente ne peuvent pas avoir de réponse certifiée. Les `attachments` et les sondages sont volontairement non affichés. ## Type de changement 🎢 Nouvelle fonctionnalité (changement non cassant qui ajoute une fonctionnalité). 🎨 changement d'UI ### Points d'attention 🦺 ajout de la méthode `unanswered` dans `TopicQueryset` 🦺 duplication et simplification du gabarit `topic_list` en `topic_simple_list` 🦺 enrichissement du contexte de `HomeView` 🦺 pas de pagination, seules les 4 plus récentes questions sont affichées. La section est cachée si aucune question n'est en attente ### Captures d'écran (optionnel) page d'accueil avec questions en attente ![image](https://github.com/user-attachments/assets/9363a5a7-6a80-46ff-a6fc-e54920da937b) page d'accueil sans question en attente ![image](https://github.com/user-attachments/assets/1f1d4258-0a13-47f4-ba5c-02061066c8ad) --------- Co-authored-by: hellodeloo <[email protected]> Co-authored-by: François Freitag <[email protected]>
- Loading branch information
1 parent
d86f0ee
commit 300a7bd
Showing
7 changed files
with
115 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
lacommunaute/templates/forum_conversation/topic_simple_list.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{% load i18n %} | ||
<div id="topicsarea"> | ||
{% if topics or not hide_if_empty %} | ||
<ul class="list-group list-group-flush"> | ||
{% for topic in topics %} | ||
<li class="list-group-item list-group-item-action"> | ||
<div id="{{ topic.pk }}" class="post"> | ||
<a href="{% url 'forum_conversation:topic' topic.forum.slug topic.forum.pk topic.slug topic.pk %}" | ||
class="h4 text-tertiary d-block mb-1 matomo-event" | ||
data-matomo-category="engagement" | ||
data-matomo-action="view" | ||
data-matomo-option="topic">{{ topic.subject }}</a> | ||
<div class="mb-3"> | ||
{% include "forum_conversation/partials/poster.html" with post=topic.first_post topic=topic is_topic_head=True forum=forum %} | ||
</div> | ||
<div class="post-content"> | ||
<div id="showmoretopicsarea{{ topic.pk }}"> | ||
{% include 'partials/rendered_md.html' with content=topic.first_post.content truncatechars=1 only %} | ||
{% if topic.first_post.content.rendered|length > 200 %} | ||
<a hx-get="{% url 'forum_conversation_extension:showmore_topic' topic.forum.slug topic.forum.pk topic.slug topic.pk %}" | ||
id="showmoretopic-button{{ topic.pk }}" | ||
hx-target="#showmoretopicsarea{{ topic.pk }}" | ||
hx-swap="outerHTML" | ||
class="btn btn-link p-0 mb-3 mt-n3 matomo-event" | ||
data-matomo-category="engagement" | ||
data-matomo-action="showmore" | ||
data-matomo-option="topic">{% trans "+ show more" %}</a> | ||
{% endif %} | ||
</div> | ||
</div> | ||
</div> | ||
<div id="showmorepostsarea{{ topic.pk }}"> | ||
<div id="postinfeedarea{{ topic.pk }}"> | ||
{% include "forum_conversation/partials/post_feed_form_collapsable.html" with post_form=form %} | ||
</div> | ||
</div> | ||
<div class="mb-3"> | ||
{% include "forum_conversation/partials/topic_detail_actions.html" with posts_count=topic.posts_count %} | ||
</div> | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
{% 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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters