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

Activation par défaut du composant "bloc HTML" #144

Merged
merged 2 commits into from
Jun 4, 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
3 changes: 0 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,3 @@ S3_BUCKET_NAME=
S3_BUCKET_REGION=eu-west-3
# S3_LOCATION: If the S3 bucket is shared, add a unique folder name
S3_LOCATION=

# SF_ALLOW_RAW_HTML_BLOCKS: devs who create migrations should put this variable to True
SF_ALLOW_RAW_HTML_BLOCKS=False
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ collectstatic:

.PHONY: messages
messages:
$(EXEC_CMD) poetry run django-admin makemessages -l fr --ignore=manage.py --ignore=medias --ignore=setup.py --ignore=staticfiles --ignore=templates
$(EXEC_CMD) poetry run django-admin makemessages -l fr --ignore=manage.py --ignore=config --ignore=medias --ignore=__init__.py --ignore=setup.py --ignore=staticfiles

.PHONY: sass
sass:
Expand Down
Binary file modified blog/locale/fr/LC_MESSAGES/django.mo
Binary file not shown.
34 changes: 20 additions & 14 deletions blog/locale/fr/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-04-24 16:31+0200\n"
"PO-Revision-Date: 2024-04-24 17:04+0200\n"
"POT-Creation-Date: 2024-06-04 15:08+0200\n"
"PO-Revision-Date: 2024-06-04 15:17+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"X-Generator: Poedit 3.4\n"
"X-Generator: Poedit 3.4.2\n"

#: blog/blocks.py:9 blog/models.py:290
msgid "Name"
Expand Down Expand Up @@ -50,15 +50,17 @@ msgstr "Articles par page"
msgid "Blog index"
msgstr "Index de blog"

#: blog/models.py:74 blog/views.py:149
#: blog/models.py:74 blog/templates/blog/tags_list_page.html:20
#: blog/views.py:149
msgid "Tags"
msgstr "Étiquettes"

#: blog/models.py:97 blog/models.py:170 blog/models.py:265 blog/views.py:117
#: blog/models.py:97 blog/models.py:170 blog/models.py:265
#: blog/templates/blog/categories_list_page.html:20 blog/views.py:117
msgid "Categories"
msgstr "Catégories"

#: blog/models.py:109
#: blog/models.py:109 blog/templates/blog/blog_index_page.html:59
msgid "Posts written by"
msgstr "Articles écrits par"

Expand Down Expand Up @@ -118,20 +120,24 @@ msgstr "Catégorie"
msgid "Person"
msgstr "Personne"

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

#: blog/templates/blog/blog_index_page.html:52
#, python-format
#~ msgid "Posts in category %(category)s"
#~ msgstr "Articles dans la catégorie %(category)s"
msgid "Posts in category %(category)s"
msgstr "Articles dans la catégorie %(category)s"

#: blog/templates/blog/blog_index_page.html:56
#, python-format
#~ msgid "Posts tagged with %(tag)s"
#~ msgstr "Articles avec l’étiquette %(tag)s"
msgid "Posts tagged with %(tag)s"
msgstr "Articles avec l’étiquette %(tag)s"

#: blog/templates/blog/blog_index_page.html:61
#, python-format
#~ msgid "Posts published in %(year)s"
#~ msgstr "Articles publiés en %(year)s"
msgid "Posts published in %(year)s"
msgstr "Articles publiés en %(year)s"

#~ msgid "Colophon"
#~ msgstr "Colophon"
Expand Down
2 changes: 1 addition & 1 deletion blog/templates/blog/blog_entry_page.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends "base.html" %}

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

{% block title %}
<title>{{ page.seo_title|default:page.title }} — {{ settings.content_manager.CmsDsfrConfig.site_title }}</title>
Expand Down
2 changes: 0 additions & 2 deletions config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,5 +288,3 @@
CSRF_TRUSTED_ORIGINS = []
for host in ALLOWED_HOSTS:
CSRF_TRUSTED_ORIGINS.append("https://" + host)

SF_ALLOW_RAW_HTML_BLOCKS = os.getenv("SF_ALLOW_RAW_HTML_BLOCKS", "False").lower() == "true"
4 changes: 0 additions & 4 deletions config/settings_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
from config.settings import * # NOSONAR # noqa: F401,F403


# Needed so that the conf is the same as the one where the blocks were generated
SF_ALLOW_RAW_HTML_BLOCKS = True
25 changes: 11 additions & 14 deletions content_manager/blocks.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from django import forms
from django.conf import settings
from django.utils.functional import cached_property
from django.utils.translation import gettext_lazy as _, pgettext_lazy
from dsfr.constants import COLOR_CHOICES, COLOR_CHOICES_ILLUSTRATION, COLOR_CHOICES_SYSTEM, IMAGE_RATIOS, VIDEO_RATIOS
Expand Down Expand Up @@ -753,20 +752,18 @@ class Meta:
("fullwidthbackground", FullWidthBackgroundBlock(label=_("Full width background"), group=_("Page structure"))),
]


# See warning on https://docs.wagtail.org/en/latest/reference/streamfield/blocks.html#wagtail.blocks.RawHTMLBlock
# There is currently no way to restrict a type of block depending on user permissions,
# pending issue https://github.com/wagtail/wagtail/issues/6323
if settings.SF_ALLOW_RAW_HTML_BLOCKS is True:
STREAMFIELD_COMMON_BLOCKS += [
(
"html",
blocks.RawHTMLBlock(
readonly=True,
help_text=_(
"Warning: Use HTML block with caution. Malicious code can compromise the security of the site."
),
group=_("Expert syntax"),
STREAMFIELD_COMMON_BLOCKS += [
(
"html",
blocks.RawHTMLBlock(
readonly=True,
help_text=_(
"Warning: Use HTML block with caution. Malicious code can compromise the security of the site."
),
)
]
group=_("Expert syntax"),
),
)
]
Binary file modified content_manager/locale/fr/LC_MESSAGES/django.mo
Binary file not shown.
Loading
Loading