Skip to content

Commit

Permalink
update home
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentporte committed Sep 17, 2024
1 parent 29c4af3 commit 2a50af6
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 82 deletions.
4 changes: 2 additions & 2 deletions lacommunaute/forum/tests/__snapshots__/tests_views.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@
<div class="container-fluid" id="subforums_area">

<div class="c-box">
<div class="container-fluid d-flex justify-content-center mb-3">Afficher les fiches contenant l'étiquette</div>
<div class="container-fluid d-flex justify-content-center">
<div class="text-center mb-3">Afficher les fiches contenant l'étiquette</div>
<div class="text-center tag-group">



Expand Down
7 changes: 2 additions & 5 deletions lacommunaute/pages/tests/__snapshots__/test_homepage.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@
<div class="s-footer-quick__col col-12 col-lg-auto">
<strong>Réseaux sociaux</strong>
<ul>
<li>
<a aria-label="La plateforme de l'inclusion sur X (lien externe)" href="https://x.com/inclusion_gouv" target="_blank"><i aria-hidden="true" class="ri-twitter-x-fill text-dark ri-sm"></i> X</a>
</li>
<li>
<a aria-label="La plateforme de l'inclusion sur sur Linkedin (lien externe)" href="https://www.linkedin.com/company/inclusion-gouv/" target="_blank"><i aria-hidden="true" class="ri-linkedin-box-fill text-dark"></i> LinkedIn</a>
</li>
Expand Down Expand Up @@ -155,7 +152,7 @@
<div class="s-header__col s-header__col--nav col d-none d-lg-inline-flex d-lg-flex align-items-center justify-content-end pe-0 pe-xl-3">
<nav aria-label="Navigation principale" id="nav-primary" role="navigation">
<ul>
<li>
<li id="header_search_form">
<form action="/search/" name="header_search_form">
<div class="input-group input-group-rounded-pill">
<input aria-label="Chercher dans la communauté" class="form-control w-300px" name="q" placeholder="Chercher dans la communauté" type="search"/>
Expand Down Expand Up @@ -276,7 +273,7 @@
# name: test_page_title_header_footer[homepage_title]
'''
<title>
Accueil- La communauté de l'inclusion
Accueil - La communauté de l'inclusion
</title>
'''
# ---
26 changes: 1 addition & 25 deletions lacommunaute/pages/tests/test_homepage.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

from lacommunaute.event.factories import EventFactory
from lacommunaute.forum.factories import ForumFactory
from lacommunaute.forum_conversation.factories import PostFactory, TopicFactory
from lacommunaute.utils.testing import parse_response_to_soup


Expand All @@ -17,38 +16,15 @@ def _sub_svg_suffix(content):


def test_context_data(client, db):
topic = TopicFactory(with_post=True, forum=ForumFactory())
article = ForumFactory(parent=ForumFactory(type=1))

disapproved_topic = TopicFactory(with_post=True, forum=ForumFactory())
disapproved_topic.approved = False
disapproved_topic.save()

url = reverse("pages:home")

response = client.get(url)
assert response.status_code == 200

assert response.context_data["topics_public"].get() == topic
assert response.context_data["forums_category"].get() == article


def test_new_topics_order(client, db):
topic1 = TopicFactory(with_post=True, forum=ForumFactory())
topic2 = TopicFactory(with_post=True, forum=ForumFactory())
url = reverse("pages:home")

response = client.get(url)
assert response.status_code == 200
assert list(response.context_data["topics_public"]) == [topic2, topic1]

PostFactory(topic=topic1)

response = client.get(url)
assert response.status_code == 200
assert list(response.context_data["topics_public"]) == [topic2, topic1]


def test_page_title_header_footer(db, client, snapshot):
response = client.get(reverse("pages:home"))
assert response.status_code == 200
Expand All @@ -67,7 +43,7 @@ def test_events(db, client):
visible_future_event = EventFactory.create_batch(4, date=timezone.now() + relativedelta(days=1))
unvisible_future_event = EventFactory(date=timezone.now() + relativedelta(days=1))
response = client.get(reverse("pages:home"))
assertContains(response, "Les évènements à venir", count=1)
assertContains(response, "Les prochains évènements", count=1)
assertNotContains(response, old_event.name)
for future_event in visible_future_event:
assertContains(response, future_event.name)
Expand Down
2 changes: 0 additions & 2 deletions lacommunaute/pages/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

from lacommunaute.event.models import Event
from lacommunaute.forum.models import Forum
from lacommunaute.forum_conversation.models import Topic


logger = logging.getLogger(__name__)
Expand All @@ -26,7 +25,6 @@ class HomeView(TemplateView):

def get_context_data(self, **kwargs: Any) -> dict[str, Any]:
context = super().get_context_data(**kwargs)
context["topics_public"] = Topic.objects.filter(approved=True).order_by("-created")[:4]
context["forums_category"] = Forum.objects.filter(parent__type=1).order_by("-updated")[:4]
context["forum"] = Forum.objects.get_main_forum()
context["upcoming_events"] = Event.objects.filter(date__gte=timezone.now()).order_by("date")[:4]
Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion lacommunaute/templates/event/partials/event_date.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% load i18n %}
{% if event.date == event.end_date %}
{% blocktrans trimmed with date=event.date time=event.time end_time=event.end_time %}
On {{ date }} from {{ time }} to {{ end_time }}
{{ date }}, {{ time }} to {{ end_time }}
{% endblocktrans %}
{% else %}
{% blocktrans trimmed with date=event.date end_date=event.end_date time=event.time end_time=event.end_time %}
Expand Down
79 changes: 32 additions & 47 deletions lacommunaute/templates/pages/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
{% url 'forum_extension:documentation' as documentation_url %}
{% url 'event:current' as event_url %}
{% url 'surveys:dsp_create' as dsp_url %}
<section class="s-home-title-01 s-home-title-01--communaute mb-md-6 mb-lg-10" style="--home-title-bg: url({% static 'images/commu-home-illu-02-light.png' %})">
<section class="s-home-title-01 s-home-title-01--communaute mb-md-6 mb-lg-10" style="--home-title-bg: url({% static 'images/commu-home-illu-02b-light.png' %})">
<div class="s-home-title-01__container container container-max-lg">
<div class="s-home-title-01__row row">
<div class="s-home-title-01__col col-12 col-md-8 col-lg-7 mb-4">
Expand Down Expand Up @@ -50,21 +50,23 @@ <h1 class="h1-hero">L’espace d’entraide des professionnels de l’inclusion<
<div class="s-home-title-01__row row">
<div class="s-home-title-01__col col-12 mt-md-6 mt-lg-6">
<div class="s-home-title-01__btn-group flex-column flex-md-row gap-3 gap-md-4 mb-md-n5 mb-lg-n8">
<div class="s-home-title-01__btn flex-grow-1 p-3 py-md-4">
<div class="w-25 w-md-40">
<img src="{% static 'images/home-title-01-illu-card-01.png' %}" class="img-fluid" alt="">
</div>
<div class="ps-3">
<a href="{% url 'forum_conversation:topic_create' forum.slug forum.pk %}"
rel="nofollow"
data-matomo-category="engagement"
data-matomo-action="contribute"
data-matomo-option="new_topic"
class="btn-link stretched-link matomo-event">Je veux poser
<br class="d-none d-md-inline">
une question</a>
{% if forum %}
<div class="s-home-title-01__btn flex-grow-1 p-3 py-md-4">
<div class="w-25 w-md-40">
<img src="{% static 'images/home-title-01-illu-card-01.png' %}" class="img-fluid" alt="">
</div>
<div class="ps-3">
<a href="{% url 'forum_conversation:topic_create' forum.slug forum.pk %}"
rel="nofollow"
data-matomo-category="engagement"
data-matomo-action="contribute"
data-matomo-option="new_topic"
class="btn-link stretched-link matomo-event">Je veux poser
<br class="d-none d-md-inline">
une question</a>
</div>
</div>
</div>
{% endif %}
<div class="s-home-title-01__btn flex-grow-1 p-3 py-md-4">
<div class="w-25 w-md-40">
<img src="{% static 'images/home-title-01-illu-card-02.png' %}" class="img-fluid" alt="">
Expand Down Expand Up @@ -131,11 +133,7 @@ <h1 class="h1-hero">L’espace d’entraide des professionnels de l’inclusion<
<img src="{% static 'images/home-illu-01.png' %}" class="img-fluid" loading="lazy" alt="">
</div>
<div class="s-section__col col-12 col-md-8">
<p class="h1 text-tertiary">
Les dernières mises à jour
<br class="d-none d-lg-inline">
des fiches pratiques
</p>
<p class="h1 text-tertiary">Les fiches pratiques mises à jour</p>
<ul class="list-group list-group-flush list-group-link mb-3 mb-md-4">
{% for forum in forums_category %}
<li class="list-group-item list-group-item-action">
Expand All @@ -162,46 +160,33 @@ <h1 class="h1-hero">L’espace d’entraide des professionnels de l’inclusion<
</div>
</div>
</section>
{% comment %}<section class="s-section my-5 my-md-10">
<section class="s-section my-5 my-md-10">
<div class="s-section__container container container-max-lg">
<div class="s-section__row row">
<div class="s-section__col col-12">
<div class="d-flex flex-column flex-md-row align-items-md-center justify-content-md-between mb-3 mb-md-4">
<span class="h1 mb-md-0 text-tertiary">Les dernières actualités</span>
<span class="h1 mb-md-0 text-tertiary">Les prochains évènements</span>
<div>
<a href="" class="btn btn-outline-primary">Toutes les actualités</a>
<a href="{{ event_url }}" class="btn btn-outline-primary matomo-event" data-matomo-category="engagement" data-matomo-action="view" data-matomo-option="events">Tous les évènements</a>
</div>
</div>
<ul class="list-group list-group-flush list-group-horizontal-md list-group-link mt-3 mt-md-4">
<li class="list-group-item list-group-item-action">
<div>
<div class="tag-group mb-1">
<span class="tag tag-lg bg-info-lighter text-info text-uppercase">Parcours CIP</span>
</div>
<a href="" class="text-decoration-none stretched-link">La veille informationnelle consiste à la mise en place d'un système d'information permettant de collecter, de traiter et de diffusers.</a>
</div>
</li>
<li class="list-group-item list-group-item-action">
<div>
<div class="tag-group mb-1">
<span class="tag tag-lg bg-info-lighter text-info text-uppercase">Parcours CIP</span>
</div>
<a href="" class="text-decoration-none stretched-link">La veille informationnelle consiste à la mise en place d'un système d'information permettant de collecter, de traiter et de diffusers.</a>
</div>
</li>
<li class="list-group-item list-group-item-action">
<div>
<div class="tag-group mb-1">
<span class="tag tag-lg bg-info-lighter text-info text-uppercase">Parcours CIP</span>
{% for event in upcoming_events %}
<li class="list-group-item list-group-item-action">
<div>
<small class="text-muted">{% include 'event/partials/event_date.html' with event=event only %}</small>
<br>
<a href="{% url 'event:detail' event.pk %}" class="text-decoration-none stretched-link matomo-event" data-matomo-category="engagement" data-matomo-action="view" data-matomo-option="event">{{ event.name }}</a>
</div>
<a href="" class="text-decoration-none stretched-link">La veille informationnelle consiste à la mise en place d'un système d'information permettant de collecter, de traiter et de diffusers.</a>
</div>
</li>
</li>
{% empty %}
No event yet …
{% endfor %}
</ul>
</div>
</div>
</div>
</section>{% endcomment %}
</section>
{% comment %}<section class="s-section my-5 my-md-9">
<div class="s-section__container container container-max-lg">
<div class="s-section__row row align-items-center">
Expand Down
Binary file modified locale/fr/LC_MESSAGES/django.mo
Binary file not shown.
4 changes: 4 additions & 0 deletions locale/fr/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,10 @@ msgstr "Les évènements du mois"
msgid "On %(date)s from %(time)s to %(end_time)s"
msgstr "Le %(date)s de %(time)s à %(end_time)s"

#, python-format
msgid "%(date)s, %(time)s to %(end_time)s"
msgstr "%(date)s, %(time)s à %(end_time)s"

#, python-format
msgid "From %(date)s %(time)s to %(end_date)s %(end_time)s"
msgstr "Du %(date)s %(time)s au %(end_date)s %(end_time)s"
Expand Down

0 comments on commit 2a50af6

Please sign in to comment.