Skip to content

Commit

Permalink
Make heading for LinksBlock optional, closes #35
Browse files Browse the repository at this point in the history
  • Loading branch information
janbaykara committed Oct 4, 2022
1 parent 9ac834f commit 508280e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion stopwatch/models/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -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((
Expand Down
5 changes: 3 additions & 2 deletions stopwatch/templates/stopwatch/components/links.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{% load static wagtailcore_tags ckbootstrap_tags wagtailembeds_tags %}

<div class="row g-4 {{value.heading|slugify}}">
<div class="row g-4 {% if value.heading %}{{value.heading|slugify}}{% endif %}">
{% if value.heading %}
<h2>{{value.heading}}</h2>

{% endif %}
<div class="linkblock-links-container">
<div class="linkblock-links-list">
{% for link_block in self.links %}
Expand Down

0 comments on commit 508280e

Please sign in to comment.