Skip to content

Commit

Permalink
[Semi-rollback] Retrait de la gestion des pictos en mode sombre (#235)
Browse files Browse the repository at this point in the history
* Revert changes to scheme-dependent SVGs

* update test

* Update version number
  • Loading branch information
Ash-Crow authored Nov 5, 2024
1 parent 33f1e8f commit e4d0541
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ def show_toolbar(request):
)

WAGTAILIMAGES_EXTENSIONS = ["gif", "jpg", "jpeg", "png", "webp", "svg"]
SF_SCHEME_DEPENDENT_SVGS = True if os.getenv("SF_SCHEME_DEPENDENT_SVGS", False) == "True" else False

# Allows for complex Streamfields without completely removing checks
DATA_UPLOAD_MAX_NUMBER_FIELDS = 10000
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{% load wagtailimages_tags %}
{% load wagtailimages_tags wagtail_dsfr_tags %}

{% image value.image original as artwork %}
{% settings_value "SF_SCHEME_DEPENDENT_SVGS" as scheme_dependent_svgs %}

{% if artwork.file.name|slice:"-4:" == ".svg" %}
{% if scheme_dependent_svgs and artwork.file.name|slice:"-4:" == ".svg" %}
<div class="fr-responsive-img">
<svg aria-hidden="true" class="fr-artwork" viewBox="0 0 80 80">
<use class="fr-artwork-decorative" href="{{ artwork.full_url }}#artwork-decorative"></use>
Expand Down
3 changes: 2 additions & 1 deletion content_manager/templates/content_manager/blocks/tile.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@
{% if value.image %}
<div class="fr-tile__header">
{% image value.image original as pictogram %}
{% settings_value "SF_SCHEME_DEPENDENT_SVGS" as scheme_dependent_svgs %}

{% if pictogram.file.name|slice:"-4:" == ".svg" %}
{% if scheme_dependent_svgs and pictogram.file.name|slice:"-4:" == ".svg" %}
<div class="fr-tile__pictogram">
<svg aria-hidden="true"
class="fr-artwork"
Expand Down
4 changes: 3 additions & 1 deletion content_manager/tests/test_blocks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.contrib.auth.models import User
from django.test import override_settings
from wagtail.models import Page
from wagtail.rich_text import RichText
from wagtail.test.utils import WagtailPageTestCase
Expand Down Expand Up @@ -322,7 +323,8 @@ def test_tile_with_image_has_div(self):

self.assertContains(response, "fr-tile__header")

def test_tile_manages_svg_image(self):
@override_settings(SF_SCHEME_DEPENDENT_SVGS=True)
def test_tile_manages_svg_image_if_setting_allows(self):
image_file = "static/artwork/technical-error.svg"
image = import_image(image_file, "Sample image")

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "content-manager"
version = "1.10.1"
version = "1.10.2"
description = "Gestionnaire de contenu permettant de créer et gérer un site internet basé sur le Système de design de l’État, accessible et responsive"
authors = [
"Sébastien Reuiller <[email protected]>",
Expand Down

0 comments on commit e4d0541

Please sign in to comment.