Skip to content

Commit

Permalink
Merge pull request #54 from numerique-gouv/cards-bugfix
Browse files Browse the repository at this point in the history
[Bugfix] Réparation des cartes et du title du site
  • Loading branch information
Ash-Crow authored Nov 23, 2023
2 parents 89021ba + c873921 commit ee9d09a
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 4 deletions.
21 changes: 21 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## 🎯 Objectif

_Un résumé de l’objectif de la PR_

_Précisez si c’est un bugfix, une nouvelle fonctionnalité… Expliquez rapidement le gain « fonctionnel » de vos modifications._

## 🔍 Implémentation

- _Une liste des modifications_

## ⚠️ Informations supplémentaires

_(optionnel) Documentation, commandes à lancer, variables d’environnement, etc._

## 🏕 Amélioration continue

- _(optionnel) Une liste d’autres modifications pas en lien direct avec la PR_

## 🖼️ Images

_(optionnel) Une ou plusieurs captures d’écran, si pertinent_
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,4 @@ dmypy.json

# VSCode
.VSCode
.vscode/
1 change: 0 additions & 1 deletion config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@
"django.template.context_processors.request",
"django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages",
"dsfr.context_processors.site_config",
"wagtail.contrib.settings.context_processors.settings",
"wagtailmenus.context_processors.wagtailmenus",
],
Expand Down
2 changes: 1 addition & 1 deletion content_manager/templates/content_manager/blocks/card.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ <h3 class="fr-card__title">
{{ block.value.title }}
{% if block.value.url or block.value.document.url %}</a>{% endif %}
</h3>
<p class="fr-card__desc">{{ block.value.text|linebreaksbr }}</p>
<p class="fr-card__desc">{{ block.value.description|linebreaksbr }}</p>
</div>
</div>
<div class="fr-card__header">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends 'base.html' %}
{% load static dsfr_tags wagtailcore_tags wagtailimages_tags %}
{% block title %}
<title>{{ page.seo_title|default:page.title }} — {{ SITE_CONFIG.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 %}
Expand Down
Empty file.
33 changes: 33 additions & 0 deletions content_manager/tests/test_views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from django.contrib.auth.models import User
from wagtail.models import Page
from wagtail.test.utils import WagtailPageTestCase

from content_manager.models import ContentPage


class ContentPageTestCase(WagtailPageTestCase):
def setUp(self):
home = Page.objects.get(slug="home")
self.user = User.objects.create_superuser("test", "test@test.test", "pass")
self.user.save()
self.content_page = home.add_child(
instance=ContentPage(
title="Page de contenu",
slug="content-page",
owner=self.user,
)
)
self.content_page.save()

def test_content_page_is_renderable(self):
self.assertPageIsRenderable(self.content_page)

def test_content_page_has_minimal_content(self):
url = self.content_page.url
response = self.client.get(url)
self.assertEqual(response.status_code, 200)

self.assertContains(
response,
"<title>Page de contenu — Titre du site</title>",
)
2 changes: 1 addition & 1 deletion templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{% dsfr_favicon %}
{% block extra_css %}{% endblock extra_css %}

{% block title %}<title>{% if title %}{{ title }} — {{ SITE_CONFIG.site_title }}{% else %}{{ SITE_CONFIG.site_title }}{% endif %}</title>{% endblock title %}
{% block title %}<title>{% if title %}{{ title }} — {% endif %}{{ settings.content_manager.CmsDsfrConfig.site_title }}</title>{% endblock title %}
{% block tracking %}
{% if settings.content_manager.AnalyticsSettings.head_scripts %}
{{settings.content_manager.AnalyticsSettings.head_scripts|safe}}
Expand Down

0 comments on commit ee9d09a

Please sign in to comment.