Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
a5fa3c4
add an AnonymTopAndBottomPage to the project
dchukhin Dec 19, 2025
7beb387
add counter to section templates
dchukhin Dec 19, 2025
eafe2a1
only show icon element if icon is set
dchukhin Dec 19, 2025
d93d6b8
add CSS class to sections with 'top glow' theme
dchukhin Dec 20, 2025
5b78ce6
add table block to SectionBlocks
dchukhin Dec 20, 2025
7a1bf18
Merge branch 'WT-514-anonym-homepage-cms' into anonym-index-child-page
dchukhin Dec 20, 2025
5cdfaab
make sure first section heading is an h1 element, and others are h2 e…
dchukhin Dec 20, 2025
0c4e399
add an AnonymContentSubPage to the project
dchukhin Dec 20, 2025
12b618b
add toggleable items component to AnonymContentSubPage
dchukhin Dec 22, 2025
4ed3e28
Merge branch 'WT-514-anonym-homepage-cms' into anonym-index-child-page
dchukhin Dec 22, 2025
8503cb0
update migration, since CardsListBlock.cards is now a StreamBlock, to…
dchukhin Dec 22, 2025
9412913
add logo cards, to allow creating case study cards on AnonymContentSu…
dchukhin Dec 22, 2025
25b1fab
Merge branch 'anonym-index-child-page' into anonym-index-content-subpage
dchukhin Dec 22, 2025
c754b6d
update toggle to handle dark and light icons automatically
dchukhin Dec 22, 2025
22b27e0
make sure migration has a license
dchukhin Dec 22, 2025
551030e
Merge branch 'WT-514-anonym-homepage-cms' into anonym-index-child-page
dchukhin Dec 22, 2025
dc564b2
update body class to be anonym-specific
dchukhin Dec 22, 2025
e1346c5
Merge branch 'anonym-index-child-page' into anonym-index-content-subpage
dchukhin Dec 22, 2025
fc72654
update body class to be anonym-specific
dchukhin Dec 22, 2025
ebc0e53
Merge branch 'WT-514-anonym-homepage-cms' into anonym-index-child-page
dchukhin Dec 23, 2025
110f9df
make sure AnonymTopAndBottomPage can be added in production
dchukhin Dec 23, 2025
51c8b61
make sure AnonymTopAndBottomPage is included in db export script
dchukhin Dec 23, 2025
66b2458
Merge branch 'anonym-index-child-page' into anonym-index-content-subpage
dchukhin Dec 23, 2025
3592fee
make sure AnonymContentSubPage can be added in production
dchukhin Dec 23, 2025
8bd545d
make sure AnonymContentSubPage is included in db export script
dchukhin Dec 23, 2025
9445663
Merge branch 'WT-514-anonym-homepage-cms' into anonym-index-child-page
dchukhin Dec 23, 2025
b623f94
make instances of AnonymTopAndBottomPage more easily identifiable by …
dchukhin Dec 23, 2025
1241373
Merge branch 'anonym-index-child-page' into anonym-index-content-subpage
dchukhin Dec 23, 2025
2cb9951
make instances of AnonymContentSubPage more easily identifiable by se…
dchukhin Dec 23, 2025
b849e3c
Merge branch 'WT-514-anonym-homepage-cms' into anonym-index-content-s…
dchukhin Jan 12, 2026
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
82 changes: 79 additions & 3 deletions bedrock/mozorg/blocks/anonym.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@
("popular", "Popular"),
("popup-block", "Popup Block"),
("preferences", "Preferences"),
("pricetag", "Pricetag"),
("pricetag-white", "Pricetag White"),
("printer", "Printer"),
("privacy", "Privacy"),
("private-browsing", "Private Browsing"),
Expand All @@ -224,6 +226,8 @@
("report", "Report"),
("resources", "Resources"),
("restore-session", "Restore Session"),
("rhombus-layers", "Rhombus Layers"),
("rhombus-layers-white", "Rhombus Layers White"),
("screen-share-disabled", "Screen Share Disabled"),
("screen-share", "Screen Share"),
("screenshot", "Screenshot"),
Expand Down Expand Up @@ -283,6 +287,15 @@
]


# The location of non-mozilla-protocal icons.
NON_PROTOCOL_ICONS_DIRS = {
"pricetag": "img/icons",
"pricetag-white": "img/icons",
"rhombus-layers": "img/icons",
"rhombus-layers-white": "img/icons",
}


def get_icon_choices():
"""
Get the icon choices for a ThumbnailChoiceBlock.
Expand All @@ -302,12 +315,19 @@ def get_icon_thumbnails():
"""
result = {}
for icon_choice in ICON_CHOICES:
icon_key = icon_choice[0].lower()
icon_key = icon_choice[0]

# Determine the icon base_url.
base_url = "protocol/img/icons"
if icon_key in NON_PROTOCOL_ICONS_DIRS:
base_url = NON_PROTOCOL_ICONS_DIRS[icon_key]

icon_key = icon_key.lower()
try:
result[icon_key] = static(f"protocol/img/icons/{icon_key}.svg")
result[icon_key] = static(f"{base_url}/{icon_key}.svg")
except (ValueError, OSError):
# Fallback when staticfiles manifest doesn't exist (during migrations/collectstatic)
result[icon_key] = f"/static/protocol/img/icons/{icon_key}.svg"
result[icon_key] = f"/static/{base_url}/{icon_key}.svg"
return result


Expand Down Expand Up @@ -418,11 +438,24 @@ class Meta:
label_format = "Icon Card - {heading}"


class LogoCardBlock(blocks.StructBlock):
logo = ImageChooserBlock()
heading = blocks.CharBlock(label="Heading")
text = blocks.RichTextBlock(features=BASIC_TEXT_FEATURES)
button = blocks.ListBlock(LinkWithTextBlock(), min_num=0, max_num=1, default=[])

class Meta:
template = "mozorg/cms/anonym/blocks/logo-card.html"
label = "Logo Card"
label_format = "Logo Card - {heading}"


class CardsListBlock(blocks.StructBlock):
settings = CardListSettings()
cards = blocks.StreamBlock(
[
("icon_card", IconCardBlock()),
("logo_card", LogoCardBlock()),
],
min_num=1,
max_num=4,
Expand Down Expand Up @@ -498,6 +531,49 @@ class Meta:
label_format = "{heading_text}"


class TwoSectionBlock(blocks.StructBlock):
first_section = SectionBlock()
second_section = SectionBlock()

class Meta:
template = "mozorg/cms/anonym/blocks/two-sections.html"
label = "Two Sections"


class ToggleableItemBlock(blocks.StructBlock):
icon = ThumbnailChoiceBlock(
required=True,
choices=get_icon_choices,
thumbnails=get_icon_thumbnails,
default="outlined",
inline_form=True,
)
toggle_text = blocks.CharBlock()
toggle_content = blocks.StreamBlock(
[
("two_column_block", TwoSectionBlock()),
],
required=True,
)

class Meta:
label = "Toggle Item"
label_format = "Toggle Item - {toggle_text}"


class ToggleableItemsBlock(blocks.StructBlock):
toggle_items = blocks.StreamBlock(
[
("toggle_items", ToggleableItemBlock()),
],
required=True,
)

class Meta:
template = "mozorg/cms/anonym/blocks/toggleable-items.html"
label = "Toggle Items"


class CallToActionBlock(blocks.StructBlock):
heading = blocks.RichTextBlock(
features=BASIC_TEXT_FEATURES,
Expand Down
756 changes: 756 additions & 0 deletions bedrock/mozorg/migrations/0024_anonymcontentsubpage.py

Large diffs are not rendered by default.

Loading