Skip to content

Commit

Permalink
Merge branch 'main' into access
Browse files Browse the repository at this point in the history
  • Loading branch information
LucienMLD authored Jan 17, 2025
2 parents 1e6d6d9 + 4715137 commit a9a8de3
Show file tree
Hide file tree
Showing 10 changed files with 5,976 additions and 102 deletions.
7 changes: 1 addition & 6 deletions blog/locale/fr/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -99,22 +99,17 @@ msgstr "Filtrer par catégorie"
msgid "Filter by tag"
msgstr "Filtrer par étiquette"

#: blog/models.py:207 blog/templates/blog/blog_index_page.html:111
#: blog/models.py:205 blog/templates/blog/blog_index_page.html:111
#: blog/models.py:213 blog/templates/blog/blog_index_page.html:119
msgid "Filter by author"
msgstr "Filtrer par auteur"

#: blog/models.py:209 blog/templates/blog/blog_index_page.html:126
#: blog/models.py:207 blog/templates/blog/blog_index_page.html:126
#: blog/models.py:215 blog/templates/blog/blog_index_page.html:134
msgid "Filter by source"
msgstr "Filtrer par source"

#: blog/models.py:215
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:228
msgid "Show filters"
Expand Down
1,892 changes: 1,892 additions & 0 deletions blog/migrations/0055_alter_blogindexpage_body.py

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions blog/migrations/0056_merge_20241220_1543.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Generated by Django 5.0.9 on 2024-12-20 14:43

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
("blog", "0041_alter_blogentrypage_body_alter_blogindexpage_body_and_more"),
("blog", "0055_alter_blogindexpage_body"),
]

operations = []
3,978 changes: 3,978 additions & 0 deletions blog/migrations/0057_alter_blogentrypage_body_alter_blogindexpage_body.py

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions blog/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,12 @@ class BlogIndexPage(RoutablePageMixin, SitesFacilesBasePage):

subpage_types = ["blog.BlogEntryPage"]

body = StreamField(
STREAMFIELD_COMMON_BLOCKS + STREAMFIELD_NUMERIQUE_BLOCKS,
blank=True,
use_json_field=True,
)

class Meta:
verbose_name = _("Blog index")

Expand Down
18 changes: 17 additions & 1 deletion numerique_gouv/models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
from django.db import models
from django.db.models import Case, IntegerField, QuerySet, Value, When
from django.shortcuts import get_object_or_404, redirect
Expand Down Expand Up @@ -26,6 +27,7 @@ class NumeriquePage(NumeriqueBasePage):
"numerique_gouv.ProductsIndexPage",
"numerique_gouv.NumeriqueEventsIndexPage",
"numerique_gouv.SitemapPage",
"content_manager.CatalogIndexPage",
]

class Meta:
Expand Down Expand Up @@ -497,7 +499,21 @@ def get_context(self, request, page_tag=None, major_area=None, organization=None
if year:
posts = posts.filter(date__year=year)

context["posts"] = posts.order_by("-date")
posts = posts.order_by("-date")

# Pagination
page = request.GET.get("page")
page_size = self.posts_per_page

paginator = Paginator(posts, page_size) # Show <page_size> posts per page
try:
posts = paginator.page(page)
except PageNotAnInteger:
posts = paginator.page(1)
except EmptyPage:
posts = paginator.page(paginator.num_pages)

context["posts"] = posts
context["current_page_tag"] = page_tag
context["current_major_area"] = major_area
context["current_organization"] = organization
Expand Down
7 changes: 6 additions & 1 deletion numerique_gouv/templates/numerique_gouv/blog_entry_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ <h1>
<img class="ng-image-max-100" src="{{ header_image.full_url }}" alt=""/>
{% endif %}
</div>
<h1 class="fr-my-2w">{{ page.title }}</h1>
{% if not page.header_with_title %}
<h1>
{{ page.title }}
{% include "content_manager/blocks/page_visibility.html" %}
</h1>
{% endif %}
<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 organizations %}
Expand Down
5 changes: 3 additions & 2 deletions numerique_gouv/templates/numerique_gouv/blog_index_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ <h1>

{% if current_category.description %}
{{ current_category.description|richtext }}
{% else %}
{{ page.body }}
{% endif %}


{% if page.show_filters %}
<div class="fr-grid-row fr-grid-row--gutters fr-mb-3w">
<div class="fr-col fr-col-md-4 fr-col-12">
Expand Down Expand Up @@ -114,5 +113,7 @@ <h3 class="fr-text--lg">{% translate "Filter organization" %}</h3>
{% include "blog/blocks/feeds.html" %}
{% endif %}
</div>

{{ page.body }}
{% endblock content %}

92 changes: 1 addition & 91 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 59 additions & 1 deletion static/css/style.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a9a8de3

Please sign in to comment.