Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
240 commits
Select commit Hold shift + click to select a range
45c7428
Stylelint
lucianoratamero Oct 7, 2025
d3f95de
WIP: add new solutions page
lucianoratamero Oct 8, 2025
ab79841
Stylelint
lucianoratamero Oct 7, 2025
77d2c1a
Move base styles from the home-solutions to the advertising and main-…
lucianoratamero Oct 8, 2025
56e26db
Add base advertising template for next pages
lucianoratamero Oct 8, 2025
968399b
Remove unused code
lucianoratamero Oct 9, 2025
1403037
Prevent specific issues with white lines below the sticky subnav
lucianoratamero Oct 9, 2025
2ecff68
Add base why mozilla view and template
lucianoratamero Oct 9, 2025
b7fef77
Update ads notification bar to make arrow clickable
lucianoratamero Oct 9, 2025
3699612
Add why mozilla, contact, notification, and highlight text to the why…
lucianoratamero Oct 9, 2025
8ad5ad1
Wrap why mozilla content on #mozads-main
lucianoratamero Oct 9, 2025
ee8c2f7
Add sample gallery section
lucianoratamero Oct 9, 2025
f88d6e1
Merge branch 'wt-303-ads-solutions-page' into wt-304-why-mozilla-page
lucianoratamero Oct 9, 2025
b1f1922
Redirect formats page to the WIP solutions page
lucianoratamero Oct 9, 2025
c64e6f2
solutions template fix
kkellydesign Oct 10, 2025
6d3e8da
First step toward refactoring typography to align advertising, protoc…
kkellydesign Oct 10, 2025
6cfca20
finished refactoring font sizes
kkellydesign Oct 11, 2025
f708d6d
Move shared css from principles page to a generic two-column css file
lucianoratamero Oct 11, 2025
9ec7564
Add new contact sales page
lucianoratamero Oct 11, 2025
7848c29
Change url for the contact page
lucianoratamero Oct 11, 2025
2210397
Add link to the contact sales page
lucianoratamero Oct 11, 2025
f40a66c
Wrap contact and principles pages with #mozads-main
lucianoratamero Oct 11, 2025
94f7f58
Add required field indicators to the contact sales form fields
lucianoratamero Oct 11, 2025
aae1fa5
Add base static content to the ads solutions page
lucianoratamero Oct 12, 2025
e0f3c19
Add placeholder modal implementation to ads solutions page
lucianoratamero Oct 15, 2025
2fb20a8
Add accordion component using the details and summary html tags
lucianoratamero Oct 15, 2025
d7938e5
add an AdvertisingIndexPage to the project, with template identical t…
dchukhin Oct 15, 2025
8bca89c
make sure that AdvertisingIndexPage is included in db export script
dchukhin Oct 15, 2025
bf4928d
turn advertising index page hero into a block
dchukhin Oct 15, 2025
d62d133
turn advertising section heading into a block
dchukhin Oct 15, 2025
4c3879a
Migrate ads solutions to an es6 file
lucianoratamero Oct 15, 2025
9a8981e
Add skeleton for carousels in modals on ads solutions page
lucianoratamero Oct 15, 2025
94ac67e
turn advertising statistics sections into a block
dchukhin Oct 15, 2025
99e521f
turn advertising feature list section into a block
dchukhin Oct 16, 2025
435be25
turn advertising contact banner into a snippet
dchukhin Oct 16, 2025
d6e9667
turn advertising notification into a page field
dchukhin Oct 16, 2025
b27678d
Merge branch 'main' into WT-334-cms-components-for-advertising
dchukhin Oct 16, 2025
ece85f4
add an AdvertisingPrinciplesPage to the project
dchukhin Oct 16, 2025
318fcf9
make AdvertisingPrinciplesPage fields editable in Wagtail
dchukhin Oct 17, 2025
5236256
make code DRYer by using include template in in feature_list_item_blo…
dchukhin Oct 17, 2025
7259efa
implement sub-navigation for advertising pages
dchukhin Oct 16, 2025
d1e14ab
Bump the frontend group with 3 updates (#16769)
dependabot[bot] Oct 15, 2025
02a2350
Add mozfest block to homepage (fixes #16792) (#16802)
maureenlholland Oct 16, 2025
39a6bb1
l10n request: fix dashes (#16811)
maureenlholland Oct 16, 2025
aae38d1
add an AdvertisingPrinciplesPage to the project
dchukhin Oct 17, 2025
bdf83b8
make AdvertisingPrinciplesPage fields editable in Wagtail
dchukhin Oct 17, 2025
df27a82
make code DRYer by using include template in in feature_list_item_blo…
dchukhin Oct 17, 2025
caa7ede
implement sub-navigation for AdvertisingPrinciplesPage
dchukhin Oct 17, 2025
4a6104a
reorder migrations after merge
dchukhin Oct 17, 2025
9751dde
allow subnavigation links to look like buttons by selecting a checkbox
dchukhin Oct 17, 2025
a84a12d
Merge branch 'main' into WT-334-cms-components-for-advertising
dchukhin Oct 17, 2025
728b1f4
Merge branch 'main' into WT-334-cms-components-for-advertising-subpage
dchukhin Oct 17, 2025
01e603f
Merge branch 'main' into WT-334-cms-components-for-advertising-sub-na…
dchukhin Oct 17, 2025
74b1b78
add AdvertisingPrinciplesPage to the pages which are editable in Wagtail
dchukhin Oct 17, 2025
599a9e0
add AdvertisingPrinciplesPage to the pages in export db script
dchukhin Oct 17, 2025
48ccd4d
add AdvertisingPrinciplesPage to the pages which are editable in Wagtail
dchukhin Oct 17, 2025
4fcb493
add AdvertisingPrinciplesPage to the pages in export db script
dchukhin Oct 17, 2025
424ef27
avoid confusion by making sure that AdvertisingPrinciplesPage can onl…
dchukhin Oct 17, 2025
ccd50c3
avoid confusion by making sure that AdvertisingPrinciplesPage can onl…
dchukhin Oct 17, 2025
55a8960
be more specific about rendered image dimensions
dchukhin Oct 17, 2025
9ee3168
be more specific about rendered image dimensions
dchukhin Oct 17, 2025
0759a63
be more specific about rendered image dimensions
dchukhin Oct 17, 2025
5a6e55e
add a unit test for the AdvertisingIndexPage
dchukhin Oct 17, 2025
a02c1e9
design revisions
kkellydesign Oct 21, 2025
c12a3b1
modal FE finished
kkellydesign Oct 21, 2025
86e9730
solutions PDF, contact link updated
kkellydesign Oct 21, 2025
0c01dca
Merge branch 'main' into wt-303-ads-solutions-page
kkellydesign Oct 22, 2025
6cc4a10
Merge branch 'wt-303-ads-solutions-page' into WT-334-cms-components-f…
kkellydesign Oct 22, 2025
caf014d
minor FE edits to account for predictable CMS behavior
kkellydesign Oct 22, 2025
ed6183b
Merge branch 'wt-303-ads-solutions-page' into WT-334-cms-components-f…
kkellydesign Oct 22, 2025
6060890
Revert "Merge branch 'wt-303-ads-solutions-page' into WT-334-cms-comp…
kkellydesign Oct 22, 2025
279ef91
Merge branch 'main' into WT-334-cms-components-for-advertising-subpage
kkellydesign Oct 22, 2025
962be17
Merge branch 'main' into WT-334-cms-components-for-advertising-sub-na…
kkellydesign Oct 22, 2025
d822ea5
copy and design revisions
kkellydesign Oct 22, 2025
73181a8
update for design revisions
kkellydesign Oct 23, 2025
3676a00
design revisions
kkellydesign Oct 23, 2025
1e41ee8
Merge branch 'main' into wt-303-ads-solutions-page
kkellydesign Oct 23, 2025
4c05508
fixing linting
kkellydesign Oct 23, 2025
08ecf06
prettier JS updates
kkellydesign Oct 23, 2025
7427006
Merge branch 'main' into WT-334-cms-components-for-advertising
dchukhin Oct 27, 2025
47d4578
carousel caption JS updates
kkellydesign Oct 27, 2025
3c1f433
new Impact page design
kkellydesign Oct 29, 2025
41c22ce
add ability to add top divider to section heading block
dchukhin Oct 29, 2025
3ad1c19
allow image alt text to be set on page, but also have default if page…
dchukhin Oct 29, 2025
31b931c
typography revisions
kkellydesign Oct 29, 2025
4a50887
use image description for alt-text
dchukhin Oct 29, 2025
9354382
use wagtail-link-block to create consistent link choosing experience
dchukhin Oct 29, 2025
60a569d
test
dchukhin Oct 29, 2025
98c0c95
Merge branch 'WT-334-cms-components-for-advertising' into WT-334-cms-…
dchukhin Oct 29, 2025
2549592
Merge branch 'WT-334-cms-components-for-advertising-subpage' of githu…
dchukhin Oct 29, 2025
a4c7a80
make advertising subpage more generically-named
dchukhin Oct 29, 2025
5e054d2
for clarity, rename list_items field to be second_column
dchukhin Oct 29, 2025
ccc054c
make sure that template variables have a value when using include
dchukhin Oct 29, 2025
03d0cb4
do not require elements in two column subpage's second column to be a…
dchukhin Oct 29, 2025
06d1781
add rich text block to two column subpage's second column
dchukhin Oct 29, 2025
d2cdac5
add a unit test for TwoColumnSubpage
dchukhin Oct 29, 2025
81eb36d
update test for AdvertisingIndexPage based on changes to fields
dchukhin Oct 29, 2025
bfc52b8
Merge branch 'WT-334-cms-components-for-advertising' into WT-334-cms-…
dchukhin Oct 29, 2025
dde44b7
Merge branch 'WT-334-cms-components-for-advertising-subpage' into WT-…
dchukhin Oct 29, 2025
3b490c5
fix typo and add missing '}'
dchukhin Oct 29, 2025
7eff5a2
fix lint error
dchukhin Oct 29, 2025
c7bf3c4
Merge branch 'WT-334-cms-components-for-advertising' into WT-334-cms-…
dchukhin Oct 29, 2025
0bbb72a
remove extra text from section_anchor help_text
dchukhin Oct 29, 2025
45dd7d1
updated type scale
kkellydesign Oct 29, 2025
f783627
linting fixes
kkellydesign Oct 29, 2025
2467b45
linting fixes
kkellydesign Oct 29, 2025
3e14cd5
use wagtail-link-block in sub navigation for more consistent link cho…
dchukhin Oct 29, 2025
a592f1f
add a unit test for advertising pages sub-navigation
dchukhin Oct 29, 2025
5956ad4
fix formatting error
dchukhin Oct 30, 2025
fdc143a
Merge branch 'WT-334-cms-components-for-advertising' into WT-334-cms-…
dchukhin Oct 30, 2025
9d91c9e
make page more reusable by putting content into a two-column block in…
dchukhin Oct 30, 2025
44c065e
allow FigureWithStatisticBlock to have a link
dchukhin Oct 30, 2025
b7db7ab
fix reference to new_window property in link
dchukhin Oct 30, 2025
4457a84
update CSS classes used to match work in WT-303
dchukhin Oct 30, 2025
d3fac0d
allow FigureWithStatisticBlock to have a link
dchukhin Oct 30, 2025
313060f
update blocks and CSS classes to match work in WT-303
dchukhin Oct 30, 2025
7686c40
Merge branch 'wt-303-ads-solutions-page' into WT-334-cms-components-f…
dchukhin Oct 30, 2025
c368bfd
new images, another round of design QA
kkellydesign Oct 30, 2025
9ddf1ec
advertising index page can have multiple links for a notification
dchukhin Oct 30, 2025
160e90b
new copy added
kkellydesign Oct 30, 2025
f5f4d4b
Merge branch 'WT-334-cms-components-for-advertising' into WT-334-cms-…
dchukhin Oct 30, 2025
e855286
update tests based on recent changes to TwoColumnSubpage blocks
dchukhin Oct 30, 2025
244717b
Merge branch 'WT-334-cms-components-for-advertising-subpage' into WT-…
dchukhin Oct 30, 2025
1075355
update migration based on merge
dchukhin Oct 30, 2025
4bca693
make sure TwoColumnSubpage uses correct file for sub-navigation
dchukhin Oct 30, 2025
b3dfe8b
fix frontend build issues
dchukhin Oct 30, 2025
5d32ace
Merge branch 'WT-334-cms-components-for-advertising-subpage' into WT-…
dchukhin Oct 30, 2025
526c414
MDN ads images added, captions revised
kkellydesign Oct 31, 2025
6413ac9
replace hard-coded link in sub-navigation with page URL
dchukhin Oct 31, 2025
33a20ff
Merge branch 'wt-303-ads-solutions-page' into WT-334-cms-components-f…
dchukhin Oct 31, 2025
6140fae
Merge branch 'WT-334-cms-components-for-advertising' into WT-334-cms-…
dchukhin Oct 31, 2025
c809dc4
Merge branch 'WT-334-cms-components-for-advertising-subpage' into WT-…
dchukhin Oct 31, 2025
5a6a012
merge more changes from WT-303
dchukhin Oct 31, 2025
4ee8b81
remove unused SCSS file
dchukhin Oct 31, 2025
3198968
Merge branch 'WT-334-cms-components-for-advertising-subpage' into WT-…
dchukhin Oct 31, 2025
627ee32
remove unused HTML file
dchukhin Oct 31, 2025
9697688
make more updates from WT-303 changes
dchukhin Oct 31, 2025
c65a24e
make more updates from WT-303 changes
dchukhin Oct 31, 2025
78c641d
Merge branch 'WT-334-cms-components-for-advertising-subpage' into WT-…
dchukhin Oct 31, 2025
94bba55
Merge branch 'WT-334-cms-components-for-advertising-sub-navigation' i…
dchukhin Oct 31, 2025
fc1e91c
add ContentSubpage to the project
dchukhin Oct 31, 2025
a6e203f
update SectionHeaderBlock to support ContentSubpage designs
dchukhin Oct 31, 2025
abeaaac
add FigureWithStatisticBlock to ContentSubpage
dchukhin Oct 31, 2025
5bc48e8
Mozilla Ads and Web Docs find/replace
kkellydesign Nov 1, 2025
c3047fe
CSS prefix revision to remove "mozads" in favor of "mza"
kkellydesign Nov 1, 2025
7992987
Merge branch 'wt-303-ads-solutions-page' into WT-334-cms-components-f…
kkellydesign Nov 1, 2025
3c4092c
replacing mozads with mza in template files
kkellydesign Nov 1, 2025
448cd18
Solutions refactor in prep for CMS work
kkellydesign Nov 1, 2025
4b9fe3e
add StatisticCalloutBlock to ContentSubpage
dchukhin Nov 3, 2025
e1863c6
add FeatureListWithModalsBlock to ContentSubpage
dchukhin Nov 3, 2025
c05e987
allow StatisticBlocks to have a label above the value
dchukhin Nov 3, 2025
644e8af
add RowTextAndLinkBlock to ContentSubpage
dchukhin Nov 3, 2025
276798e
add contact banner and notifications to ContentSubpage
dchukhin Nov 3, 2025
dfa9c09
make HTML file more readable
dchukhin Nov 3, 2025
7c125b3
Merge branch 'WT-334-cms-components-for-advertising' of github.com:mo…
dchukhin Nov 3, 2025
262bd7f
Merge branch 'WT-334-cms-components-for-advertising' into WT-334-cms-…
dchukhin Nov 3, 2025
7dfcb74
Merge branch 'WT-334-cms-components-for-advertising-subpage' into WT-…
dchukhin Nov 3, 2025
c57c1d1
replace mozads with mza in template files
dchukhin Nov 3, 2025
95eb363
replace mozads with mza in template files
dchukhin Nov 3, 2025
d57d203
Merge branch 'main' into WT-334-cms-components-for-advertising-subpage
dchukhin Nov 3, 2025
68b0c8d
Merge branch 'WT-334-cms-components-for-advertising-subpage' into WT-…
dchukhin Nov 3, 2025
b339751
make sure to use specific page, so that navigation correctly appears
dchukhin Nov 3, 2025
7cfc89d
Merge branch 'WT-334-cms-components-for-advertising-sub-navigation' i…
dchukhin Nov 3, 2025
64ab017
replace mozads with mza in template files
dchukhin Nov 3, 2025
52bf3a1
rename block field to be more descriptive of its function
dchukhin Nov 3, 2025
d2c6efd
do not require a heading text in SectionHeaderBlocks
dchukhin Nov 4, 2025
ae2b24c
require SectionHeaderBlocks to have a superheading, heading, or subhe…
dchukhin Nov 4, 2025
9e1f5bd
add FeatureListBlock to ContentSubpage, so it can be used on the 'Imp…
dchukhin Nov 4, 2025
6ad7c05
allow feature list item heading to have line breaks
dchukhin Nov 4, 2025
3327170
allow feature list item supporting text to be rich text
dchukhin Nov 4, 2025
e572cd7
use a more-fitting icon for RowTextAndLinkBlock
dchukhin Nov 4, 2025
56a5a6b
Merge branch 'main' into WT-334-cms-components-for-advertising
dchukhin Nov 4, 2025
d30cb5e
Merge branch 'WT-334-cms-components-for-advertising' into WT-334-cms-…
dchukhin Nov 4, 2025
0ba033c
Merge branch 'WT-334-cms-components-for-advertising-subpage' into WT-…
dchukhin Nov 4, 2025
e914531
Merge branch 'WT-334-cms-components-for-advertising-sub-navigation' o…
dchukhin Nov 4, 2025
832515f
Merge branch 'WT-334-cms-components-for-advertising-sub-navigation' i…
dchukhin Nov 4, 2025
1b137a2
undo accidental changes to github actions code from merge revert commit
dchukhin Nov 4, 2025
e359684
Merge branch 'WT-334-cms-components-for-advertising-subpage' into WT-…
dchukhin Nov 4, 2025
81c9679
Merge branch 'WT-334-cms-components-for-advertising-sub-navigation' i…
dchukhin Nov 4, 2025
d146fa2
Merge branch 'wt-303-ads-solutions-page' into WT-334-cms-components-f…
dchukhin Nov 4, 2025
2321e63
Merge branch 'WT-334-cms-components-for-advertising' into WT-334-cms-…
dchukhin Nov 4, 2025
96e6069
Merge branch 'WT-334-cms-components-for-advertising-subpage' into WT-…
dchukhin Nov 4, 2025
31a3237
Merge branch 'WT-334-cms-components-for-advertising-sub-navigation' i…
dchukhin Nov 4, 2025
73bd788
Merge branch 'main' into wt-303-ads-solutions-page
kkellydesign Nov 4, 2025
ecc8f26
photo update
kkellydesign Nov 4, 2025
47077ae
Merge branch 'wt-303-ads-solutions-page' into WT-334-cms-components-f…
dchukhin Nov 5, 2025
aa2e894
Merge branch 'WT-334-cms-components-for-advertising' into WT-334-cms-…
dchukhin Nov 5, 2025
a788c58
undo accidental changes from merge revert
dchukhin Nov 5, 2025
98fb0f7
undo more accidental changes from merge revert
dchukhin Nov 5, 2025
2eb18a6
make sure to refer to correct CTA attribute in template
dchukhin Nov 5, 2025
1e5065e
add rel noopener attribute to links that open in a new tab
dchukhin Nov 5, 2025
d331191
Merge branch 'WT-334-cms-components-for-advertising' into WT-334-cms-…
dchukhin Nov 5, 2025
553c0a4
Merge branch 'WT-334-cms-components-for-advertising-subpage' into WT-…
dchukhin Nov 5, 2025
756bd2c
add rel noopener attribute to links that open in a new tab
dchukhin Nov 5, 2025
31daeeb
Merge branch 'WT-334-cms-components-for-advertising-sub-navigation' i…
dchukhin Nov 5, 2025
3d38c48
"nearly" removed. Apostrophes fixed. Principles added to nav.
kkellydesign Nov 11, 2025
8d7ec02
precommit installed and run on all relevant files
kkellydesign Nov 11, 2025
dc4de78
Merge branch 'wt-303-ads-solutions-page' into WT-334-cms-components-f…
kkellydesign Nov 11, 2025
850918e
Commit staged changes (bypass pre-commit due to Desktop hang)
kkellydesign Nov 11, 2025
8c0485c
Merge branch 'wt-303-ads-solutions-page' into WT-334-cms-components-f…
kkellydesign Nov 11, 2025
84f83f3
Merge branch 'WT-334-cms-components-for-advertising' into WT-334-cms-…
kkellydesign Nov 11, 2025
77c31e5
Merge branch 'WT-334-cms-components-for-advertising-subpage' into WT-…
kkellydesign Nov 11, 2025
1231c27
Merge branch 'WT-334-cms-components-for-advertising-sub-navigation' i…
kkellydesign Nov 11, 2025
1303569
homepage CSS revisions
kkellydesign Nov 11, 2025
6ad9b87
impact and solutions page revisions
kkellydesign Nov 12, 2025
b5c6866
header class revisions
kkellydesign Nov 12, 2025
0d50820
prefer Wagtail Pages for each of advertising pages
dchukhin Nov 12, 2025
9c333ed
make CMS Page editing more closely match springfield
dchukhin Nov 12, 2025
91a971f
move divider and background color settings from blocks to SectionBlock
dchukhin Nov 12, 2025
70d333a
update tests based on recent page structure changes
dchukhin Nov 13, 2025
0fb9401
update navigation anchor validation logic based on recent changes to …
dchukhin Nov 13, 2025
80086d8
ads work refactor for better markup/sections
kkellydesign Nov 18, 2025
b7bbf39
Merge branch 'main' into WT-334-cms-components-for-advertising-more-c…
kkellydesign Nov 20, 2025
f9a4902
Merge branch 'main' into WT-334-cms-components-for-advertising
kkellydesign Nov 20, 2025
2fe733d
Merge branch 'WT-334-cms-components-for-advertising' into WT-334-cms-…
kkellydesign Nov 20, 2025
23de2ef
Merge branch 'WT-334-cms-components-for-advertising-subpage' into WT-…
kkellydesign Nov 20, 2025
c11a6d1
fixing line lengths
kkellydesign Nov 20, 2025
2428e7f
change notifications block to be a snippet
dchukhin Nov 21, 2025
b075c1a
template revisions
kkellydesign Nov 23, 2025
c417012
Update bedrock/mozorg/blocks/advertising.py
kkellydesign Nov 24, 2025
fb889ad
removing advertising/why-mozilla and advertising/contact
kkellydesign Nov 24, 2025
db0a9f7
add migration for label text change
dchukhin Nov 24, 2025
0aa38cf
remove twitter as a social icon choice
dchukhin Nov 24, 2025
01de16c
Merge branch 'WT-334-cms-components-for-advertising' into WT-334-cms-…
dchukhin Nov 24, 2025
7899985
reorder migrations after merge
dchukhin Nov 24, 2025
7b99623
for better usage clarity, rename TwoColumnSubpage to AdvertisingTwoCo…
dchukhin Nov 24, 2025
179746e
Merge branch 'WT-334-cms-components-for-advertising-subpage' into WT-…
dchukhin Nov 24, 2025
2dea948
reorder migrations after merge
dchukhin Nov 24, 2025
d07895f
update reference to previously renamed model
dchukhin Nov 24, 2025
f733790
remove twitter as field from NotificationSnippet
dchukhin Nov 24, 2025
e5aa2ac
remove unused notification-related blocks
dchukhin Nov 24, 2025
8c2e287
remove unused field mapping
dchukhin Nov 24, 2025
7f4a026
Merge branch 'main' into WT-334-cms-components-for-advertising
dchukhin Nov 24, 2025
df2d9d7
Merge branch 'WT-334-cms-components-for-advertising' into WT-334-cms-…
dchukhin Nov 24, 2025
be1f099
Merge branch 'WT-334-cms-components-for-advertising-subpage' into WT-…
dchukhin Nov 24, 2025
98c3e06
Merge branch 'main' into WT-334-cms-components-for-advertising-subpage
dchukhin Nov 24, 2025
149fac4
Merge branch 'WT-334-cms-components-for-advertising-subpage' into WT-…
dchukhin Nov 24, 2025
2b18736
Merge branch 'main' into WT-334-cms-components-for-advertising-sub-na…
dchukhin Nov 24, 2025
2f2b6f1
Merge branch 'main' into WT-334-cms-components-for-advertising-sub-na…
dchukhin Nov 24, 2025
bc68cfa
Merge branch 'main' into WT-334-cms-components-for-advertising-sub-na…
dchukhin Nov 24, 2025
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
220 changes: 173 additions & 47 deletions bedrock/mozorg/blocks/advertising.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.

from django.core.exceptions import ValidationError

from wagtail import blocks
from wagtail.images.blocks import ImageChooserBlock
from wagtail_link_block.blocks import LinkBlock
Expand All @@ -17,19 +19,14 @@
]


SOCIAL_MEDIA_ICON_CHOICES = [
("linkedin", "LinkedIn"),
("tiktok", "TikTok"),
("spotify", "Spotify"),
("bluesky", "BlueSky"),
("instagram", "Instagram"),
("youtube", "YouTube"),
]


class AdvertisingHeroBlock(blocks.StructBlock):
"""Advertising page hero block."""

anchor_id = blocks.CharBlock(
required=False,
max_length=100,
help_text="Optional: Add an ID to make this section linkable from navigation (e.g., 'hero', 'overview')",
)
heading_text = blocks.CharBlock(char_max_length=255)
primary_cta_text = blocks.CharBlock(char_max_length=255)
primary_cta_link = LinkBlock(label="Primary CTA Link")
Expand All @@ -47,17 +44,31 @@ class Meta:
class SectionHeaderBlock(blocks.StructBlock):
"""Section header block."""

has_top_divider = blocks.BooleanBlock(
default=False,
anchor_id = blocks.CharBlock(
required=False,
label="Should the section have a divider line on top?",
inline_form=True,
max_length=100,
help_text="Optional: Add an ID to make this section linkable from navigation (e.g., 'solutions', 'why-mozilla')",
)
superheading_text = blocks.CharBlock(char_max_length=255, required=False)
heading_text = blocks.CharBlock(char_max_length=255)
heading_text = blocks.CharBlock(char_max_length=255, required=False)
subheading_text = blocks.CharBlock(char_max_length=255, required=False)
image = ImageChooserBlock(required=False)

def clean(self, value):
errors = {}

superheading = value.get("superheading_text", "").strip()
heading = value.get("heading_text", "").strip()
subheading = value.get("subheading_text", "").strip()

if not superheading and not heading and not subheading:
errors["heading_text"] = ValidationError("You must provide either superheading, or heading, or subheading.")

if errors:
raise blocks.StructBlockValidationError(errors)

return super().clean(value)

class Meta:
icon = "title"
label = "Section Heading"
Expand All @@ -69,8 +80,13 @@ class Meta:
class FigureWithStatisticBlock(blocks.StructBlock):
"""Figure with a statistic block."""

anchor_id = blocks.CharBlock(
required=False,
max_length=100,
help_text="Optional: Add an ID to make this section linkable from navigation",
)
image = ImageChooserBlock(required=False)
image_caption = blocks.RichTextBlock(char_max_length=255)
image_caption = blocks.RichTextBlock(char_max_length=255, required=False)
statistic_value = blocks.CharBlock(char_max_length=255)
statistic_label = blocks.CharBlock(char_max_length=255)
align_image_on_right = blocks.BooleanBlock(
Expand All @@ -79,8 +95,6 @@ class FigureWithStatisticBlock(blocks.StructBlock):
label="Position the image to the right of the statistic",
inline_form=True,
)
cta_text = blocks.CharBlock(char_max_length=255, required=False)
cta_link = LinkBlock(label="Link", required=False)

class Meta:
icon = "decimal"
Expand All @@ -93,8 +107,8 @@ class Meta:
class FeatureListItemBlock(blocks.StructBlock):
"""Feature list item block."""

heading_text = blocks.CharBlock(char_max_length=255)
supporting_text = blocks.TextBlock()
heading_text = blocks.TextBlock()
supporting_text = blocks.RichTextBlock(features=["bold", "italic", "link"])

class Meta:
label = "Feature Item"
Expand All @@ -106,6 +120,11 @@ class Meta:
class FeatureListBlock(blocks.StructBlock):
"""Feature list block."""

anchor_id = blocks.CharBlock(
required=False,
max_length=100,
help_text="Optional: Add an ID to make this section linkable from navigation",
)
feature_list_items = blocks.ListBlock(FeatureListItemBlock(), min_num=1)

class Meta:
Expand Down Expand Up @@ -144,6 +163,103 @@ class Meta:
form_classname = "compact-form struct-block"


class StatisticBlock(blocks.StructBlock):
"""Statistic block."""

statistic_superlabel = blocks.CharBlock(char_max_length=255, required=False)
statistic_value = blocks.CharBlock(char_max_length=255)
statistic_label = blocks.CharBlock(char_max_length=255)

class Meta:
icon = "decimal"
label = "Statistic Block"
label_format = "{statistic_value} {statistic_label}"
template = "mozorg/cms/advertising/blocks/statistic_block.html"
form_classname = "compact-form struct-block"


class StatisticCalloutBlock(blocks.StructBlock):
"""Block for statistics with a callout."""

anchor_id = blocks.CharBlock(
required=False,
max_length=100,
help_text="Optional: Add an ID to make this section linkable from navigation",
)
heading_text = blocks.CharBlock(char_max_length=255)
statistics = blocks.ListBlock(StatisticBlock(), min_num=1)

class Meta:
icon = "decimal"
label = "Statistic Callout Block"
label_format = "{heading_text}"
template = "mozorg/cms/advertising/blocks/statistic_callout_block.html"
form_classname = "compact-form struct-block"


class FigureBlock(blocks.StructBlock):
"""Figure block."""

image = ImageChooserBlock(required=False)
image_caption_heading = blocks.TextBlock(char_max_length=255, required=False)
image_caption_text = blocks.TextBlock(char_max_length=255, required=False)

class Meta:
label = "Feature Item"
label_format = "{image_caption}"
form_classname = "compact-form struct-block"


class FeatureItemWithModalBlock(blocks.StructBlock):
"""Block for a feature item with a modal."""

heading_text = blocks.CharBlock(char_max_length=255)
figures = blocks.ListBlock(FigureBlock(), min_num=1)
cta_text = blocks.CharBlock(char_max_length=255, required=False)
cta_link = LinkBlock(label="CTA Link", required=False)

class Meta:
label = "Feature Item"
label_format = "{heading_text}"
template = "mozorg/cms/advertising/blocks/feature_item_with_modal_block.html"
form_classname = "compact-form struct-block"


class FeatureListWithModalsBlock(blocks.StructBlock):
"""A block for a list of features, each with a modal."""

anchor_id = blocks.CharBlock(
required=False,
max_length=100,
help_text="Optional: Add an ID to make this section linkable from navigation",
)
heading_text = blocks.CharBlock(char_max_length=255)
supporting_text = blocks.TextBlock()
feature_list_items = blocks.ListBlock(FeatureItemWithModalBlock(), min_num=1)

class Meta:
icon = "list-ul"
label = "Feature List With Modals Block"
label_format = "{heading_text}"
template = "mozorg/cms/advertising/blocks/feature_list_with_modals_block.html"
form_classname = "compact-form struct-block"


class RowTextAndLinkBlock(blocks.StructBlock):
"""Block for text and a link."""

text = blocks.CharBlock(char_max_length=255, required=False)
link_text = blocks.CharBlock(char_max_length=255)
link = LinkBlock(label="Link")

class Meta:
icon = "doc-full"
label = "Text and Link Block"
label_format = "{text}"
template = "mozorg/cms/advertising/blocks/row_text_and_link_block.html"
form_classname = "compact-form struct-block"


class TwoColumnDetailBlock(blocks.StructBlock):
"""Feature list item block."""

Expand All @@ -163,39 +279,49 @@ class Meta:
form_classname = "compact-form struct-block"


class LinkWithIcon(blocks.StructBlock):
"""Link with an icon."""

icon = blocks.ChoiceBlock(required=False, choices=SOCIAL_MEDIA_ICON_CHOICES, inline_form=True)
link = LinkBlock()
class SectionSettings(blocks.StructBlock):
anchor_id = blocks.CharBlock(
required=False,
max_length=100,
help_text="Optional: Add an ID to make this section linkable from navigation (e.g., 'solutions', 'why-mozilla')",
)
has_top_divider = blocks.BooleanBlock(
default=False,
required=False,
label="Should the section have a divider line on top?",
inline_form=True,
)
display_on_dark_background = blocks.BooleanBlock(
default=False,
required=False,
label="Should the section have a dark background?",
inline_form=True,
)

class Meta:
icon = "link"
label = "Link With Icon"
label_format = "Link With Icon"
template = "mozorg/cms/advertising/blocks/link_with_icon_block.html"
icon = "cog"
collapsed = True
label = "Settings"
label_format = "ID: {anchor_id} - Divider: {has_top_divider} - Dark background: {display_on_dark_background}"
form_classname = "compact-form struct-block"


class NotificationBlock(blocks.StructBlock):
notification_text = blocks.RichTextBlock(
char_max_length=255,
features=[
"bold",
"italic",
"superscript",
"subscript",
"strikethrough",
"code",
"link",
],
)
links = blocks.StreamBlock(
class SectionBlock(blocks.StructBlock):
settings = SectionSettings()

header = SectionHeaderBlock()
content = blocks.StreamBlock(
[
("link_with_icon", LinkWithIcon()),
],
required=False,
("section_header_block", SectionHeaderBlock()),
("figure_with_statistic_block", FigureWithStatisticBlock()),
("statistic_callout_block", StatisticCalloutBlock()),
("features_with_modals", FeatureListWithModalsBlock()),
("feature_list_block", FeatureListBlock()),
]
)
call_to_action = blocks.ListBlock(RowTextAndLinkBlock(), min_num=0, max_num=1, default=[], label="Call to Action")

class Meta:
template = "mozorg/cms/advertising/blocks/notification_block.html"
template = "mozorg/cms/advertising/blocks/section.html"
label = "Section"
label_format = "{header}"
58 changes: 58 additions & 0 deletions bedrock/mozorg/blocks/navigation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.

from django.core.exceptions import ValidationError

from wagtail import blocks
from wagtail.blocks import StructValue
from wagtail_link_block.blocks import LinkBlock


class NavigationLinkValue(StructValue):
"""Custom StructValue for NavigationLinkBlock with URL resolution."""

def get_resolved_url(self, anchor_page_url=""):
"""Return the resolved URL for this navigation link."""
link = self.get("link")
if link.get("link_to") == "anchor":
return f"{anchor_page_url}{link.get_url()}"
elif link:
return link.get_url()
return None


class NavigationLinkBlock(blocks.StructBlock):
"""A navigation link for sub-navigation menu."""

link_text = blocks.CharBlock(
max_length=50,
help_text="Text to display for this navigation link",
)

link = LinkBlock()

has_button_appearance = blocks.BooleanBlock(
required=False,
default=False,
help_text="This link should look like a button",
)

def clean(self, value):
errors = {}
link = value.get("link", {})

# Validate that the appropriate field is filled based on link_type
if link.get("link_to") == "anchor":
if not link.get("anchor"):
errors["link"] = ValidationError("Section anchor is required when linking to a section")

if errors:
raise blocks.StructBlockValidationError(errors)

return super().clean(value)

class Meta:
icon = "link"
label = "Navigation Link"
value_class = NavigationLinkValue
Loading