Skip to content

Commit

Permalink
Improvements (#173)
Browse files Browse the repository at this point in the history
* Change breadcrumbs to dynamic values

* review accessibility on social icons

* Add blog stylesheet

* Add style blog page and review block template

* add text with image heading template block

* paragraph limit now 10000 and rich text.

* removed richtext field, add heading with dropdown for h size

* list styles for numerated, circle and none

* style image, text, header combination blocks

* add icons for blocks

* eddit padding for blog entry

* margin and block quote styles

* remove quote from richtext options now that it is a styled block

* alter block quote migration

* caption an dlist padding

* fix migrations for puput

---------

Co-authored-by: Sarah Abderemane <sarahabderemane@gmail.com>
  • Loading branch information
dawnwages and sabderemane authored Dec 29, 2023
1 parent 699fdd9 commit 497e0b6
Show file tree
Hide file tree
Showing 19 changed files with 676 additions and 70 deletions.
66 changes: 62 additions & 4 deletions home/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@


class HeadingBlock(blocks.StructBlock):
size = blocks.ChoiceBlock(
choices=[
("text-5xl", "h1"),
("text-4xl", "h2"),
("text-3xl", "h3"),
("text-2xl", "h4"),
("text-xl", "h5"),
("text-lg", "h6"),
],
icon="title",
)
heading = blocks.CharBlock(max_length=255, class_name="heading-blog")

def __str__(self):
Expand All @@ -40,6 +51,23 @@ class Meta:
template = "blocks/heading.html"


class ListBlock(blocks.StructBlock):
size = blocks.ChoiceBlock(
choices=[
("circle", "unordered list"),
("decimal", "ordered list"),
("none", "unstyled"),
]
)
text = blocks.RichTextBlock(features=["ul"], icon="list-ol")

def __str__(self):
return self.text

class Meta:
template = "blocks/list.html"


class TextWithHeadingBlock(blocks.StructBlock):
heading = blocks.CharBlock(max_length=255, class_name="heading-blog")
text = blocks.TextBlock()
Expand Down Expand Up @@ -169,18 +197,48 @@ class Meta:
template = "blocks/text-image-heading.html"


class CustomTableBlock(TableBlock):
class Meta:
template = "blocks/table.html"


class CustomCaption(blocks.StructBlock):
text = blocks.TextBlock()

class Meta:
template = "blocks/caption.html"


class BaseStreamBlock(StreamBlock):
heading = HeadingBlock()
paragraph = blocks.CharBlock(max_length=255)
heading = HeadingBlock(label="Heading", icon="h1")
richtext = blocks.RichTextBlock(
max_length=10000,
features=[
"embed",
"bold",
"italic",
"link",
"superscript",
"subscript",
"strikethrough",
"code",
"hr",
],
label="Rich Text",
icon="title",
)
list = ListBlock(label="List", icon="list-ol")
paragraph = blocks.TextBlock(max_length=10000)
html = blocks.RawHTMLBlock(icon="code", label="Raw HTML")
image = ImageChooserBlock()
caption = CustomCaption()
text_with_heading = TextHeadingImageBlock()
text_with_heading_and_right_image = TextWithHeadingWithRightImageBlock()
text_with_heading_and_left_image = TextWithHeadingWithLeftImageBlock()
right_image_left_text = RightImageLeftTextBlock()
left_image_right_text = LeftImageRightTextBlock()
left_quote_right_image = QuoteLeftImageBlock()
left_quote_right_image = QuoteLeftImageBlock(icon="openquote")
video_embed = VideoEmbed()
table = TableBlock()
table = CustomTableBlock()
code_block = CodeBlock()
rich_text = RichTextBlock()
182 changes: 182 additions & 0 deletions home/migrations/0018_alter_generalpage_content.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
# Generated by Django 4.1.13 on 2023-12-29 06:35

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


class Migration(migrations.Migration):
dependencies = [
("home", "0017_generalpage_generaltag_generalpage_tags"),
]

operations = [
migrations.AlterField(
model_name="generalpage",
name="content",
field=wagtail.fields.StreamField(
[
(
"heading",
wagtail.blocks.StructBlock(
[
(
"size",
wagtail.blocks.ChoiceBlock(
choices=[
("text-5xl", "h1"),
("text-4xl", "h2"),
("text-3xl", "h3"),
("text-2xl", "h4"),
("text-xl", "h5"),
("text-lg", "h6"),
],
icon="title",
),
),
(
"heading",
wagtail.blocks.CharBlock(
class_name="heading-blog", max_length=255
),
),
],
class_name="full",
),
),
("subheading", wagtail.blocks.CharBlock(class_name="full")),
("paragraph", wagtail.blocks.RichTextBlock(class_name="full")),
("HTML", wagtail.blocks.RawHTMLBlock(class_name="full")),
("image", wagtail.images.blocks.ImageChooserBlock()),
(
"text_with_heading",
wagtail.blocks.StructBlock(
[
(
"size",
wagtail.blocks.ChoiceBlock(
choices=[
("text-5xl", "h1"),
("text-4xl", "h2"),
("text-3xl", "h3"),
("text-2xl", "h4"),
("text-xl", "h5"),
("text-lg", "h6"),
],
icon="title",
),
),
(
"heading",
wagtail.blocks.CharBlock(
class_name="heading-blog", max_length=255
),
),
],
class_name="full",
),
),
(
"text_heading_image",
wagtail.blocks.StructBlock(
[
("heading", wagtail.blocks.CharBlock(max_length=255)),
("text", wagtail.blocks.TextBlock()),
("image", wagtail.images.blocks.ImageChooserBlock()),
],
class_name="full",
),
),
(
"video_embed",
wagtail.blocks.StructBlock(
[
("heading", wagtail.blocks.CharBlock(max_length=255)),
("text", wagtail.blocks.TextBlock()),
],
class_name="full",
),
),
(
"table",
wagtail.contrib.table_block.blocks.TableBlock(
class_name="full"
),
),
(
"code_block",
wagtail.blocks.StructBlock(
[
(
"language",
wagtail.blocks.ChoiceBlock(
choices=[
("Python", "python"),
("Markup", "html"),
("CSS", "css"),
("Clojure", "clojure"),
("Bash", "shell"),
("Django", "django"),
("Jinja2", "jinja2"),
("Docker", "dockerfile"),
("Git", "git"),
("GraphQL", "graphql"),
("Handlebars", "handlebars"),
(".ignore", "gitignore"),
("JSON", "json"),
("JSON5", "json5"),
("Markdown", "md"),
("Markdown", "md"),
("React JSX", "jsx"),
("React TSX", "tsx"),
("SASS", "sass"),
("SCSS", "scss"),
("TypeScript", "ts"),
("vim", "vim"),
]
),
),
(
"caption",
wagtail.blocks.CharBlock(
blank=True, max_length=255
),
),
(
"page",
wagtail.blocks.CharBlock(
blank=True, max_length=255
),
),
(
"code",
wagtail.blocks.TextBlock(
blank=True, max_length=1000
),
),
],
class_name="full",
),
),
(
"quote_block",
wagtail.blocks.StructBlock(
[
("text", wagtail.blocks.CharBlock(max_length=255)),
(
"attribution",
wagtail.blocks.CharBlock(max_length=255),
),
],
class_name="full",
),
),
],
blank=True,
null=True,
use_json_field=None,
),
),
]
1 change: 0 additions & 1 deletion home/puput_migrations/0003_alter_entrypage_body.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@


class Migration(migrations.Migration):

dependencies = [
('puput', '0002_entrypage_markdown_body'),
]
Expand Down
Loading

0 comments on commit 497e0b6

Please sign in to comment.