-
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.
Merge branch 'main' into feature/fe-be-mozfest-hero-updates
- Loading branch information
Showing
15 changed files
with
14,847 additions
and
141 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
15 changes: 15 additions & 0 deletions
15
network-api/networkapi/management/commands/fix_local_site_bindings.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,15 @@ | ||
from django.core.management.base import BaseCommand | ||
from wagtail.core.models import Site | ||
|
||
|
||
class Command(BaseCommand): | ||
help = 'Ensure site bindings are for localhost (e.g. for after a db copy)' | ||
|
||
def handle(self, *args, **options): | ||
for site in Site.objects.all(): | ||
if site.is_default_site: | ||
site.hostname = 'localhost' | ||
else: | ||
site.hostname = 'mozfest.localhost' | ||
site.port = 8000 | ||
site.save() |
40 changes: 40 additions & 0 deletions
40
network-api/networkapi/wagtailpages/migrations/0038_cta_refactor_1.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,40 @@ | ||
# Generated by Django 3.1.11 on 2021-09-23 17:45 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
def copy_cta_to_petition_cta(apps, schema_editor): | ||
models = [ | ||
apps.get_model("wagtailpages", "CampaignPage"), | ||
apps.get_model("wagtailpages", "BanneredCampaignPage"), | ||
] | ||
|
||
for Model in models: | ||
for page in Model.objects.all(): | ||
if page.cta: | ||
page.petition_cta = page.cta | ||
page.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('wagtailpages', '0037_auto_20211013_1538'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='banneredcampaignpage', | ||
name='petition_cta', | ||
field=models.ForeignKey(blank=True, help_text='Choose an existing, or create a new, pettition form', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='banner_page_for_petition', to='wagtailpages.petition'), | ||
), | ||
migrations.AddField( | ||
model_name='campaignpage', | ||
name='petition_cta', | ||
field=models.ForeignKey(blank=True, help_text='Choose existing or create new sign-up form', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='campaign_page_for_petition', to='wagtailpages.petition'), | ||
), | ||
migrations.RunPython( | ||
code=copy_cta_to_petition_cta | ||
), | ||
] |
21 changes: 21 additions & 0 deletions
21
network-api/networkapi/wagtailpages/migrations/0039_cta_refactor_2.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,21 @@ | ||
# Generated by Django 3.1.11 on 2021-09-23 18:14 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('wagtailpages', '0038_cta_refactor_1'), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name='banneredcampaignpage', | ||
name='cta', | ||
), | ||
migrations.RemoveField( | ||
model_name='campaignpage', | ||
name='cta', | ||
), | ||
] |
42 changes: 42 additions & 0 deletions
42
network-api/networkapi/wagtailpages/migrations/0040_cta_refactor_3.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,42 @@ | ||
# Generated by Django 3.1.11 on 2021-09-23 18:23 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
def copy_petition_cta_to_cta(apps, schema_editor): | ||
CTA = apps.get_model("wagtailpages", "CTA") | ||
|
||
models = [ | ||
apps.get_model("wagtailpages", "CampaignPage"), | ||
apps.get_model("wagtailpages", "BanneredCampaignPage"), | ||
] | ||
|
||
for Model in models: | ||
for page in Model.objects.all(): | ||
if page.petition_cta: | ||
page.cta = CTA.objects.get( | ||
pk=page.petition_cta.pk, | ||
) | ||
page.save() | ||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('wagtailpages', '0039_cta_refactor_2'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='banneredcampaignpage', | ||
name='cta', | ||
field=models.ForeignKey(blank=True, help_text='Choose an existing, or create a new, pettition form', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='banner_page_for_cta', to='wagtailpages.cta'), | ||
), | ||
migrations.AddField( | ||
model_name='campaignpage', | ||
name='cta', | ||
field=models.ForeignKey(blank=True, help_text='Choose existing or create new sign-up form', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='campaign_page_for_cta', to='wagtailpages.cta'), | ||
), | ||
migrations.RunPython( | ||
code=copy_petition_cta_to_cta | ||
) | ||
] |
21 changes: 21 additions & 0 deletions
21
network-api/networkapi/wagtailpages/migrations/0041_cta_refactor_4.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,21 @@ | ||
# Generated by Django 3.1.11 on 2021-09-23 19:25 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('wagtailpages', '0040_cta_refactor_3'), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name='banneredcampaignpage', | ||
name='petition_cta', | ||
), | ||
migrations.RemoveField( | ||
model_name='campaignpage', | ||
name='petition_cta', | ||
), | ||
] |
45 changes: 45 additions & 0 deletions
45
network-api/networkapi/wagtailpages/migrations/0042_add_callpower_cta.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,45 @@ | ||
# Generated by Django 3.1.11 on 2021-10-19 21:33 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
import uuid | ||
import wagtail.core.fields | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('wagtailcore', '0062_comment_models_and_pagesubscription'), | ||
('wagtailpages', '0041_cta_refactor_4'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='banneredcampaignpage', | ||
name='cta', | ||
field=models.ForeignKey(blank=True, help_text='Choose one of our call-to-action snippets, or create a new one.', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='banner_page_for_cta', to='wagtailpages.cta'), | ||
), | ||
migrations.AlterField( | ||
model_name='campaignpage', | ||
name='cta', | ||
field=models.ForeignKey(blank=True, help_text='Choose one of our call-to-action snippets, or create a new one.', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='campaign_page_for_cta', to='wagtailpages.cta'), | ||
), | ||
migrations.CreateModel( | ||
name='Callpower', | ||
fields=[ | ||
('cta_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailpages.cta')), | ||
('translation_key', models.UUIDField(default=uuid.uuid4, editable=False)), | ||
('campaign_id', models.CharField(help_text='Which Callpower campaign identifier should this CTA be tied to?', max_length=20)), | ||
('call_button_label', models.CharField(default='Make the call', help_text='The call button label (defaults to "Make the call")', max_length=20)), | ||
('success_heading', models.CharField(default='Thank you for calling', help_text='The heading users will see after clicking the call button (defaults to "Thank you for calling")', max_length=50)), | ||
('success_text', wagtail.core.fields.RichTextField(blank=True, help_text='The text users will see after clicking the call button')), | ||
('locale', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='wagtailcore.locale')), | ||
], | ||
options={ | ||
'verbose_name': 'callpower snippet', | ||
'abstract': False, | ||
'unique_together': {('translation_key', 'locale')}, | ||
}, | ||
bases=('wagtailpages.cta', models.Model), | ||
), | ||
] |
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
12 changes: 9 additions & 3 deletions
12
network-api/networkapi/wagtailpages/templates/wagtailpages/tags/cta.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,9 +1,15 @@ | ||
{% load wagtailcore_tags mini_site_tags %} | ||
{{ cta.type }} | ||
|
||
{% if cta_type == 'Petition' %} | ||
{% if cta_type == 'petition' %} | ||
{% include './cta/petition.html' %} | ||
{% endif %} | ||
|
||
{% if cta_type == 'Signup' %} | ||
|
||
{% if cta_type == 'signup' %} | ||
{% include './cta/signup.html' %} | ||
{% endif %} | ||
|
||
|
||
{% if cta_type == 'callpower' %} | ||
{% include './cta/callpower.html' %} | ||
{% endif %} |
46 changes: 46 additions & 0 deletions
46
network-api/networkapi/wagtailpages/templates/wagtailpages/tags/cta/callpower.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,46 @@ | ||
{% load i18n static %} | ||
|
||
<div class="callpower-cta"> | ||
<form class="cta-form"> | ||
<h5 class="h5-heading">{{ cta.header }}</h5> | ||
<p>{{ cta.description | safe }}</p> | ||
<div> | ||
<input type="hidden" name="campaignId" value="{{ cta.campaign_id }}"> | ||
{% with inputclass="tw-w-full tw-transition-colors tw-px-3 tw-py-4 tw-my-1 tw-text-xl tw-text-black tw-font-sans tw-border tw-border-solid tw-border-gray-20 focus:tw-border-[#80bdff] tw-outline-none" %} | ||
|
||
<input type="text" name="userPhone" placeholder="{% trans "Your phone number" %}" class="{{ inputclass }}" | ||
data-pattern="^\d{10}$" aria-label="{% trans "Please enter a ten digit US phone number" %}"> | ||
<p class="body-small tw-text-red-dark tw-hidden">{% trans "Please enter a ten digit US phone number" %}</p> | ||
|
||
<input type="text" name="userZipCode" placeholder="{% trans "Your zipcode" %}" class="{{ inputclass }}" | ||
data-pattern="^\d{5}$" aria-label="{% trans "Please enter a five digit US zip code" %}"> | ||
<p class="body-small tw-text-red-dark tw-hidden">{% trans "Please enter a five digit US zip code" %}</p> | ||
|
||
{% endwith %} | ||
</div> | ||
<p class="tw-text-red-dark error-400 tw-hidden tw-mt-5"> | ||
{% trans "We’re sorry, we can’t call that number. Please check that it is the right number, or try a different one." %} | ||
</p> | ||
<button class="make-the-call btn btn-primary tw-w-full tw-mt-5" disabled>{{ cta.call_button_label }}</button> | ||
</form> | ||
|
||
<div class="callpower-cta success tw-hidden"> | ||
<h5>{{ cta.success_heading }}</h5> | ||
<p>{{ cta.success_text | safe }}</p> | ||
<div class="share-button-group-wrapper d-print-none" data-layout="stacked" | ||
data-share-text="{% blocktrans with title=page.title %}{{ title }} by @mozilla{% endblocktrans %}" | ||
data-link="{{ request.scheme }}://{{ request.get_host }}{{ request.get_full_path }}"></div> | ||
</div> | ||
|
||
<div class="callpower-cta unknown error-section tw-hidden"> | ||
<h5>{% trans "Something went wrong…" %}</h5> | ||
<p>{% trans "We’re sorry, we seem to be having some trouble. Please try again later." %}</p> | ||
</div> | ||
|
||
<div class="callpower-cta limit error-section tw-hidden"> | ||
<h5>{% trans "Thank you for all your calls!" %}</h5> | ||
<p>{% trans "Unfortunately, it looks like you’ve reached the hourly limit. Please try again in an hour." %}</p> | ||
</div> | ||
</div> | ||
|
||
<script src='{% static "_js/callpower.compiled.js" %}'' async defer></script> |
Oops, something went wrong.