Skip to content

Commit

Permalink
Merge pull request #3050 from uktrade/ET-104-superscript-market-articles
Browse files Browse the repository at this point in the history
ET-104 add superscript for market articles richtext
  • Loading branch information
hal274 authored May 3, 2024
2 parents 501fa8a + 8923944 commit 44ad702
Show file tree
Hide file tree
Showing 22 changed files with 220 additions and 22 deletions.
19 changes: 19 additions & 0 deletions core/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@

BACKLINK_QUERYSTRING_NAME = 'return-link'

# Wagtails default features to allow for easy adding of additional features
RICHTEXT_FEATURES__DEFAULT = [
'bold',
'italic',
'h2',
'h3',
'h4',
'ol',
'ul',
'hr',
'anchor-identifier',
'embed',
'link',
'document-link',
'image',
]

RICHTEXT_FEATURES__DEFAULT__ALLOW_SUPERSCRIPT = RICHTEXT_FEATURES__DEFAULT + ['superscript']

# Define a strict subset of rich-text features only includes linebreaks
RICHTEXT_FEATURES__MINIMAL = ()

Expand Down
173 changes: 173 additions & 0 deletions domestic/migrations/0060_alter_articlepage_article_body.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
# Generated by Django 4.2.11 on 2024-05-02 13:21

import wagtail.blocks
import wagtail.fields
import wagtail.images.blocks
import wagtail.snippets.blocks
from django.db import migrations

import core.blocks
import core.models


class Migration(migrations.Migration):

dependencies = [
('domestic', '0059_findabuyerpage'),
]

operations = [
migrations.AlterField(
model_name='articlepage',
name='article_body',
field=wagtail.fields.StreamField(
[
(
'text',
wagtail.blocks.RichTextBlock(
features=[
'bold',
'italic',
'h2',
'h3',
'h4',
'ol',
'ul',
'hr',
'anchor-identifier',
'embed',
'link',
'document-link',
'image',
'superscript',
]
),
),
(
'image',
wagtail.images.blocks.ImageChooserBlock(
required=False, template='core/includes/_article_image.html'
),
),
(
'Video',
wagtail.blocks.StructBlock(
[('video', core.blocks.MediaChooserBlock(label='Video'))],
template='core/includes/_article_video.html',
),
),
(
'Columns',
wagtail.blocks.StreamBlock(
[
(
'column',
wagtail.blocks.StructBlock(
[
(
'title',
wagtail.blocks.CharBlock(label='Title', max_length=255, required=False),
),
(
'image',
wagtail.images.blocks.ImageChooserBlock(
label='Hero Image', required=False
),
),
(
'description',
wagtail.blocks.RichTextBlock(
features=[
'anchor-identifier',
'h2',
'h3',
'h4',
'bold',
'italic',
'ol',
'ul',
'hr',
'link',
'document-link',
],
label='Description',
required=False,
),
),
('link', wagtail.blocks.URLBlock(label='Title link', required=False)),
]
),
)
],
help_text='Add two or three columns text',
max_num=3,
min_num=3,
template='core/includes/_columns.html',
),
),
(
'cta',
wagtail.blocks.StructBlock(
[
('title', wagtail.blocks.CharBlock(label='Title', max_length=255, required=True)),
('teaser', wagtail.blocks.TextBlock(label='Teaser', max_length=255, required=True)),
(
'link_label',
wagtail.blocks.CharBlock(label='Link label', max_length=255, required=True),
),
('link', wagtail.blocks.CharBlock(label='Link', max_length=255, required=True)),
],
template='domestic/blocks/cta.html',
),
),
(
'pull_quote',
wagtail.blocks.StructBlock(
[
('quote', wagtail.blocks.TextBlock()),
(
'attribution',
wagtail.blocks.CharBlock(label='Who said it?', max_length=255, required=False),
),
('role', wagtail.blocks.CharBlock(label='Their role', max_length=255, required=False)),
(
'organisation',
wagtail.blocks.CharBlock(
label='Their organisation', max_length=255, required=False
),
),
(
'organisation_link',
wagtail.blocks.URLBlock(
label='Link to organisation site', max_length=255, required=False
),
),
],
template='domestic/blocks/pull_quote_block.html',
),
),
('data_table', core.blocks.DataTableBlock()),
(
'content_module',
wagtail.snippets.blocks.SnippetChooserBlock(
core.models.ContentModule, template='domestic/blocks/article_snippet.html'
),
),
(
'mounted_blocks',
wagtail.blocks.StructBlock(
[
('block_1', wagtail.blocks.RichTextBlock()),
('block_2', wagtail.blocks.RichTextBlock(required=False)),
],
icon='arrow-right',
template='domestic/blocks/mounted_block.html',
),
),
],
blank=True,
null=True,
use_json_field=True,
),
),
]
3 changes: 2 additions & 1 deletion domestic/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
from core.constants import (
ARTICLE_TYPES,
COUNTRY_FACTSHEET_CTA_TITLE,
RICHTEXT_FEATURES__DEFAULT__ALLOW_SUPERSCRIPT,
RICHTEXT_FEATURES__REDUCED,
RICHTEXT_FEATURES__REDUCED__ALLOW_H1,
TABLEBLOCK_OPTIONS,
Expand Down Expand Up @@ -1098,7 +1099,7 @@ class ArticlePage(
[
(
'text',
RichTextBlock(),
RichTextBlock(features=RICHTEXT_FEATURES__DEFAULT__ALLOW_SUPERSCRIPT),
),
('image', ImageChooserBlock(required=False, template='core/includes/_article_image.html')),
('Video', core_blocks.SimpleVideoBlock(template='core/includes/_article_video.html')),
Expand Down
2 changes: 1 addition & 1 deletion react-components/dist/components_styles.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion react-components/dist/components_styles.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion react-components/dist/expand_your_business_styles.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion react-components/dist/expand_your_business_styles.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion react-components/dist/international_styles.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion react-components/dist/international_styles.css.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions react-components/dist/learn_styles.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion react-components/dist/learn_styles.css.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions react-components/dist/loggedout_styles.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion react-components/dist/loggedout_styles.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion react-components/dist/magna.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion react-components/dist/magna.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions react-components/dist/magna_styles.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion react-components/dist/magna_styles.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion react-components/dist/microsite_styles.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion react-components/dist/microsite_styles.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion react-components/dist/profile_styles.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion react-components/dist/profile_styles.css.map

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions styles/fonts/typography.scss
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@ p {

$regular-font-weight: 400;

sup {
font-size: smaller;
vertical-align: top;
}

.great {
.govuk-body,
.govuk-body-s,
Expand Down

0 comments on commit 44ad702

Please sign in to comment.