Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP Pm 2022 06 block clean #1926

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 3 additions & 33 deletions adhocracy-plus/assets/scss/components/_blocks.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,29 +52,6 @@ $block-padding-md: 7.5 * $padding;
text-align: left;
}

.block-img-col-1 {
@extend .col-md-7;

img {
display: inline-block;
float: left;
padding-right: $padding;
}
}

.block-img-col-2 {
@extend .col-md-5;

.block-img-col__image {
width: 100%;
position: relative;

@media screen and (min-width: $breakpoint-xxl) {
margin-top: 2 * $spacer;
}
}
}

// old block styling, still used in activity block
.block--bordered {
padding: 1em;
Expand All @@ -88,7 +65,6 @@ $block-padding-md: 7.5 * $padding;

// responsive padding for image, 2 col cta
.homepage__wrapper {
.block-img-col-1,
.block-row-2 {
padding: 2 * $padding;

Expand Down Expand Up @@ -128,26 +104,20 @@ $block-padding-md: 7.5 * $padding;
width: 80px;
border-bottom: solid 8px $brand-secondary;
}

.block-img-col-1 {
h2:after {
left: 0;
}
}
}

// coloured background block
.block-background_cta_block .block > :first-child {
.block-background_cta_block .block-light {
background-color: $brand-secondary;
}

.block-background_cta_block .block > :last-child {
.block-background_cta_block .block-dark {
background-color: $brand-primary;
color: $text-color-inverted;
}

// linked for specificty
.btn--transparent.block-bg_btn-2 {
.block-dark .btn--transparent {
color: $text-color-inverted;
border-color: $text-color-inverted;

Expand Down
33 changes: 5 additions & 28 deletions apps/cms/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class Meta:
icon = 'plus-inverse'


# 1-col, img, richtext, CTA btn
class ImageCTABlock(blocks.StructBlock):
image = ImageChooserBlock(required=False)
body = blocks.RichTextBlock(required=False)
Expand All @@ -28,41 +29,17 @@ class Meta:
icon = 'view'


# 2-col, headline, text, CTA btn, background colors, text colors
class ColumnsImageCTABlock(blocks.StructBlock):
columns_count = blocks.ChoiceBlock(choices=[
(1, 'One column'),
(2, 'Two columns')

], default=2)

columns = blocks.ListBlock(
ImageCTABlock(label='List and Image')
)

class Meta:
template = 'a4_candy_cms_pages/blocks/col_img_cta_block.html'
icon = 'list-ul'


# 2-col, richtext, CTA btn, background colour
class ColBackgroundCTABlock(blocks.StructBlock):
columns_count = blocks.ChoiceBlock(choices=[
(1, 'One column'),
(2, 'Two columns')

], default=2)

columns = blocks.ListBlock(
CallToActionBlock(label='CTA with Background')
)
column1_bg = CallToActionBlock(label='CTA column light blue')
column2_bg = CallToActionBlock(label='CTA column dark blue')

class Meta:
template = 'a4_candy_cms_pages/blocks/col_background_cta_block.html'
icon = 'tick-inverse'


# 3 column block with an optional button/link for each col,
# Call-to-action block can have up to 3 big CTA btn
# 1-3 col, optional richtext, link cta
class ColumnsCTABlock(blocks.StructBlock):
columns_count = blocks.ChoiceBlock(choices=[
(1, 'One column'),
Expand Down
52 changes: 52 additions & 0 deletions apps/cms/pages/migrations/0011_auto_20220616_1529.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Generated by Django 3.2.13 on 2022-06-16 13:29

import apps.cms.blocks
from django.db import migrations
import wagtail.blocks
import wagtail.fields
import wagtail.images.blocks


class Migration(migrations.Migration):

dependencies = [
('a4_candy_cms_pages', '0010_auto_20220614_1427'),
]

operations = [
migrations.AlterField(
model_name='homepage',
name='body_streamfield_de',
field=wagtail.fields.StreamField([('background_cta_block', wagtail.blocks.StructBlock([('columns_count', wagtail.blocks.ChoiceBlock(choices=[(1, 'One column'), (2, 'Two columns')])), ('columns', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('body', wagtail.blocks.RichTextBlock(required=False)), ('link', wagtail.blocks.CharBlock(required=False)), ('link_text', wagtail.blocks.CharBlock(label='Link Text', max_length=50, required=False))], label='CTA with Background')))])), ('columns_cta', wagtail.blocks.StructBlock([('columns_count', wagtail.blocks.ChoiceBlock(choices=[(1, 'One column'), (2, 'Two columns'), (3, 'Three columns')])), ('columns', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('body', wagtail.blocks.RichTextBlock(required=False)), ('link', wagtail.blocks.CharBlock(required=False)), ('link_text', wagtail.blocks.CharBlock(label='Link Text', max_length=50, required=False))], label='CTA Column')))])), ('html', wagtail.blocks.RawHTMLBlock()), ('paragraph', wagtail.blocks.RichTextBlock()), ('news', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock()), ('news_page', wagtail.blocks.PageChooserBlock(page_type=['a4_candy_cms_news.NewsIndexPage']))])), ('use_cases', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock()), ('use_cases', wagtail.blocks.ListBlock(wagtail.blocks.PageChooserBlock(page_type=['a4_candy_cms_use_cases.UseCasePage']))), ('demo_platform', wagtail.blocks.URLBlock()), ('use_case_page', wagtail.blocks.PageChooserBlock(page_type=['a4_candy_cms_use_cases.UseCaseIndexPage']))]))], blank=True, use_json_field=True),
),
migrations.AlterField(
model_name='homepage',
name='body_streamfield_en',
field=wagtail.fields.StreamField([('background_cta_block', wagtail.blocks.StructBlock([('columns_count', wagtail.blocks.ChoiceBlock(choices=[(1, 'One column'), (2, 'Two columns')])), ('columns', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('body', wagtail.blocks.RichTextBlock(required=False)), ('link', wagtail.blocks.CharBlock(required=False)), ('link_text', wagtail.blocks.CharBlock(label='Link Text', max_length=50, required=False))], label='CTA with Background')))])), ('columns_cta', wagtail.blocks.StructBlock([('columns_count', wagtail.blocks.ChoiceBlock(choices=[(1, 'One column'), (2, 'Two columns'), (3, 'Three columns')])), ('columns', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('body', wagtail.blocks.RichTextBlock(required=False)), ('link', wagtail.blocks.CharBlock(required=False)), ('link_text', wagtail.blocks.CharBlock(label='Link Text', max_length=50, required=False))], label='CTA Column')))])), ('html', wagtail.blocks.RawHTMLBlock()), ('paragraph', wagtail.blocks.RichTextBlock()), ('news', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock()), ('news_page', wagtail.blocks.PageChooserBlock(page_type=['a4_candy_cms_news.NewsIndexPage']))])), ('use_cases', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock()), ('use_cases', wagtail.blocks.ListBlock(wagtail.blocks.PageChooserBlock(page_type=['a4_candy_cms_use_cases.UseCasePage']))), ('demo_platform', wagtail.blocks.URLBlock()), ('use_case_page', wagtail.blocks.PageChooserBlock(page_type=['a4_candy_cms_use_cases.UseCaseIndexPage']))]))], blank=True, use_json_field=True),
),
migrations.AlterField(
model_name='simplepage',
name='body_streamfield_de',
field=wagtail.fields.StreamField([('html', wagtail.blocks.RawHTMLBlock()), ('richtext', wagtail.blocks.RichTextBlock()), ('image', wagtail.images.blocks.ImageChooserBlock()), ('faq', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock(required=False)), ('entries', wagtail.blocks.ListBlock(apps.cms.blocks.AccordeonBlock))])), ('image_cta', wagtail.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=False)), ('body', wagtail.blocks.RichTextBlock(required=False)), ('link', wagtail.blocks.CharBlock(required=False)), ('link_text', wagtail.blocks.CharBlock(label='Link Text', max_length=50, required=False))])), ('columns_cta', wagtail.blocks.StructBlock([('columns_count', wagtail.blocks.ChoiceBlock(choices=[(1, 'One column'), (2, 'Two columns'), (3, 'Three columns')])), ('columns', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('body', wagtail.blocks.RichTextBlock(required=False)), ('link', wagtail.blocks.CharBlock(required=False)), ('link_text', wagtail.blocks.CharBlock(label='Link Text', max_length=50, required=False))], label='CTA Column')))])), ('downloads', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock(required=False)), ('documents', wagtail.blocks.ListBlock(apps.cms.blocks.DownloadBlock))])), ('quote', wagtail.blocks.StructBlock([('color', wagtail.blocks.ChoiceBlock(choices=[('turquoise', 'turquoise'), ('blue', 'dark blue')])), ('image', wagtail.images.blocks.ImageChooserBlock()), ('quote', wagtail.blocks.TextBlock()), ('quote_author', wagtail.blocks.CharBlock(required=False)), ('link', wagtail.blocks.URLBlock(required=False)), ('link_text', wagtail.blocks.CharBlock(label='Link Text', max_length=50, required=False))]))], use_json_field=True),
),
migrations.AlterField(
model_name='simplepage',
name='body_streamfield_en',
field=wagtail.fields.StreamField([('html', wagtail.blocks.RawHTMLBlock()), ('richtext', wagtail.blocks.RichTextBlock()), ('image', wagtail.images.blocks.ImageChooserBlock()), ('faq', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock(required=False)), ('entries', wagtail.blocks.ListBlock(apps.cms.blocks.AccordeonBlock))])), ('image_cta', wagtail.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=False)), ('body', wagtail.blocks.RichTextBlock(required=False)), ('link', wagtail.blocks.CharBlock(required=False)), ('link_text', wagtail.blocks.CharBlock(label='Link Text', max_length=50, required=False))])), ('columns_cta', wagtail.blocks.StructBlock([('columns_count', wagtail.blocks.ChoiceBlock(choices=[(1, 'One column'), (2, 'Two columns'), (3, 'Three columns')])), ('columns', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('body', wagtail.blocks.RichTextBlock(required=False)), ('link', wagtail.blocks.CharBlock(required=False)), ('link_text', wagtail.blocks.CharBlock(label='Link Text', max_length=50, required=False))], label='CTA Column')))])), ('downloads', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock(required=False)), ('documents', wagtail.blocks.ListBlock(apps.cms.blocks.DownloadBlock))])), ('quote', wagtail.blocks.StructBlock([('color', wagtail.blocks.ChoiceBlock(choices=[('turquoise', 'turquoise'), ('blue', 'dark blue')])), ('image', wagtail.images.blocks.ImageChooserBlock()), ('quote', wagtail.blocks.TextBlock()), ('quote_author', wagtail.blocks.CharBlock(required=False)), ('link', wagtail.blocks.URLBlock(required=False)), ('link_text', wagtail.blocks.CharBlock(label='Link Text', max_length=50, required=False))]))], blank=True, use_json_field=True),
),
migrations.AlterField(
model_name='simplepage',
name='body_streamfield_ky',
field=wagtail.fields.StreamField([('html', wagtail.blocks.RawHTMLBlock()), ('richtext', wagtail.blocks.RichTextBlock()), ('image', wagtail.images.blocks.ImageChooserBlock()), ('faq', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock(required=False)), ('entries', wagtail.blocks.ListBlock(apps.cms.blocks.AccordeonBlock))])), ('image_cta', wagtail.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=False)), ('body', wagtail.blocks.RichTextBlock(required=False)), ('link', wagtail.blocks.CharBlock(required=False)), ('link_text', wagtail.blocks.CharBlock(label='Link Text', max_length=50, required=False))])), ('columns_cta', wagtail.blocks.StructBlock([('columns_count', wagtail.blocks.ChoiceBlock(choices=[(1, 'One column'), (2, 'Two columns'), (3, 'Three columns')])), ('columns', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('body', wagtail.blocks.RichTextBlock(required=False)), ('link', wagtail.blocks.CharBlock(required=False)), ('link_text', wagtail.blocks.CharBlock(label='Link Text', max_length=50, required=False))], label='CTA Column')))])), ('downloads', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock(required=False)), ('documents', wagtail.blocks.ListBlock(apps.cms.blocks.DownloadBlock))])), ('quote', wagtail.blocks.StructBlock([('color', wagtail.blocks.ChoiceBlock(choices=[('turquoise', 'turquoise'), ('blue', 'dark blue')])), ('image', wagtail.images.blocks.ImageChooserBlock()), ('quote', wagtail.blocks.TextBlock()), ('quote_author', wagtail.blocks.CharBlock(required=False)), ('link', wagtail.blocks.URLBlock(required=False)), ('link_text', wagtail.blocks.CharBlock(label='Link Text', max_length=50, required=False))]))], blank=True, use_json_field=True),
),
migrations.AlterField(
model_name='simplepage',
name='body_streamfield_nl',
field=wagtail.fields.StreamField([('html', wagtail.blocks.RawHTMLBlock()), ('richtext', wagtail.blocks.RichTextBlock()), ('image', wagtail.images.blocks.ImageChooserBlock()), ('faq', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock(required=False)), ('entries', wagtail.blocks.ListBlock(apps.cms.blocks.AccordeonBlock))])), ('image_cta', wagtail.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=False)), ('body', wagtail.blocks.RichTextBlock(required=False)), ('link', wagtail.blocks.CharBlock(required=False)), ('link_text', wagtail.blocks.CharBlock(label='Link Text', max_length=50, required=False))])), ('columns_cta', wagtail.blocks.StructBlock([('columns_count', wagtail.blocks.ChoiceBlock(choices=[(1, 'One column'), (2, 'Two columns'), (3, 'Three columns')])), ('columns', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('body', wagtail.blocks.RichTextBlock(required=False)), ('link', wagtail.blocks.CharBlock(required=False)), ('link_text', wagtail.blocks.CharBlock(label='Link Text', max_length=50, required=False))], label='CTA Column')))])), ('downloads', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock(required=False)), ('documents', wagtail.blocks.ListBlock(apps.cms.blocks.DownloadBlock))])), ('quote', wagtail.blocks.StructBlock([('color', wagtail.blocks.ChoiceBlock(choices=[('turquoise', 'turquoise'), ('blue', 'dark blue')])), ('image', wagtail.images.blocks.ImageChooserBlock()), ('quote', wagtail.blocks.TextBlock()), ('quote_author', wagtail.blocks.CharBlock(required=False)), ('link', wagtail.blocks.URLBlock(required=False)), ('link_text', wagtail.blocks.CharBlock(label='Link Text', max_length=50, required=False))]))], blank=True, use_json_field=True),
),
migrations.AlterField(
model_name='simplepage',
name='body_streamfield_ru',
field=wagtail.fields.StreamField([('html', wagtail.blocks.RawHTMLBlock()), ('richtext', wagtail.blocks.RichTextBlock()), ('image', wagtail.images.blocks.ImageChooserBlock()), ('faq', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock(required=False)), ('entries', wagtail.blocks.ListBlock(apps.cms.blocks.AccordeonBlock))])), ('image_cta', wagtail.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=False)), ('body', wagtail.blocks.RichTextBlock(required=False)), ('link', wagtail.blocks.CharBlock(required=False)), ('link_text', wagtail.blocks.CharBlock(label='Link Text', max_length=50, required=False))])), ('columns_cta', wagtail.blocks.StructBlock([('columns_count', wagtail.blocks.ChoiceBlock(choices=[(1, 'One column'), (2, 'Two columns'), (3, 'Three columns')])), ('columns', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('body', wagtail.blocks.RichTextBlock(required=False)), ('link', wagtail.blocks.CharBlock(required=False)), ('link_text', wagtail.blocks.CharBlock(label='Link Text', max_length=50, required=False))], label='CTA Column')))])), ('downloads', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock(required=False)), ('documents', wagtail.blocks.ListBlock(apps.cms.blocks.DownloadBlock))])), ('quote', wagtail.blocks.StructBlock([('color', wagtail.blocks.ChoiceBlock(choices=[('turquoise', 'turquoise'), ('blue', 'dark blue')])), ('image', wagtail.images.blocks.ImageChooserBlock()), ('quote', wagtail.blocks.TextBlock()), ('quote_author', wagtail.blocks.CharBlock(required=False)), ('link', wagtail.blocks.URLBlock(required=False)), ('link_text', wagtail.blocks.CharBlock(label='Link Text', max_length=50, required=False))]))], blank=True, use_json_field=True),
),
]
25 changes: 25 additions & 0 deletions apps/cms/pages/migrations/0012_auto_20220616_1536.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Generated by Django 3.2.13 on 2022-06-16 13:36

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


class Migration(migrations.Migration):

dependencies = [
('a4_candy_cms_pages', '0011_auto_20220616_1529'),
]

operations = [
migrations.AlterField(
model_name='homepage',
name='body_streamfield_de',
field=wagtail.fields.StreamField([('background_cta_block', wagtail.blocks.StructBlock([('column1_bg', wagtail.blocks.StructBlock([('body', wagtail.blocks.RichTextBlock(required=False)), ('link', wagtail.blocks.CharBlock(required=False)), ('link_text', wagtail.blocks.CharBlock(label='Link Text', max_length=50, required=False))], label='CTA column light blue')), ('column2_bg', wagtail.blocks.StructBlock([('body', wagtail.blocks.RichTextBlock(required=False)), ('link', wagtail.blocks.CharBlock(required=False)), ('link_text', wagtail.blocks.CharBlock(label='Link Text', max_length=50, required=False))], label='CTA column dark blue'))])), ('columns_cta', wagtail.blocks.StructBlock([('columns_count', wagtail.blocks.ChoiceBlock(choices=[(1, 'One column'), (2, 'Two columns'), (3, 'Three columns')])), ('columns', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('body', wagtail.blocks.RichTextBlock(required=False)), ('link', wagtail.blocks.CharBlock(required=False)), ('link_text', wagtail.blocks.CharBlock(label='Link Text', max_length=50, required=False))], label='CTA Column')))])), ('html', wagtail.blocks.RawHTMLBlock()), ('paragraph', wagtail.blocks.RichTextBlock()), ('news', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock()), ('news_page', wagtail.blocks.PageChooserBlock(page_type=['a4_candy_cms_news.NewsIndexPage']))])), ('use_cases', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock()), ('use_cases', wagtail.blocks.ListBlock(wagtail.blocks.PageChooserBlock(page_type=['a4_candy_cms_use_cases.UseCasePage']))), ('demo_platform', wagtail.blocks.URLBlock()), ('use_case_page', wagtail.blocks.PageChooserBlock(page_type=['a4_candy_cms_use_cases.UseCaseIndexPage']))]))], blank=True, use_json_field=True),
),
migrations.AlterField(
model_name='homepage',
name='body_streamfield_en',
field=wagtail.fields.StreamField([('background_cta_block', wagtail.blocks.StructBlock([('column1_bg', wagtail.blocks.StructBlock([('body', wagtail.blocks.RichTextBlock(required=False)), ('link', wagtail.blocks.CharBlock(required=False)), ('link_text', wagtail.blocks.CharBlock(label='Link Text', max_length=50, required=False))], label='CTA column light blue')), ('column2_bg', wagtail.blocks.StructBlock([('body', wagtail.blocks.RichTextBlock(required=False)), ('link', wagtail.blocks.CharBlock(required=False)), ('link_text', wagtail.blocks.CharBlock(label='Link Text', max_length=50, required=False))], label='CTA column dark blue'))])), ('columns_cta', wagtail.blocks.StructBlock([('columns_count', wagtail.blocks.ChoiceBlock(choices=[(1, 'One column'), (2, 'Two columns'), (3, 'Three columns')])), ('columns', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('body', wagtail.blocks.RichTextBlock(required=False)), ('link', wagtail.blocks.CharBlock(required=False)), ('link_text', wagtail.blocks.CharBlock(label='Link Text', max_length=50, required=False))], label='CTA Column')))])), ('html', wagtail.blocks.RawHTMLBlock()), ('paragraph', wagtail.blocks.RichTextBlock()), ('news', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock()), ('news_page', wagtail.blocks.PageChooserBlock(page_type=['a4_candy_cms_news.NewsIndexPage']))])), ('use_cases', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock()), ('use_cases', wagtail.blocks.ListBlock(wagtail.blocks.PageChooserBlock(page_type=['a4_candy_cms_use_cases.UseCasePage']))), ('demo_platform', wagtail.blocks.URLBlock()), ('use_case_page', wagtail.blocks.PageChooserBlock(page_type=['a4_candy_cms_use_cases.UseCaseIndexPage']))]))], blank=True, use_json_field=True),
),
]
Loading