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

Gestion d’un système d’agenda / calendrier #191

Merged
merged 8 commits into from
Jul 24, 2024
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
Binary file modified blog/locale/fr/LC_MESSAGES/django.mo
Binary file not shown.
11 changes: 6 additions & 5 deletions blog/locale/fr/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-07-11 17:35+0200\n"
"PO-Revision-Date: 2024-07-11 17:36+0200\n"
"POT-Creation-Date: 2024-07-24 18:07+0200\n"
"PO-Revision-Date: 2024-07-22 18:54+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: fr\n"
Expand Down Expand Up @@ -64,7 +64,8 @@ msgstr "Filtrer par source"

#: blog/models.py:44
msgid "The source is the organization of the post author"
msgstr "La source est l’organisation à laquelle appartient l’auteur de l’article"
msgstr ""
"La source est l’organisation à laquelle appartient l’auteur de l’article"

#: blog/models.py:56
msgid "Show filters"
Expand Down Expand Up @@ -159,11 +160,11 @@ msgstr "Catégorie"
msgid "Person"
msgstr "Personne"

#: blog/templates/blog/blocks/blog_index_posts_list.html:36
#: blog/templates/blog/blocks/blog_index_posts_list.html:37
msgid "No article found."
msgstr "Aucun article trouvé."

#: blog/templates/blog/blog_entry_page.html:75
#: blog/templates/blog/blog_entry_page.html:74
msgid "Posted by:"
msgstr "Écrit par :"

Expand Down
21,362 changes: 21,362 additions & 0 deletions blog/migrations/0029_alter_blogentrypage_body_alter_blogindexpage_body_and_more.py

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions blog/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ def get_context(self, request, tag=None, category=None, author=None, source=None
posts = self.posts
locale = Locale.objects.get(language_code=get_language())

breadcrumb = None
extra_breadcrumbs = None
extra_title = ""

if tag is None:
tag = request.GET.get("tag")
if tag:
tag = get_object_or_404(Tag, slug=tag)
posts = posts.filter(tags=tag)
breadcrumb = {
extra_breadcrumbs = {
"links": [
{"url": self.get_url(), "title": self.title},
{
Expand All @@ -102,7 +102,7 @@ def get_context(self, request, tag=None, category=None, author=None, source=None
category = get_object_or_404(Category, slug=category, locale=locale)
posts = posts.filter(blog_categories=category)

breadcrumb = {
extra_breadcrumbs = {
"links": [
{"url": self.get_url(), "title": self.title},
{
Expand All @@ -119,7 +119,7 @@ def get_context(self, request, tag=None, category=None, author=None, source=None
if source:
source = get_object_or_404(Organization, slug=source)
posts = posts.filter(authors__organization=source)
breadcrumb = {
extra_breadcrumbs = {
"links": [
{"url": self.get_url(), "title": self.title},
],
Expand All @@ -132,7 +132,7 @@ def get_context(self, request, tag=None, category=None, author=None, source=None
if author:
author = get_object_or_404(Person, id=author)

breadcrumb = {
extra_breadcrumbs = {
"links": [
{"url": self.get_url(), "title": self.title},
],
Expand Down Expand Up @@ -172,8 +172,8 @@ def get_context(self, request, tag=None, category=None, author=None, source=None
context["sources"] = self.get_sources()
context["tags"] = self.get_tags()

if breadcrumb:
context["breadcrumb"] = breadcrumb
if extra_breadcrumbs:
context["extra_breadcrumbs"] = extra_breadcrumbs

return context

Expand Down
4 changes: 3 additions & 1 deletion blog/templates/blog/blocks/blog_index_posts_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,7 @@ <h2 class="fr-card__title">
</div>
</div>
{% empty %}
<p>{% translate "No article found." %}</p>
<div class="fr-col">
<p>{% translate "No article found." %}</p>
</div>
{% endfor %}
45 changes: 22 additions & 23 deletions blog/templates/blog/blocks/contact_card.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,29 @@
{# Uses value instead of block.value because it is also used #}
{# to display Person items #}
<div class="fr-container fr-my-3w">
<div class="fr-grid-row fr-grid-row--gutters">
<div class="fr-card fr-card--horizontal fr-col-12 fr-col-md-6">
<div class="fr-card__body">
<div class="fr-card__content">
<h3 class="fr-card__title">{{ value.name }}</h3>
<p class="fr-card__desc">{{ value.role }} – {{ value.organization }}</p>
{% if value.contact_info %}
<div class="fr-card__end">
<p class="fr-card__detail">{{ value.contact_info }}</p>
</div>
{% endif %}
</div>
</div>
<div class="cmsfr-author_card__header fr-card__header">
<div class="fr-card__img">
{% image value.image fill-200x200 as contact_image %}
<img class="fr-responsive-img cmsfr-author-img"
src="{{ contact_image.url }}"
width="4.5em"
height="4.5em"
alt="" />
</div>
<div class="fr-grid-row fr-grid-row--gutters">
<div class="fr-card fr-card--horizontal fr-col-12 fr-col-md-6">
<div class="fr-card__body">
<div class="fr-card__content">
<h3 class="fr-card__title">{{ value.name }}</h3>
<p class="fr-card__desc">{{ value.role }} – {{ value.organization }}</p>
{% if value.contact_info %}
<div class="fr-card__end">
<p class="fr-card__detail">{{ value.contact_info }}</p>
</div>
{% endif %}
</div>
</div>
<div class="cmsfr-author_card__header fr-card__header">
<div class="fr-card__img">
{% image value.image fill-200x200 as contact_image %}
<img class="fr-responsive-img cmsfr-author-img"
src="{{ contact_image.url }}"
width="4.5em"
height="4.5em"
alt="" />
</div>

</div>
</div>
</div>
</div>
159 changes: 79 additions & 80 deletions blog/templates/blog/blog_entry_page.html
Original file line number Diff line number Diff line change
@@ -1,101 +1,100 @@
{% extends "base.html" %}

{% load i18n static dsfr_tags wagtailcore_tags wagtailimages_tags %}
{% load i18n static dsfr_tags wagtailcore_tags wagtailimages_tags wagtail_dsfr_tags %}

{% block title %}
<title>{{ page.seo_title|default:page.title }} — {{ settings.content_manager.CmsDsfrConfig.site_title }}</title>
<title>{{ page.seo_title|default:page.title }} — {{ settings.content_manager.CmsDsfrConfig.site_title }}</title>
{% endblock title %}

{% if page.search_description %}
{% block description %}
<meta name="description" content="{{ page.search_description }}" />
{% endblock description %}
{% block description %}
<meta name="description" content="{{ page.search_description }}" />
{% endblock description %}
{% endif %}

{% block social_media %}
<meta property="og:site_name" content="{{ request.get_host }}" />
<meta property="og:title"
content="{% if page.seo_title %}{{ page.seo_title }}{% else %}{{ page.title }}{% endif %}" />
<meta property="og:type" content="article" />
<meta property="og:url" content="{{ page.full_url }}" />
<meta property="og:description" content="{{ page.search_description }}" />
<meta property="og:locale" content="{{ LANGUAGE_CODE }}" />

{% if page.get_translations.live %}
{% for translation in page.get_translations.live %}
<meta property="og:locale:alternate"
content="{{ translation.locale.language_code }}" />
{% endfor %}
{% endif %}

<meta name="twitter:title"
content="{% if page.seo_title %}{{ page.seo_title }}{% else %}{{ page.title }}{% endif %}" />
<meta name="twitter:description" content="{{ page.search_description }}" />

{% if page.header_image %}
<meta name="twitter:card" content="summary_large_image" />
{% image page.header_image fill-1200x627 as header_image %}
<meta property="og:image" content="{{ header_image.full_url }}" />
<meta name="twitter:image" content="{{ header_image.full_url }}" />
{% else %}
<meta name="twitter:card" content="summary" />
{% endif %}
<meta property="og:site_name" content="{{ request.get_host }}" />
<meta property="og:title"
content="{% if page.seo_title %}{{ page.seo_title }}{% else %}{{ page.title }}{% endif %}" />
<meta property="og:type" content="article" />
<meta property="og:url" content="{{ page.full_url }}" />
<meta property="og:description" content="{{ page.search_description }}" />
<meta property="og:locale" content="{{ LANGUAGE_CODE }}" />

{% if page.get_translations.live %}
{% for translation in page.get_translations.live %}
<meta property="og:locale:alternate"
content="{{ translation.locale.language_code }}" />
{% endfor %}
{% endif %}

<meta name="twitter:title"
content="{% if page.seo_title %}{{ page.seo_title }}{% else %}{{ page.title }}{% endif %}" />
<meta name="twitter:description" content="{{ page.search_description }}" />

{% if page.header_image %}
<meta name="twitter:card" content="summary_large_image" />
{% image page.header_image fill-1200x627 as header_image %}
<meta property="og:image" content="{{ header_image.full_url }}" />
<meta name="twitter:image" content="{{ header_image.full_url }}" />
{% else %}
<meta name="twitter:card" content="summary" />
{% endif %}
{% endblock social_media %}

{% block content %}
{% include "content_manager/blocks/heading.html" %}
{% include "content_manager/blocks/messages.html" %}

{% with categories=page.blog_categories.all %}

<div class="fr-container fr-mt-6w">
<div class="fr-grid-row fr-grid-row--gutters">
<div class="fr-col-12">
{% include "content_manager/blocks/breadcrumbs.html" %}
<h1 class="fr-display--sm">{{ page.title }}</h1>
</div>
</div>
<p>
Publié le <a href="{% url 'blog:archive_year' page.get_parent.slug page.date.year %}">{{ page.date |date:'l j F Y' }}</a>
{% if categories %}
|
{% for category in categories %}
<a href="{% url 'blog:category' page.get_parent.slug category.slug %}">{{ category.name }}</a>
{% if not forloop.last %},{% endif %}
{% endfor %}
{% endif %}
</p>
{% include "content_manager/blocks/heading.html" %}
{% include "content_manager/blocks/messages.html" %}

{% with categories=page.blog_categories.all %}
<div class="fr-container fr-mt-6w">
<div class="fr-grid-row fr-grid-row--gutters">
<div class="fr-col-12">
{% include "content_manager/blocks/breadcrumbs.html" %}
<h1 class="fr-display--sm">{{ page.title }}</h1>
</div>
</div>
<p>
Publié le <a href="{% pageurl page.get_parent %}{% toggle_url_filter year=page.date.year %}">{{ page.date |date:'l j F Y' }}</a>
{% if categories %}
|
{% for category in categories %}
<a href="{% pageurl page.get_parent %}{% toggle_url_filter category=category %}">{{ category.name }}</a>
{% if not forloop.last %},{% endif %}
{% endfor %}
{% endif %}
</p>
</div>

{% include "content_manager/blocks/blocks_stream.html" with stream=page.body %}

{% with authors=page.authors.all %}
{% if authors %}
<div class="fr-container fr-my-6w">
<h2>{% translate "Posted by:" %}</h2>
<div class="fr-grid-row fr-grid-row--gutters">
{% for author in authors %}
{% include "blog/blocks/contact_card.html" with value=author %}
{% endfor %}
</div>
</div>

{% endif %}
{% endwith %}
{% include "content_manager/blocks/blocks_stream.html" with stream=page.body %}

{% if categories %}
{% for category in categories %}
{% include "content_manager/blocks/blocks_stream.html" with stream=category.colophon %}
{% with authors=page.authors.all %}
{% if authors %}
<div class="fr-container fr-my-6w">
<h2>{% translate "Posted by:" %}</h2>
<div class="fr-grid-row fr-grid-row--gutters">
{% for author in authors %}
{% include "blog/blocks/contact_card.html" with value=author %}
{% endfor %}
{% endif %}
</div>
</div>

{% endif %}
{% endwith %}

<div class="fr-container fr-my-6w">
{% for tag in page.tags.all|dictsort:"slug" %}
<a class="fr-tag"
target="_self"
href="{% url 'blog:tag' page.get_parent.slug tag.slug %}">{{ tag }}</a>
{% endfor %}
</div>
{% if categories %}
{% for category in categories %}
{% include "content_manager/blocks/blocks_stream.html" with stream=category.colophon %}
{% endfor %}
{% endif %}
{% endwith %}

<div class="fr-container fr-my-6w">
{% for tag in page.tags.all|dictsort:"slug" %}
<a class="fr-tag"
target="_self"
href="{% pageurl page.get_parent %}{% toggle_url_filter tag=tag %}">{{ tag }}</a>
{% endfor %}
</div>

{% endblock content %}
12 changes: 6 additions & 6 deletions blog/templates/blog/blog_index_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,12 @@ <h2 class="fr-h6">{% translate "Filter by source" %}</h2>
<div class="fr-container fr-grid-row fr-grid-row--center fr-mt-6w">{% dsfr_pagination posts %}</div>
{% endif %}
</div>
{% else %}
<div class="fr-grid-row fr-grid-row--gutters">{% include "blog/blocks/blog_index_posts_list.html" %}</div>
{% if posts.paginator.num_pages > 1 %}
<div class="fr-container fr-grid-row fr-grid-row--center fr-mt-6w">{% dsfr_pagination posts %}</div>
{% endif %}
</div>
{% else %}
<div class="fr-grid-row fr-grid-row--gutters">{% include "blog/blocks/blog_index_posts_list.html" %}</div>
{% if posts.paginator.num_pages > 1 %}
<div class="fr-container fr-grid-row fr-grid-row--center fr-mt-6w">{% dsfr_pagination posts %}</div>
{% endif %}
</div>
{% endif %}
</div>
{% endblock content %}
32 changes: 16 additions & 16 deletions blog/templates/blog/categories_list_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,28 @@
{% load static dsfr_tags wagtailcore_tags wagtailimages_tags i18n %}

{% block title %}
<title>{{ page.seo_title|default:page.title }} — {{ settings.content_manager.CmsDsfrConfig.site_title }}</title>
<title>{{ page.seo_title|default:page.title }} — {{ settings.content_manager.CmsDsfrConfig.site_title }}</title>
{% endblock title %}

{% if page.search_description %}
{% block description %}
<meta name="description" content="{{ page.search_description }}" />
{% endblock description %}
{% block description %}
<meta name="description" content="{{ page.search_description }}" />
{% endblock description %}
{% endif %}

{% block content %}
{% include "content_manager/blocks/messages.html" %}
{% include "content_manager/blocks/messages.html" %}

<div class="fr-container fr-my-6w">
{% dsfr_breadcrumb breadcrumb %}
<h1>{% translate "Categories" %}</h1>
<ul>
{% for category in categories|dictsort:"cat_name" %}
<li>
<a href="{% url 'blog:category' page.slug category.cat_slug %}"><strong>{{ category.cat_name }}</strong> ({{ category.cat_count }})</a>
</li>
{% endfor %}
</ul>
</div>
<div class="fr-container fr-my-6w">
{% dsfr_breadcrumb breadcrumb %}
<h1>{% translate "Categories" %}</h1>
<ul>
{% for category in categories|dictsort:"cat_name" %}
<li>
<a href="{% pageurl page %}?category={{ category.cat_slug }}"><strong>{{ category.cat_name }}</strong> ({{ category.cat_count }})</a>
</li>
{% endfor %}
</ul>
</div>

{% endblock content %}
Loading
Loading