From 2cebbbac18b49f23ab451f1bba3c5dc2af0ac5dc Mon Sep 17 00:00:00 2001 From: Raghad Dahi Date: Fri, 19 Jun 2026 16:34:22 +0300 Subject: [PATCH 1/5] Add VersionNoteBlock for inline version annotations in content pages --- .gitignore | 1 + apps/core/blocks.py | 64 ++++++++++++++++- .../templates/core/blocks/version_note.html | 16 +++++ apps/core/templates/core/svg/added.svg | 3 + apps/core/templates/core/svg/changed.svg | 4 ++ apps/core/templates/core/svg/removed.svg | 3 + .../scss/components/version-note.scss | 68 +++++++++++++++++++ apps/frontend/static_src/scss/main.scss | 1 + 8 files changed, 159 insertions(+), 1 deletion(-) create mode 100644 apps/core/templates/core/blocks/version_note.html create mode 100644 apps/core/templates/core/svg/added.svg create mode 100644 apps/core/templates/core/svg/changed.svg create mode 100644 apps/core/templates/core/svg/removed.svg create mode 100644 apps/frontend/static_src/scss/components/version-note.scss diff --git a/.gitignore b/.gitignore index c89290c9..e04e06b4 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ apps/guide/settings/local.py /static/ .coverage .ruff_cache +.idea/ diff --git a/apps/core/blocks.py b/apps/core/blocks.py index eae2f08e..2eff054f 100644 --- a/apps/core/blocks.py +++ b/apps/core/blocks.py @@ -2,6 +2,25 @@ from wagtail import blocks from wagtail.blocks import RichTextBlock +WAGTAIL_VERSIONS = [ + "4.1", + "4.2", + "5.0", + "5.1", + "5.2", + "6.0", + "6.1", + "6.2", + "6.3", + "6.4", + "7.0", + "7.1", + "7.2", + "7.3", + "7.4", + "8.0", +] + class TextBlock(RichTextBlock): class Meta: @@ -62,5 +81,48 @@ class Meta: value_class = AlertStructValue -CONTENT_BLOCKS = [("text", TextBlock()), ("alert", AlertBlock())] +class VersionNoteStructValue(blocks.StructValue): + def icon(self): + return f"core/svg/{self.get('change_type')}.svg" + + def change_type_display(self): + change_type = self.get("change_type") + choices = { + "added": _("Added"), + "changed": _("Changed"), + "removed": _("Removed"), + } + return choices.get(change_type, change_type) + + +class VersionNoteBlock(blocks.StructBlock): + version = blocks.ChoiceBlock( + choices=[(v, v) for v in WAGTAIL_VERSIONS], + label=_("Version"), + ) + change_type = blocks.ChoiceBlock( + choices=[ + ("added", _("Added")), + ("changed", _("Changed")), + ("removed", _("Removed")), + ], + label=_("Type of change"), + ) + content = RichTextBlock( + features=["bold", "italic", "link"], + label=_("Content"), + ) + + class Meta: + template = "core/blocks/version_note.html" + icon = "tag" + label = _("Version note") + value_class = VersionNoteStructValue + + +CONTENT_BLOCKS = [ + ("text", TextBlock()), + ("alert", AlertBlock()), + ("version_note", VersionNoteBlock()), +] HOME_BLOCKS = [("section_grid", SectionGridBlock())] diff --git a/apps/core/templates/core/blocks/version_note.html b/apps/core/templates/core/blocks/version_note.html new file mode 100644 index 00000000..96873b9e --- /dev/null +++ b/apps/core/templates/core/blocks/version_note.html @@ -0,0 +1,16 @@ +{% load wagtailcore_tags i18n %} + +
+
+
+ {% include value.icon %} +
+ + {% blocktrans with version=value.version %}New in Wagtail {{ version }}{% endblocktrans %} + + {{ value.change_type_display }} +
+
+ {{ value.content|richtext }} +
+
diff --git a/apps/core/templates/core/svg/added.svg b/apps/core/templates/core/svg/added.svg new file mode 100644 index 00000000..66bf4dff --- /dev/null +++ b/apps/core/templates/core/svg/added.svg @@ -0,0 +1,3 @@ + diff --git a/apps/core/templates/core/svg/changed.svg b/apps/core/templates/core/svg/changed.svg new file mode 100644 index 00000000..e6ede22a --- /dev/null +++ b/apps/core/templates/core/svg/changed.svg @@ -0,0 +1,4 @@ + diff --git a/apps/core/templates/core/svg/removed.svg b/apps/core/templates/core/svg/removed.svg new file mode 100644 index 00000000..637fe162 --- /dev/null +++ b/apps/core/templates/core/svg/removed.svg @@ -0,0 +1,3 @@ + diff --git a/apps/frontend/static_src/scss/components/version-note.scss b/apps/frontend/static_src/scss/components/version-note.scss new file mode 100644 index 00000000..d1e2a5c4 --- /dev/null +++ b/apps/frontend/static_src/scss/components/version-note.scss @@ -0,0 +1,68 @@ +.version-note { + $root: &; + box-shadow: 2px 2px 8px 0 rgba($color--black, 0.3); + border-radius: $border-radius--m; + margin-bottom: ($gutter * 3); + overflow: hidden; + + &__header { + display: flex; + align-items: center; + padding: ($gutter * 0.75) $gutter; + } + + &__label { + color: $color--white; + font-weight: 700; + } + + &__badge { + margin-inline-start: auto; + padding: 2px 8px; + border-radius: $border-radius--lg; + background-color: rgba($color--white, 0.2); + color: $color--white; + font-size: 14px; + font-weight: 600; + } + + &__body { + padding: $gutter; + } + + &__icon { + display: flex; + align-items: center; + margin-inline-end: ($gutter * 0.5); + height: 20px; + + svg { + height: 100%; + } + } + + &--added, + &--changed, + &--removed { + #{$root}__header { + background-color: $color--blue; + } + + #{$root}__body { + background-color: light-dark( + $color--extra-light-blue, + $color--black + ); + } + } + + // Extra specificity to override default StreamField values + .streamfield & { + #{$root}__label { + @include rem-font-size($base-font-size); + /* stylelint-disable-next-line declaration-no-important */ + margin: 0 !important; + line-height: 1; + } + } +} diff --git a/apps/frontend/static_src/scss/main.scss b/apps/frontend/static_src/scss/main.scss index 14b21fe5..d68f2e22 100644 --- a/apps/frontend/static_src/scss/main.scss +++ b/apps/frontend/static_src/scss/main.scss @@ -15,6 +15,7 @@ // Custom component styles @import './components/alert'; +@import './components/version-note'; @import './components/app'; @import './components/copy-button'; @import './components/autocomplete'; From 725961c90bda69f269f61989bb72516de4cee01c Mon Sep 17 00:00:00 2001 From: Raghad Dahi Date: Sun, 21 Jun 2026 01:22:50 +0300 Subject: [PATCH 2/5] Add versioned TextBlock --- apps/core/blocks.py | 18 +++++++++- .../migrations/0012_alter_contentpage_body.py | 19 +++++++++++ apps/core/templates/core/blocks/text.html | 7 +++- .../templates/core/blocks/version_note.html | 8 +++-- .../scss/components/version-badge.scss | 34 +++++++++++++++++++ .../scss/components/version-note.scss | 30 ++++++++++++++-- apps/frontend/static_src/scss/main.scss | 1 + 7 files changed, 109 insertions(+), 8 deletions(-) create mode 100644 apps/core/migrations/0012_alter_contentpage_body.py create mode 100644 apps/frontend/static_src/scss/components/version-badge.scss diff --git a/apps/core/blocks.py b/apps/core/blocks.py index 2eff054f..d71ba3b0 100644 --- a/apps/core/blocks.py +++ b/apps/core/blocks.py @@ -22,9 +22,25 @@ ] -class TextBlock(RichTextBlock): +class TextBlock(blocks.StructBlock): + content = RichTextBlock(features=["bold", "italic", "link"]) + version = blocks.ChoiceBlock(choices=[(v, v) for v in WAGTAIL_VERSIONS]) + change_type = blocks.ChoiceBlock( + choices=[ + ("added", _("Added")), + ("changed", _("Changed")), + ("removed", _("Removed")), + ] + ) + class Meta: template = "core/blocks/text.html" + icon = "pilcrow" + label = _("Text") + form_layout = blocks.BlockGroup( + children=["content"], + settings=["version", "change_type"], + ) class SectionStructValue(blocks.StructValue): diff --git a/apps/core/migrations/0012_alter_contentpage_body.py b/apps/core/migrations/0012_alter_contentpage_body.py new file mode 100644 index 00000000..662f5936 --- /dev/null +++ b/apps/core/migrations/0012_alter_contentpage_body.py @@ -0,0 +1,19 @@ +# Generated by Django 6.0.6 on 2026-06-20 21:05 + +import wagtail.fields +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0011_alter_footercontent_locale_alter_footeritem_locale'), + ] + + operations = [ + migrations.AlterField( + model_name='contentpage', + name='body', + field=wagtail.fields.StreamField([('text', 3), ('alert', 5), ('version_note', 9)], block_lookup={0: ('wagtail.blocks.RichTextBlock', (), {'features': ['bold', 'italic', 'link']}), 1: ('wagtail.blocks.ChoiceBlock', [], {'choices': [('4.1', '4.1'), ('4.2', '4.2'), ('5.0', '5.0'), ('5.1', '5.1'), ('5.2', '5.2'), ('6.0', '6.0'), ('6.1', '6.1'), ('6.2', '6.2'), ('6.3', '6.3'), ('6.4', '6.4'), ('7.0', '7.0'), ('7.1', '7.1'), ('7.2', '7.2'), ('7.3', '7.3'), ('7.4', '7.4'), ('8.0', '8.0')]}), 2: ('wagtail.blocks.ChoiceBlock', [], {'choices': [('added', 'Added'), ('changed', 'Changed'), ('removed', 'Removed')]}), 3: ('wagtail.blocks.StructBlock', [[('content', 0), ('version', 1), ('change_type', 2)]], {}), 4: ('wagtail.blocks.ChoiceBlock', [], {'choices': [('Warning', 'Warning'), ('Note', 'Note')]}), 5: ('wagtail.blocks.StructBlock', [[('alert_type', 4), ('alert_body', 0)]], {}), 6: ('wagtail.blocks.ChoiceBlock', [], {'choices': [('4.1', '4.1'), ('4.2', '4.2'), ('5.0', '5.0'), ('5.1', '5.1'), ('5.2', '5.2'), ('6.0', '6.0'), ('6.1', '6.1'), ('6.2', '6.2'), ('6.3', '6.3'), ('6.4', '6.4'), ('7.0', '7.0'), ('7.1', '7.1'), ('7.2', '7.2'), ('7.3', '7.3'), ('7.4', '7.4'), ('8.0', '8.0')], 'label': 'Version'}), 7: ('wagtail.blocks.ChoiceBlock', [], {'choices': [('added', 'Added'), ('changed', 'Changed'), ('removed', 'Removed')], 'label': 'Type of change'}), 8: ('wagtail.blocks.RichTextBlock', (), {'features': ['bold', 'italic', 'link'], 'label': 'Content'}), 9: ('wagtail.blocks.StructBlock', [[('version', 6), ('change_type', 7), ('content', 8)]], {})}), + ), + ] diff --git a/apps/core/templates/core/blocks/text.html b/apps/core/templates/core/blocks/text.html index 7c2089c1..cf35dbbb 100644 --- a/apps/core/templates/core/blocks/text.html +++ b/apps/core/templates/core/blocks/text.html @@ -1,3 +1,8 @@ {% load wagtailcore_tags %} -{{ self|richtext }} +{% if value.version %} +
+ {{ value.change_type|title }} in Wagtail {{ value.version }} +
+{% endif %} +{{ value.content|richtext }} diff --git a/apps/core/templates/core/blocks/version_note.html b/apps/core/templates/core/blocks/version_note.html index 96873b9e..4f547221 100644 --- a/apps/core/templates/core/blocks/version_note.html +++ b/apps/core/templates/core/blocks/version_note.html @@ -2,9 +2,11 @@
-
- {% include value.icon %} -
+ {% if value.change_type %} +
+ {% include value.icon %} +
+ {% endif %} {% blocktrans with version=value.version %}New in Wagtail {{ version }}{% endblocktrans %} diff --git a/apps/frontend/static_src/scss/components/version-badge.scss b/apps/frontend/static_src/scss/components/version-badge.scss new file mode 100644 index 00000000..1f4e168f --- /dev/null +++ b/apps/frontend/static_src/scss/components/version-badge.scss @@ -0,0 +1,34 @@ +.version-badge { + display: inline-flex; + align-items: center; + margin-bottom: ($gutter * 0.5); + padding: 2px 10px; + border-radius: $border-radius--lg; + font-size: 14px; + font-weight: 600; + line-height: 1.5; + + &--added { + background-color: light-dark( + $color--extra-light-teal, + rgba($color--light-teal, 0.15) + ); + color: light-dark($color--teal, $color--light-teal); + } + + &--changed { + background-color: light-dark( + $color--extra-light-blue, + rgba($color--light-blue, 0.15) + ); + color: light-dark($color--blue, $color--light-blue); + } + + &--removed { + background-color: light-dark( + rgba($color--grey, 0.15), + rgba($color--light-grey, 0.1) + ); + color: light-dark($color--grey, $color--light-grey); + } +} diff --git a/apps/frontend/static_src/scss/components/version-note.scss b/apps/frontend/static_src/scss/components/version-note.scss index d1e2a5c4..01633fd5 100644 --- a/apps/frontend/static_src/scss/components/version-note.scss +++ b/apps/frontend/static_src/scss/components/version-note.scss @@ -41,9 +41,20 @@ } } - &--added, - &--changed, - &--removed { + &--added { + #{$root}__header { + background-color: $color--primary; + } + + #{$root}__body { + background-color: light-dark( + $color--extra-light-teal, + $color--black + ); + } + } + + &--changed { #{$root}__header { background-color: $color--blue; } @@ -56,6 +67,19 @@ } } + &--removed { + #{$root}__header { + background-color: $color--grey; + } + + #{$root}__body { + background-color: light-dark( + rgba($color--grey, 0.15), + $color--black + ); + } + } + // Extra specificity to override default StreamField values .streamfield & { #{$root}__label { diff --git a/apps/frontend/static_src/scss/main.scss b/apps/frontend/static_src/scss/main.scss index d68f2e22..7a6443a6 100644 --- a/apps/frontend/static_src/scss/main.scss +++ b/apps/frontend/static_src/scss/main.scss @@ -16,6 +16,7 @@ // Custom component styles @import './components/alert'; @import './components/version-note'; +@import './components/version-badge'; @import './components/app'; @import './components/copy-button'; @import './components/autocomplete'; From b903eb4a6038cc5db298470f3637135b630920bc Mon Sep 17 00:00:00 2001 From: Raghad Dahi Date: Sun, 21 Jun 2026 15:19:30 +0300 Subject: [PATCH 3/5] Keep TextBlock as RichTextBlock, add separate TextBlockVersioned block --- apps/core/blocks.py | 12 +++++++++--- apps/core/migrations/0012_alter_contentpage_body.py | 4 ++-- apps/core/templates/core/blocks/text.html | 7 +------ apps/core/templates/core/blocks/text_versioned.html | 8 ++++++++ apps/llms_txt/jinja2/llms_txt/page.md.jinja | 4 ++++ 5 files changed, 24 insertions(+), 11 deletions(-) create mode 100644 apps/core/templates/core/blocks/text_versioned.html diff --git a/apps/core/blocks.py b/apps/core/blocks.py index d71ba3b0..22a3e18a 100644 --- a/apps/core/blocks.py +++ b/apps/core/blocks.py @@ -22,7 +22,12 @@ ] -class TextBlock(blocks.StructBlock): +class TextBlock(RichTextBlock): + class Meta: + template = "core/blocks/text.html" + + +class TextBlockVersioned(blocks.StructBlock): content = RichTextBlock(features=["bold", "italic", "link"]) version = blocks.ChoiceBlock(choices=[(v, v) for v in WAGTAIL_VERSIONS]) change_type = blocks.ChoiceBlock( @@ -34,9 +39,9 @@ class TextBlock(blocks.StructBlock): ) class Meta: - template = "core/blocks/text.html" + template = "core/blocks/text_versioned.html" icon = "pilcrow" - label = _("Text") + label = _("Text (versioned)") form_layout = blocks.BlockGroup( children=["content"], settings=["version", "change_type"], @@ -138,6 +143,7 @@ class Meta: CONTENT_BLOCKS = [ ("text", TextBlock()), + ("text_versioned", TextBlockVersioned()), ("alert", AlertBlock()), ("version_note", VersionNoteBlock()), ] diff --git a/apps/core/migrations/0012_alter_contentpage_body.py b/apps/core/migrations/0012_alter_contentpage_body.py index 662f5936..d8eaaef4 100644 --- a/apps/core/migrations/0012_alter_contentpage_body.py +++ b/apps/core/migrations/0012_alter_contentpage_body.py @@ -1,4 +1,4 @@ -# Generated by Django 6.0.6 on 2026-06-20 21:05 +# Generated by Django 6.0.6 on 2026-06-21 12:17 import wagtail.fields from django.db import migrations @@ -14,6 +14,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='contentpage', name='body', - field=wagtail.fields.StreamField([('text', 3), ('alert', 5), ('version_note', 9)], block_lookup={0: ('wagtail.blocks.RichTextBlock', (), {'features': ['bold', 'italic', 'link']}), 1: ('wagtail.blocks.ChoiceBlock', [], {'choices': [('4.1', '4.1'), ('4.2', '4.2'), ('5.0', '5.0'), ('5.1', '5.1'), ('5.2', '5.2'), ('6.0', '6.0'), ('6.1', '6.1'), ('6.2', '6.2'), ('6.3', '6.3'), ('6.4', '6.4'), ('7.0', '7.0'), ('7.1', '7.1'), ('7.2', '7.2'), ('7.3', '7.3'), ('7.4', '7.4'), ('8.0', '8.0')]}), 2: ('wagtail.blocks.ChoiceBlock', [], {'choices': [('added', 'Added'), ('changed', 'Changed'), ('removed', 'Removed')]}), 3: ('wagtail.blocks.StructBlock', [[('content', 0), ('version', 1), ('change_type', 2)]], {}), 4: ('wagtail.blocks.ChoiceBlock', [], {'choices': [('Warning', 'Warning'), ('Note', 'Note')]}), 5: ('wagtail.blocks.StructBlock', [[('alert_type', 4), ('alert_body', 0)]], {}), 6: ('wagtail.blocks.ChoiceBlock', [], {'choices': [('4.1', '4.1'), ('4.2', '4.2'), ('5.0', '5.0'), ('5.1', '5.1'), ('5.2', '5.2'), ('6.0', '6.0'), ('6.1', '6.1'), ('6.2', '6.2'), ('6.3', '6.3'), ('6.4', '6.4'), ('7.0', '7.0'), ('7.1', '7.1'), ('7.2', '7.2'), ('7.3', '7.3'), ('7.4', '7.4'), ('8.0', '8.0')], 'label': 'Version'}), 7: ('wagtail.blocks.ChoiceBlock', [], {'choices': [('added', 'Added'), ('changed', 'Changed'), ('removed', 'Removed')], 'label': 'Type of change'}), 8: ('wagtail.blocks.RichTextBlock', (), {'features': ['bold', 'italic', 'link'], 'label': 'Content'}), 9: ('wagtail.blocks.StructBlock', [[('version', 6), ('change_type', 7), ('content', 8)]], {})}), + field=wagtail.fields.StreamField([('text', 0), ('text_versioned', 4), ('alert', 6), ('version_note', 10)], block_lookup={0: ('apps.core.blocks.TextBlock', (), {}), 1: ('wagtail.blocks.RichTextBlock', (), {'features': ['bold', 'italic', 'link']}), 2: ('wagtail.blocks.ChoiceBlock', [], {'choices': [('4.1', '4.1'), ('4.2', '4.2'), ('5.0', '5.0'), ('5.1', '5.1'), ('5.2', '5.2'), ('6.0', '6.0'), ('6.1', '6.1'), ('6.2', '6.2'), ('6.3', '6.3'), ('6.4', '6.4'), ('7.0', '7.0'), ('7.1', '7.1'), ('7.2', '7.2'), ('7.3', '7.3'), ('7.4', '7.4'), ('8.0', '8.0')]}), 3: ('wagtail.blocks.ChoiceBlock', [], {'choices': [('added', 'Added'), ('changed', 'Changed'), ('removed', 'Removed')]}), 4: ('wagtail.blocks.StructBlock', [[('content', 1), ('version', 2), ('change_type', 3)]], {}), 5: ('wagtail.blocks.ChoiceBlock', [], {'choices': [('Warning', 'Warning'), ('Note', 'Note')]}), 6: ('wagtail.blocks.StructBlock', [[('alert_type', 5), ('alert_body', 1)]], {}), 7: ('wagtail.blocks.ChoiceBlock', [], {'choices': [('4.1', '4.1'), ('4.2', '4.2'), ('5.0', '5.0'), ('5.1', '5.1'), ('5.2', '5.2'), ('6.0', '6.0'), ('6.1', '6.1'), ('6.2', '6.2'), ('6.3', '6.3'), ('6.4', '6.4'), ('7.0', '7.0'), ('7.1', '7.1'), ('7.2', '7.2'), ('7.3', '7.3'), ('7.4', '7.4'), ('8.0', '8.0')], 'label': 'Version'}), 8: ('wagtail.blocks.ChoiceBlock', [], {'choices': [('added', 'Added'), ('changed', 'Changed'), ('removed', 'Removed')], 'label': 'Type of change'}), 9: ('wagtail.blocks.RichTextBlock', (), {'features': ['bold', 'italic', 'link'], 'label': 'Content'}), 10: ('wagtail.blocks.StructBlock', [[('version', 7), ('change_type', 8), ('content', 9)]], {})}), ), ] diff --git a/apps/core/templates/core/blocks/text.html b/apps/core/templates/core/blocks/text.html index cf35dbbb..7c2089c1 100644 --- a/apps/core/templates/core/blocks/text.html +++ b/apps/core/templates/core/blocks/text.html @@ -1,8 +1,3 @@ {% load wagtailcore_tags %} -{% if value.version %} -
- {{ value.change_type|title }} in Wagtail {{ value.version }} -
-{% endif %} -{{ value.content|richtext }} +{{ self|richtext }} diff --git a/apps/core/templates/core/blocks/text_versioned.html b/apps/core/templates/core/blocks/text_versioned.html new file mode 100644 index 00000000..cf35dbbb --- /dev/null +++ b/apps/core/templates/core/blocks/text_versioned.html @@ -0,0 +1,8 @@ +{% load wagtailcore_tags %} + +{% if value.version %} +
+ {{ value.change_type|title }} in Wagtail {{ value.version }} +
+{% endif %} +{{ value.content|richtext }} diff --git a/apps/llms_txt/jinja2/llms_txt/page.md.jinja b/apps/llms_txt/jinja2/llms_txt/page.md.jinja index 066ad3c0..2d6f65fa 100644 --- a/apps/llms_txt/jinja2/llms_txt/page.md.jinja +++ b/apps/llms_txt/jinja2/llms_txt/page.md.jinja @@ -10,8 +10,12 @@ Page URL: {{ page.full_url }} {%- for block in page.body %} {%- if block.block_type == 'text' %} {{ block.value|richtext_markdown }} +{%- elif block.block_type == 'text_versioned' %} +{{ block.value.content|richtext_markdown }} {%- elif block.block_type == 'alert' %} {{block.value.alert_type}}: {{ block.value.alert_body|richtext_markdown }} +{%- elif block.block_type == 'version_note' %} +{{ block.value.change_type_display }} in Wagtail {{ block.value.version }}: {{ block.value.content|richtext_markdown }} {%- endif %} {%- endfor %} From 251290343e602683d88405290ad3adff5a8877b5 Mon Sep 17 00:00:00 2001 From: Raghad Dahi Date: Sun, 21 Jun 2026 18:00:48 +0300 Subject: [PATCH 4/5] Make version note label reflect change type, remove duplicate badge --- apps/core/templates/core/blocks/version_note.html | 3 +-- .../static_src/scss/components/version-note.scss | 10 ---------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/apps/core/templates/core/blocks/version_note.html b/apps/core/templates/core/blocks/version_note.html index 4f547221..376a398e 100644 --- a/apps/core/templates/core/blocks/version_note.html +++ b/apps/core/templates/core/blocks/version_note.html @@ -8,9 +8,8 @@
{% endif %} - {% blocktrans with version=value.version %}New in Wagtail {{ version }}{% endblocktrans %} + {% blocktrans with change_type=value.change_type_display version=value.version %}{{ change_type }} in Wagtail {{ version }}{% endblocktrans %} - {{ value.change_type_display }}
{{ value.content|richtext }} diff --git a/apps/frontend/static_src/scss/components/version-note.scss b/apps/frontend/static_src/scss/components/version-note.scss index 01633fd5..52f5511d 100644 --- a/apps/frontend/static_src/scss/components/version-note.scss +++ b/apps/frontend/static_src/scss/components/version-note.scss @@ -16,16 +16,6 @@ font-weight: 700; } - &__badge { - margin-inline-start: auto; - padding: 2px 8px; - border-radius: $border-radius--lg; - background-color: rgba($color--white, 0.2); - color: $color--white; - font-size: 14px; - font-weight: 600; - } - &__body { padding: $gutter; } From 09e6221719a3e7d1669fd8afd820cddddfe25fb5 Mon Sep 17 00:00:00 2001 From: Raghad Dahi Date: Sun, 21 Jun 2026 18:05:51 +0300 Subject: [PATCH 5/5] Simplify VersionNoteBlock, use title filter instead of change_type_display method --- apps/core/blocks.py | 9 --------- apps/core/templates/core/blocks/version_note.html | 2 +- apps/llms_txt/jinja2/llms_txt/page.md.jinja | 2 +- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/apps/core/blocks.py b/apps/core/blocks.py index 22a3e18a..7faa6d84 100644 --- a/apps/core/blocks.py +++ b/apps/core/blocks.py @@ -106,15 +106,6 @@ class VersionNoteStructValue(blocks.StructValue): def icon(self): return f"core/svg/{self.get('change_type')}.svg" - def change_type_display(self): - change_type = self.get("change_type") - choices = { - "added": _("Added"), - "changed": _("Changed"), - "removed": _("Removed"), - } - return choices.get(change_type, change_type) - class VersionNoteBlock(blocks.StructBlock): version = blocks.ChoiceBlock( diff --git a/apps/core/templates/core/blocks/version_note.html b/apps/core/templates/core/blocks/version_note.html index 376a398e..b65d5c3a 100644 --- a/apps/core/templates/core/blocks/version_note.html +++ b/apps/core/templates/core/blocks/version_note.html @@ -8,7 +8,7 @@
{% endif %} - {% blocktrans with change_type=value.change_type_display version=value.version %}{{ change_type }} in Wagtail {{ version }}{% endblocktrans %} + {% blocktrans with change_type=value.change_type|title version=value.version %}{{ change_type }} in Wagtail {{ version }}{% endblocktrans %}
diff --git a/apps/llms_txt/jinja2/llms_txt/page.md.jinja b/apps/llms_txt/jinja2/llms_txt/page.md.jinja index 2d6f65fa..7a4a7bb0 100644 --- a/apps/llms_txt/jinja2/llms_txt/page.md.jinja +++ b/apps/llms_txt/jinja2/llms_txt/page.md.jinja @@ -15,7 +15,7 @@ Page URL: {{ page.full_url }} {%- elif block.block_type == 'alert' %} {{block.value.alert_type}}: {{ block.value.alert_body|richtext_markdown }} {%- elif block.block_type == 'version_note' %} -{{ block.value.change_type_display }} in Wagtail {{ block.value.version }}: {{ block.value.content|richtext_markdown }} +{{ block.value.change_type|capitalize }} in Wagtail {{ block.value.version }}: {{ block.value.content|richtext_markdown }} {%- endif %} {%- endfor %}