Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/npm_and_yarn/eslint-9.10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mmmavis authored Sep 11, 2024
2 parents a98efed + 51911de commit 4a72848
Show file tree
Hide file tree
Showing 37 changed files with 674 additions and 546 deletions.
2 changes: 1 addition & 1 deletion network-api/networkapi/donate/pagemodels/help_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class DonateHelpPage(BaseDonationPage):
SynchronizedField("search_image"),
# Content tab fields
TranslatableField("title"),
TranslatableField("notice"),
SynchronizedField("notice"),
TranslatableField("body"),
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

{% block ga_identifier %}
<meta name="google-site-verification" content="xuTYNuCtTC9SLIkAUtmUY9Wce5RDJofc4z4fMprPYUk" />
<meta name="ga-identifier" content="UA-87658599-15">
<!-- The current GTM ID replaced an unkown GTM container with no clear access -->
<meta name="gtm-identifier" content="GTM-PQQ8H6PM">
<script nonce="{{ request.csp_nonce }}">window.dataLayer = window.dataLayer || [];</script>
<script nonce="{{ request.csp_nonce }}">(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
Expand Down
2 changes: 1 addition & 1 deletion network-api/networkapi/templates/pages/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@

{% block ga_identifier %}
<meta name="google-site-verification" content="D7k-r3fHm-XfJ9E7T1uZ5aqHJG2mx-0uUZFeBUDN2lY">
<meta name="ga-identifier" content="UA-87658599-6">
<!-- The current GTM ID replaced an unkown GTM container with no clear access -->
<meta name="gtm-identifier" content="GTM-PQQ8H6PM">
<script nonce="{{ request.csp_nonce }}">window.dataLayer = window.dataLayer || [];</script>
<script nonce="{{ request.csp_nonce }}">(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
Expand Down
4 changes: 2 additions & 2 deletions network-api/networkapi/wagtailpages/factory/homepage.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ class Meta:
quote_source_job_title = Faker("text", max_nb_chars=50)
partner_background_image = SubFactory(ImageFactory)
partner_intro_text = Faker("text", max_nb_chars=80)
spotlight_headline = Faker("text", max_nb_chars=100)
spotlight_image = SubFactory(ImageFactory)
ideas_headline = Faker("text", max_nb_chars=100)
ideas_image = SubFactory(ImageFactory)


def generate(seed):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
BlogPage,
FocusArea,
HomepageFocusAreas,
HomepageSpotlightPosts,
HomepageIdeasPosts,
)


Expand All @@ -24,13 +24,12 @@ def generate(seed):

HomepageFocusAreas.objects.create(page=home_page, area=FocusArea.objects.get(name="Shape the Agenda"))

NUM_SPOTLIGHT_POSTS = 3
NUM_IDEAS_POSTS = 3

all_blogs = list(BlogPage.objects.all())

home_page.spotlight_posts = [
HomepageSpotlightPosts.objects.create(page=home_page, blog=choice(all_blogs))
for i in range(NUM_SPOTLIGHT_POSTS)
home_page.ideas_posts = [
HomepageIdeasPosts.objects.create(page=home_page, blog=choice(all_blogs)) for i in range(NUM_IDEAS_POSTS)
]

home_page.save()
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import django.db.models.deletion
import modelcluster.fields
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("wagtailcore", "0089_log_entry_data_json_null_to_object"),
("wagtailimages", "0025_alter_image_file_alter_rendition_file"),
("wagtailpages", "0159_update_bgcta_with_linkblock"),
]

operations = [
migrations.RenameModel(
old_name="HomepageSpotlightPosts",
new_name="HomepageIdeasPosts",
),
migrations.RenameField(
model_name="homepage",
old_name="spotlight_headline",
new_name="ideas_headline",
),
migrations.RenameField(
model_name="homepage",
old_name="spotlight_image",
new_name="ideas_image",
),
migrations.AddField(
model_name="homepageideasposts",
name="cta",
field=models.CharField(default="Read more", max_length=50),
),
migrations.AlterField(
model_name="homepageideasposts",
name="page",
field=modelcluster.fields.ParentalKey(
on_delete=django.db.models.deletion.CASCADE, related_name="ideas_posts", to="wagtailpages.homepage"
),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Generated by Django 4.2.15 on 2024-09-09 19:16

import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("wagtailimages", "0025_alter_image_file_alter_rendition_file"),
("wagtailpages", "0160_homepageideasposts_and_more"),
]

operations = [
migrations.AlterField(
model_name="homepage",
name="ideas_headline",
field=models.CharField(blank=True, max_length=140),
),
migrations.AlterField(
model_name="homepage",
name="ideas_image",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="ideas_image",
to="wagtailimages.image",
),
),
]
2 changes: 1 addition & 1 deletion network-api/networkapi/wagtailpages/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
FoundationMetadataPageMixin,
Homepage,
HomepageFocusAreas,
HomepageIdeasPosts,
HomepageNewsYouCanUse,
HomepageSpotlightPosts,
InitiativesPage,
ParticipateHighlights,
ParticipateHighlights2,
Expand Down
27 changes: 14 additions & 13 deletions network-api/networkapi/wagtailpages/pagemodels/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,14 +443,16 @@ class Styleguide(PrimaryPage):
]


class HomepageSpotlightPosts(TranslatableMixin, WagtailOrderable):
class HomepageIdeasPosts(TranslatableMixin, WagtailOrderable):
page = ParentalKey(
"wagtailpages.Homepage",
related_name="spotlight_posts",
related_name="ideas_posts",
)
blog = models.ForeignKey("BlogPage", on_delete=models.CASCADE, related_name="+")
cta = models.CharField(max_length=50, default="Read more")
panels = [
FieldPanel("blog"),
FieldPanel("cta", heading="CTA Link Text"),
]

class Meta(TranslatableMixin.Meta, WagtailOrderable.Meta):
Expand Down Expand Up @@ -762,17 +764,16 @@ def get_banner(self):

hero_button_url = models.URLField(blank=True)

spotlight_image = models.ForeignKey(
ideas_image = models.ForeignKey(
"wagtailimages.Image",
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name="spotlight_image",
related_name="ideas_image",
)

spotlight_headline = models.CharField(
ideas_headline = models.CharField(
max_length=140,
help_text="Spotlight headline",
blank=True,
)

Expand Down Expand Up @@ -880,11 +881,11 @@ def get_banner(self):
),
MultiFieldPanel(
[
FieldPanel("spotlight_image"),
FieldPanel("spotlight_headline"),
InlinePanel("spotlight_posts", label="Posts", min_num=3, max_num=3),
FieldPanel("ideas_image"),
FieldPanel("ideas_headline"),
InlinePanel("ideas_posts", label="Posts", min_num=3, max_num=3),
],
heading="spotlight",
heading="Ideas",
classname="collapsible",
),
MultiFieldPanel(
Expand Down Expand Up @@ -932,8 +933,8 @@ def get_banner(self):
SynchronizedField("hero_image"),
TranslatableField("hero_button_text"),
SynchronizedField("hero_button_url"),
SynchronizedField("spotlight_image"),
TranslatableField("spotlight_headline"),
SynchronizedField("ideas_image"),
TranslatableField("ideas_headline"),
TranslatableField("cause_statement"),
TranslatableField("cause_statement_link_text"),
TranslatableField("cause_statement_link_page"),
Expand All @@ -950,7 +951,7 @@ def get_banner(self):
TranslatableField("focus_areas"),
TranslatableField("take_action_cards"),
TranslatableField("partner_logos"),
TranslatableField("spotlight_posts"),
TranslatableField("ideas_posts"),
TranslatableField("news_you_can_use"),
]

Expand Down
28 changes: 28 additions & 0 deletions network-api/networkapi/wagtailpages/pagemodels/campaigns.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ class Meta:


class CTA(CTABase):
panels = CTABase.panels

class Meta:
ordering = ["-id"]
verbose_name_plural = "CTA"
Expand Down Expand Up @@ -136,6 +138,16 @@ class Callpower(TranslatableMixin, CTA):
index.FilterField("locale_id"),
]

panels = CTA.panels + [
FieldPanel("campaign_id"),
FieldPanel("call_button_label"),
FieldPanel("success_heading"),
FieldPanel("success_text"),
FieldPanel("share_twitter"),
FieldPanel("share_facebook"),
FieldPanel("share_email"),
]

class Meta(TranslatableMixin.Meta):
ordering = ["name"]
verbose_name = "Callpower"
Expand Down Expand Up @@ -166,6 +178,11 @@ class Signup(TranslatableMixin, CTA):
index.FilterField("ask_name"),
]

panels = CTA.panels + [
FieldPanel("campaign_id"),
FieldPanel("ask_name"),
]

class Meta(TranslatableMixin.Meta):
ordering = ["name"]
verbose_name = "Signup"
Expand Down Expand Up @@ -312,6 +329,17 @@ class Petition(TranslatableMixin, CTA):
index.FilterField("show_comment_field"),
]

panels = CTA.panels + [
FieldPanel("campaign_id"),
FieldPanel("show_country_field"),
FieldPanel("show_postal_code_field"),
FieldPanel("show_comment_field"),
FieldPanel("share_twitter"),
FieldPanel("share_facebook"),
FieldPanel("share_email"),
FieldPanel("thank_you"),
]

class Meta(TranslatableMixin.Meta):
ordering = ["-id"]
verbose_name = "Petition"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{% load wagtailcore_tags wagtailimages_tags static %}

<div id="hero">
<div class="banner tw-bg-black">
{% with banner=page.specific.get_banner %}
{% if banner %}
<picture>
<source media="(min-width: 1200px)" srcset="{% image_url banner "fill-4032x480" %}">
<source media="(min-width: 992px)" srcset="{% image_url banner "fill-2400x480" %}">
<source media="(min-width: 768px)" srcset="{% image_url banner "fill-1984x480" %}">
<source media="(min-width: 576px)" srcset="{% image_url banner "fill-1536x390" %}">
{# Fallback Image #}
<img src="{% image_url banner "fill-1536x390" %}" alt="" width="1536" height="390">
</picture>
{% else %}
<img src="{% static "_images/banner-black-white-marble.jpg" %}" alt="" width="" height="">
{% endif %}
{% endwith %}

<div class="container tw-dark banner-content">
<div class="row">
<div class="col-12 col-md-9 col-xl-8 mt-3 d-flex flex-column justify-content-end">
<h1 class="tw-h1-heading">{{ page.hero_headline }}</h1>
{% if page.show_hero_button and page.hero_button_text and page.hero_button_url %}
<div>
<a href="{{ page.hero_button_url }}" class="tw-btn-secondary text-wrap mt-3" id="homepage-hero-cta">{{ page.hero_button_text }}</a>
</div>
{% endif %}
</div>
</div>
</div>
</div>
{% if singleton_page == True %}
{% include "partials/intro_and_content_divider.html" with wrapper_class="d-md-none" %}
{% endif %}
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{% load wagtailimages_tags i18n %}

<div class="row section-ideas section-padding">

<div class="col-12">
<h2 class="capsule-label mb-0 ml-md-4">{% trans "Ideas" %}</h2>
</div>
<div class="col-12 col-lg-6 mb-md-4 mb-lg-0 tw-dark">
<div class="ideas-banner d-flex align-items-end full-bleed-xs p-3 p-md-4" style="background-image: linear-gradient(180deg, rgba(238,238,238,0) 14%, #000000 100%), url({% image_url page.ideas_image "width-540" %});">
<h3 class="tw-h2-heading ideas-headline mb-0">{{ page.ideas_headline }}</h3>
</div>
</div>

<div class="col-12 col-lg-6">
{% for post in page.ideas_posts.all %}
{% with localized=post.blog.localized %}
<div class="ideas-post">
<h4 class="mb-2 tw-h5-heading">
<a href="{{ localized.url }}">{{ localized.title }}</a>
</h4>
{% include "./blog_authors.html" with blog_page=localized %}
<a href="{{ localized.url }}" class="tw-cta-link d-inline-block tw-mt-2">{{ post.cta }}</a>
</div>
{% endwith %}
{% endfor %}
</div>

</div>
Loading

0 comments on commit 4a72848

Please sign in to comment.