Skip to content

Commit

Permalink
Improve card and tile components
Browse files Browse the repository at this point in the history
  • Loading branch information
Ash-Crow committed Jun 17, 2024
1 parent 08108a7 commit 31ecf4e
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 25,171 deletions.
18,046 changes: 0 additions & 18,046 deletions blog/migrations/0017_alter_blogentrypage_body_alter_blogindexpage_body_and_more.py

This file was deleted.

12 changes: 12 additions & 0 deletions config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,18 @@
"debug_toolbar.middleware.DebugToolbarMiddleware",
]

# Don't show the toolbar on admin previews
def show_toolbar(request):
request.META["wsgi.multithread"] = True
request.META["wsgi.multiprocess"] = True
excluded_urls = ["/pages/preview/", "/pages/preview_loading/", "/edit/preview/"]
excluded = any(request.path.endswith(url) for url in excluded_urls)
return DEBUG and not excluded

DEBUG_TOOLBAR_CONFIG = {
"SHOW_TOOLBAR_CALLBACK": show_toolbar,
}

ROOT_URLCONF = "config.urls"

TEMPLATES = [
Expand Down
4 changes: 2 additions & 2 deletions content_manager/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ class CardBlock(blocks.StructBlock):
default="h3",
help_text=_("Adapt to the page layout. Defaults to heading 3."),
)
description = blocks.TextBlock(label=_("Content"), help_text=_("Can contain HTML."), required=False)
description = blocks.RichTextBlock(label=_("Content"), features=LIMITED_RICHTEXTFIELD_FEATURES, required=False)
image = ImageChooserBlock(label=_("Image"), required=False)
image_ratio = blocks.ChoiceBlock(
label=_("Image ratio"),
Expand Down Expand Up @@ -362,7 +362,7 @@ class TileBlock(blocks.StructBlock):
default="h3",
help_text=_("Adapt to the page layout. Defaults to heading 3."),
)
description = blocks.TextBlock(label=_("Content"), help_text=_("Can contain HTML."), required=False)
description = blocks.RichTextBlock(label=_("Content"), features=LIMITED_RICHTEXTFIELD_FEATURES, required=False)
image = ImageChooserBlock(label=_("Image"), help_text=_("Prefer SVG files."), required=False)
link = LinkWithoutLabelBlock(
label=_("Link"),
Expand Down
7,117 changes: 0 additions & 7,117 deletions content_manager/migrations/0033_alter_contentpage_body.py

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% load i18n wagtailimages_tags wagtailcore_tags dsfr_tags %}
{% load i18n wagtailimages_tags wagtailcore_tags dsfr_tags wagtail_dsfr_tags %}
<div class="fr-card fr-card--horizontal {% if value.image_ratio %}{{ value.image_ratio }}{% endif %} {% if value.enlarge_link %}fr-enlarge-link{% endif %} {% if value.grey_background %}fr-card--grey{% elif value.no_background %}fr-card--no-background{% endif %} {% if value.no_border %}fr-card--no-border{% endif %} {% if value.shadow %}fr-card--shadow{% endif %} {% if value.document or value.link.document %}fr-card--download{% endif %}">
<div class="fr-card__body">
<div class="fr-card__content">
Expand All @@ -20,7 +20,7 @@
{% endif %}
</{{ value.heading_tag | default:"h3" }}>
{# djlint: on #}
<p class="fr-card__desc">{{ value.description|safe }}</p>
{% if value.description %}{{ value.description | richtext_p_add_class:"fr-card__desc" }}{% endif %}
{% if value.top_detail_badges_tags or value.top_detail_text %}
<div class="fr-card__start">
{% if value.top_detail_badges_tags %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% load i18n wagtailimages_tags wagtailcore_tags dsfr_tags %}
{% load i18n wagtailimages_tags wagtailcore_tags dsfr_tags wagtail_dsfr_tags %}
<div class="fr-card {% if value.enlarge_link %}fr-enlarge-link{% endif %} {% if value.grey_background %}fr-card--grey{% elif value.no_background %}fr-card--no-background{% endif %} {% if value.no_border %}fr-card--no-border{% endif %} {% if value.shadow %}fr-card--shadow{% endif %}">
<div class="fr-card__body">
<div class="fr-card__content">
Expand All @@ -20,7 +20,7 @@
{% endif %}
</{{ value.heading_tag | default:"h3" }}>
{# djlint: on #}
<p class="fr-card__desc">{{ value.description|safe }}</p>
{% if value.description %}{{ value.description | richtext_p_add_class:"fr-card__desc" }}{% endif %}
{% if value.top_detail_badges_tags or value.top_detail_text %}
<div class="fr-card__start">
{% if value.top_detail_badges_tags %}
Expand Down
4 changes: 2 additions & 2 deletions content_manager/templates/content_manager/blocks/tile.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

{% load dsfr_tags wagtailcore_tags wagtailimages_tags %}
{% load dsfr_tags wagtailcore_tags wagtailimages_tags wagtail_dsfr_tags %}
<div class="fr-tile{% if value.is_small %} fr-tile--sm{% endif %}{% if value.enlarge_link %} fr-enlarge-link{% endif %}{% if value.is_horizontal %} fr-tile--horizontal{% endif %}{% if value.grey_background %} fr-tile--grey{% elif value.no_background %} fr-tile--no-background{% endif %}{% if value.no_border %} fr-tile--no-border{% endif %}{% if value.shadow %} fr-tile--shadow{% endif %}{% if value.link.document %} fr-tile--download{% endif %}">
<div class="fr-tile__body">
<div class="fr-tile__content">
Expand All @@ -12,7 +12,7 @@
{% endif %}
</{{ value.heading_tag | default:"h3" }}>
{# djlint: on #}
{% if value.description %}<p class="fr-tile__desc">{{ value.description|safe }}</p>{% endif %}
{% if value.description %}{{ value.description | richtext_p_add_class:"fr-tile__desc" }}{% endif %}
{% if value.detail_text %}
<p class="fr-tile__detail">{{ value.detail_text }}</p>
{% elif value.link.document %}
Expand Down

0 comments on commit 31ecf4e

Please sign in to comment.