-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Homepage refresh new intro section (#12858)
* New section markup and layout (mobile + desktop) * Add model updates, migration and layout tags * Remove `cause_statement` fields from `Homepage` model, `page` from `FocusArea` model * Remove remaining `cause_statement` references * Fix import order in migration * Update migration timestamp * Fix invalid html classname in markup * Fix focus area styling * Remove remaining `page` references for `FocusArea` models * Fix `FocusArea` responsive width * Update migration to replace seed data and field lengths * Remove character limit for updated fields since it crashes with existing data * Fix migration to adapt to format and include locale_id for newly created FocusArea objects * Test fix for CI factory workflow * Assign a page to hero_bottom_page so button shows up in visual regression tests * Streamline migration to use existing record instead of deleting and creating * Migration formatting * Update migration to keep cause_statement section and name the "Hero intro" section accordingly * Update migration order * Update model and migration to use `LinkBlock` field type to store `hero_intro_xxxx` data * Fix default text line width * Fix linting * Separate migrations
- Loading branch information
Showing
10 changed files
with
195 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
network-api/networkapi/wagtailpages/migrations/0163_remove_focusarea_page.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Generated by Django 4.2.15 on 2024-09-23 19:40 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("wagtailpages", "0162_alter_articlepage_body"), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name="focusarea", | ||
name="page", | ||
), | ||
] |
106 changes: 106 additions & 0 deletions
106
...ailpages/migrations/0164_homepage_hero_intro_body_homepage_hero_intro_heading_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
# Generated by Django 4.2.15 on 2024-09-23 19:42 | ||
|
||
import wagtail.blocks | ||
import wagtail.documents.blocks | ||
import wagtail.fields | ||
from django.db import migrations, models | ||
|
||
import networkapi.wagtailpages.validators | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("wagtailpages", "0163_remove_focusarea_page"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="homepage", | ||
name="hero_intro_body", | ||
field=models.TextField( | ||
blank=True, | ||
default="Mozilla empowers consumers to demand better online privacy, trustworthy AI, and safe online experiences from Big Tech and governments. We work across borders, disciplines, and technologies to uphold principles like privacy, inclusion and decentralization online.", | ||
max_length=300, | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="homepage", | ||
name="hero_intro_heading", | ||
field=models.CharField( | ||
blank=True, | ||
default="A healthy internet is one in which privacy, openness, and inclusion are the norms.", | ||
max_length=100, | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="homepage", | ||
name="hero_intro_link", | ||
field=wagtail.fields.StreamField( | ||
[ | ||
( | ||
"link", | ||
wagtail.blocks.StructBlock( | ||
[ | ||
("label", wagtail.blocks.CharBlock()), | ||
( | ||
"link_to", | ||
wagtail.blocks.ChoiceBlock( | ||
choices=[ | ||
("page", "Page"), | ||
("external_url", "External URL"), | ||
("relative_url", "Relative URL"), | ||
("email", "Email"), | ||
("anchor", "Anchor"), | ||
("file", "File"), | ||
("phone", "Phone"), | ||
], | ||
label="Link to", | ||
), | ||
), | ||
("page", wagtail.blocks.PageChooserBlock(label="Page", required=False)), | ||
( | ||
"external_url", | ||
wagtail.blocks.URLBlock( | ||
help_text="Enter a full URL including http:// or https://", | ||
label="External URL", | ||
max_length=300, | ||
required=False, | ||
), | ||
), | ||
( | ||
"relative_url", | ||
wagtail.blocks.CharBlock( | ||
help_text='A path relative to this domain. For example, "/foo/bar" or "?foo=bar".', | ||
label="Relative URL", | ||
max_length=300, | ||
required=False, | ||
validators=[networkapi.wagtailpages.validators.RelativeURLValidator()], | ||
), | ||
), | ||
( | ||
"anchor", | ||
wagtail.blocks.CharBlock( | ||
help_text='An id attribute of an element on the current page. For example, "#section-1"', | ||
label="#", | ||
max_length=300, | ||
required=False, | ||
validators=[networkapi.wagtailpages.validators.AnchorLinkValidator()], | ||
), | ||
), | ||
("email", wagtail.blocks.EmailBlock(required=False)), | ||
("file", wagtail.documents.blocks.DocumentChooserBlock(label="File", required=False)), | ||
("phone", wagtail.blocks.CharBlock(label="Phone", max_length=30, required=False)), | ||
( | ||
"new_window", | ||
wagtail.blocks.BooleanBlock(label="Open in new window", required=False), | ||
), | ||
] | ||
), | ||
) | ||
], | ||
blank=True, | ||
use_json_field=True, | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 5 additions & 9 deletions
14
network-api/networkapi/wagtailpages/templates/wagtailpages/fragments/focus_area.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,11 @@ | ||
{% load wagtailimages_tags i18n %} | ||
{% load wagtailimages_tags %} | ||
|
||
<div class="col-12 col-lg-4 mb-3 mb-lg-0 d-block d-sm-flex flex-sm-row flex-lg-column"> | ||
{% image area.interest_icon width-100 class="icon flex-shrink-0 mb-3 mb-sm-0 mb-lg-3 mr-sm-5 align-self-start" alt=area.interest_icon.title %} | ||
<div class="tw-flex tw-flex-col tw-items-center medium:tw-flex-row tw-gap-16 medium:tw-mx-auto medium:tw-w-[29rem]"> | ||
{% image area.interest_icon width-100 class="tw-max-w-[4em] tw-max-h-[4em]" alt=area.interest_icon.title %} | ||
|
||
<div class="focus-content"> | ||
<h2 class="tw-h4-heading">{{ area.name }}</h2> | ||
<div class="tw-text-center medium:tw-text-left"> | ||
<h2 class="tw-font-zilla tw-text-[40px] tw-mb-0">{{ area.name }}</h2> | ||
<p>{{ area.description }}</p> | ||
|
||
{% if area.page %}<div class="mb-4 learn-more-link"> | ||
<a href="{{ area.page.localized.url }}" aria-label="{% blocktrans with name=area.name %}Learn more about: {{ name }}{% endblocktrans %}">{% trans "Learn more →" %}</a> | ||
</div>{% endif %} | ||
</div> | ||
</div> | ||
|
13 changes: 4 additions & 9 deletions
13
network-api/networkapi/wagtailpages/templates/wagtailpages/fragments/focus_areas.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,7 @@ | ||
{% load wagtailimages_tags i18n %} | ||
|
||
<div class="row areas-of-focus"> | ||
<div class="col my-3 my-sm-5"> | ||
<h2 class="focus-heading text-center mb-4">{% trans "Our areas of focus" %}</h2> | ||
<div class="row"> | ||
{% for focus in page.focus_areas.all %} | ||
{% include "./focus_area.html" with area=focus.area %} | ||
{% endfor %} | ||
</div> | ||
</div> | ||
<div class="areas-of-focus tw-bg-blue-03 large:tw-bg-transparent tw-py-24 tw-flex tw-flex-col tw-gap-8 large:tw-flex-shrink-0 large:tw-py-40"> | ||
{% for focus in page.focus_areas.all %} | ||
{% include "./focus_area.html" with area=focus.area %} | ||
{% endfor %} | ||
</div> |
11 changes: 11 additions & 0 deletions
11
network-api/networkapi/wagtailpages/templates/wagtailpages/fragments/hero_intro_box.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{% load wagtailcore_tags %} | ||
|
||
<div class="tw-container tw-flex tw-flex-col tw-my-24 medium:!tw-px-0 medium:tw-my-40"> | ||
<h2 class="tw-leading-tight tw-mb-8 medium:tw-text-[28px]">{{ page.hero_intro_heading }}</h2> | ||
<p>{{ page.hero_intro_body }}</p> | ||
{% if page.hero_intro_link %} | ||
{% with link=page.hero_intro_link.0.value %} | ||
<a href="{{ link.url }}" {% if link.new_window %}target="_blank"{% endif %} class="tw-cta-link d-inline-block tw-mt-2 tw-mb-5">{{ link.label }}</a> | ||
{% endwith %} | ||
{% endif %} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters