Skip to content

Commit

Permalink
🎞 AAPB Record (#144)
Browse files Browse the repository at this point in the history
* Initial aapb record type

* Fixes lint errors

* Combine all options into single AAPBRecordsBlock

* Improves docstrings

* Better labels and icons for blocks
  • Loading branch information
mrharpo authored Dec 21, 2023
1 parent cd83c3a commit b9d95c3
Show file tree
Hide file tree
Showing 3 changed files with 316 additions and 57 deletions.
32 changes: 18 additions & 14 deletions ov_collections/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@


class ContentBlock(StructBlock):
"""Generic content block
"""Generic External link block
This is the base block for all content blocks. All fields are required
This is the base block for a generic external link. All fields are required
Attributes:
title: RichTextBlock with italics only
Expand All @@ -29,7 +29,7 @@ class ContentBlock(StructBlock):


class ContentImageBlock(ContentBlock):
"""Generic content block with image
"""Generic external link block with image
Attributes:
image: ImageChooserBlock. Required.
Expand All @@ -46,27 +46,31 @@ def get_api_representation(self, value, context=None):
class AAPBRecordsBlock(StructBlock):
"""AAPB Records block
A list of AAPB records to be displayed as a group. The records can be displayed in
different ways, depending on the options selected.
A list of 1 or more AAPB records to be displayed as a group.
Attributes:
ids: required. List of GUIDs, separated by whitespace
show_title: optional
show_thumbnail: optional
show_description: optional
guids: required. List of GUIDs, separated by whitespace
show_title: Show the title of records on the page
show_thumbnail: Show the thumbnail of records on the page
title: Optional title of the group
"""

ids = TextBlock(
guids = TextBlock(
required=True,
help_text='AAPB record IDs, separated by whitespace',
)

show_title = BooleanBlock(required=False, help_text='Show title', default=True)
show_title = BooleanBlock(
required=False, help_text='Show asset title(s)', default=True
)

show_thumbnail = BooleanBlock(
required=False, help_text='Show thumbnail', default=True
required=False, help_text='Show asset thumbnail(s)', default=True
)

show_description = BooleanBlock(
required=False, help_text='Show description', default=False
title = RichTextBlock(
required=False,
max_length=1024,
help_text='The title of this group',
features=['italic'],
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,284 @@
# Generated by Django 4.2.8 on 2023-12-20 19:08

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


class Migration(migrations.Migration):
dependencies = [
("ov_collections", "0011_alter_collection_aapb_records_and_more"),
]

operations = [
migrations.RemoveField(
model_name="collection",
name="aapb_records",
),
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.TextBlock()),
("image", wagtail.images.blocks.ImageChooserBlock()),
("html", wagtail.blocks.RawHTMLBlock(label="HTML")),
],
use_json_field=True,
),
),
]
Loading

0 comments on commit b9d95c3

Please sign in to comment.