From 508280eb859d4ede511c8c398b8f79718af9bdc5 Mon Sep 17 00:00:00 2001 From: Jan Baykara Date: Tue, 4 Oct 2022 16:09:54 +0100 Subject: [PATCH] Make heading for LinksBlock optional, closes #35 --- stopwatch/models/components.py | 2 +- stopwatch/templates/stopwatch/components/links.html | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/stopwatch/models/components.py b/stopwatch/models/components.py index db2c5d3..cfe96f3 100644 --- a/stopwatch/models/components.py +++ b/stopwatch/models/components.py @@ -68,7 +68,7 @@ class InternalLinkBlock(LinkBlock): def get_href(self, value): return self.get_target(value).url - heading = CharBlock() + heading = CharBlock(required=False) message = RichTextBlock(required=False, features=['h1', 'h2', 'h3', 'h4', 'bold', 'italic', 'ol', 'ul', 'hr', 'link', 'document-link', 'image', 'embed', 'blockquote']) links = StreamBlock(( diff --git a/stopwatch/templates/stopwatch/components/links.html b/stopwatch/templates/stopwatch/components/links.html index acc5b90..d5a60ca 100644 --- a/stopwatch/templates/stopwatch/components/links.html +++ b/stopwatch/templates/stopwatch/components/links.html @@ -1,8 +1,9 @@ {% load static wagtailcore_tags ckbootstrap_tags wagtailembeds_tags %} -
+
+ {% if value.heading %}

{{value.heading}}

- + {% endif %}