Skip to content

Commit

Permalink
💵 Collection RichText (#174)
Browse files Browse the repository at this point in the history
Migrates collections text to RichTextBlock
  • Loading branch information
mrharpo authored May 20, 2024
1 parent 3340734 commit f3d2043
Show file tree
Hide file tree
Showing 2 changed files with 281 additions and 6 deletions.
279 changes: 279 additions & 0 deletions ov_collections/migrations/0013_alter_collection_content.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,279 @@
# Generated by Django 5.0.6 on 2024-05-20 20:58

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


class Migration(migrations.Migration):
dependencies = [
("ov_collections", "0012_remove_collection_aapb_records_and_more"),
]

operations = [
migrations.AlterField(
model_name="collection",
name="content",
field=wagtail.fields.StreamField(
[
(
"interviews",
wagtail.blocks.StructBlock(
[
(
"guids",
wagtail.blocks.TextBlock(
help_text="AAPB record IDs, separated by whitespace",
required=True,
),
),
(
"show_title",
wagtail.blocks.BooleanBlock(
default=True,
help_text="Show asset title(s)",
required=False,
),
),
(
"show_thumbnail",
wagtail.blocks.BooleanBlock(
default=True,
help_text="Show asset thumbnail(s)",
required=False,
),
),
(
"title",
wagtail.blocks.RichTextBlock(
features=["italic"],
help_text="The title of this group",
max_length=1024,
required=False,
),
),
],
icon="openquote",
label="Interviews",
),
),
(
"archival_footage",
wagtail.blocks.StructBlock(
[
(
"guids",
wagtail.blocks.TextBlock(
help_text="AAPB record IDs, separated by whitespace",
required=True,
),
),
(
"show_title",
wagtail.blocks.BooleanBlock(
default=True,
help_text="Show asset title(s)",
required=False,
),
),
(
"show_thumbnail",
wagtail.blocks.BooleanBlock(
default=True,
help_text="Show asset thumbnail(s)",
required=False,
),
),
(
"title",
wagtail.blocks.RichTextBlock(
features=["italic"],
help_text="The title of this group",
max_length=1024,
required=False,
),
),
],
icon="clipboard-list",
label="Archival Footage",
),
),
(
"photographs",
wagtail.blocks.StructBlock(
[
(
"guids",
wagtail.blocks.TextBlock(
help_text="AAPB record IDs, separated by whitespace",
required=True,
),
),
(
"show_title",
wagtail.blocks.BooleanBlock(
default=True,
help_text="Show asset title(s)",
required=False,
),
),
(
"show_thumbnail",
wagtail.blocks.BooleanBlock(
default=True,
help_text="Show asset thumbnail(s)",
required=False,
),
),
(
"title",
wagtail.blocks.RichTextBlock(
features=["italic"],
help_text="The title of this group",
max_length=1024,
required=False,
),
),
],
icon="copy",
label="Photographs",
),
),
(
"original_footage",
wagtail.blocks.StructBlock(
[
(
"guids",
wagtail.blocks.TextBlock(
help_text="AAPB record IDs, separated by whitespace",
required=True,
),
),
(
"show_title",
wagtail.blocks.BooleanBlock(
default=True,
help_text="Show asset title(s)",
required=False,
),
),
(
"show_thumbnail",
wagtail.blocks.BooleanBlock(
default=True,
help_text="Show asset thumbnail(s)",
required=False,
),
),
(
"title",
wagtail.blocks.RichTextBlock(
features=["italic"],
help_text="The title of this group",
max_length=1024,
required=False,
),
),
],
icon="doc-full-inverse",
label="Original Footage",
),
),
(
"programs",
wagtail.blocks.StructBlock(
[
(
"guids",
wagtail.blocks.TextBlock(
help_text="AAPB record IDs, separated by whitespace",
required=True,
),
),
(
"show_title",
wagtail.blocks.BooleanBlock(
default=True,
help_text="Show asset title(s)",
required=False,
),
),
(
"show_thumbnail",
wagtail.blocks.BooleanBlock(
default=True,
help_text="Show asset thumbnail(s)",
required=False,
),
),
(
"title",
wagtail.blocks.RichTextBlock(
features=["italic"],
help_text="The title of this group",
max_length=1024,
required=False,
),
),
],
icon="desktop",
label="Programs",
),
),
(
"related_content",
wagtail.blocks.StructBlock(
[
(
"guids",
wagtail.blocks.TextBlock(
help_text="AAPB record IDs, separated by whitespace",
required=True,
),
),
(
"show_title",
wagtail.blocks.BooleanBlock(
default=True,
help_text="Show asset title(s)",
required=False,
),
),
(
"show_thumbnail",
wagtail.blocks.BooleanBlock(
default=True,
help_text="Show asset thumbnail(s)",
required=False,
),
),
(
"title",
wagtail.blocks.RichTextBlock(
features=["italic"],
help_text="The title of this group",
max_length=1024,
required=False,
),
),
],
icon="table",
label="Related Content",
),
),
("credits", wagtail.blocks.RichTextBlock(icon="form")),
(
"heading",
wagtail.blocks.RichTextBlock(
features=["italic"], form_classname="title", icon="title"
),
),
("text", wagtail.blocks.RichTextBlock()),
("image", wagtail.images.blocks.ImageChooserBlock()),
("html", wagtail.blocks.RawHTMLBlock(label="HTML")),
]
),
),
]
8 changes: 2 additions & 6 deletions ov_collections/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@
from django.db import models
from wagtail.admin.panels import FieldPanel, MultiFieldPanel
from wagtail.api import APIField
from wagtail.blocks import (
RawHTMLBlock,
RichTextBlock,
TextBlock,
)
from wagtail.blocks import RawHTMLBlock, RichTextBlock
from wagtail.fields import RichTextField, StreamField
from wagtail.images.api.fields import ImageRenditionField
from wagtail.images.blocks import ImageChooserBlock
Expand Down Expand Up @@ -45,7 +41,7 @@ class Collection(HeadlessMixin, Page):
form_classname='title', features=['italic'], icon='title'
),
),
('text', TextBlock()),
('text', RichTextBlock()),
('image', ImageChooserBlock()),
('html', RawHTMLBlock(label='HTML')),
],
Expand Down

0 comments on commit f3d2043

Please sign in to comment.