Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Youtube Regrets 2022 Starter #9273

Merged
merged 12 commits into from
Sep 1, 2022
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
YoutubeRegretsReporterPage,
YoutubeRegretsReporterExtensionPage,
YoutubeRegrets2021Page,
YoutubeRegrets2022Page,
)
from wagtail_factories import (
PageFactory
Expand Down Expand Up @@ -62,6 +63,19 @@ class Meta:
slug = 'findings'


class YoutubeRegrets2022PageFactory(PageFactory):
class Meta:
model = YoutubeRegrets2022Page
exclude = (
'title_text',
'header_text',
'header',
)

title = 'YouTube Regrets 2022'
slug = 'findings-2022'


class YoutubeRegretsReporterPageFactory(PageFactory):
class Meta:
model = YoutubeRegretsReporterPage
Expand Down Expand Up @@ -117,6 +131,7 @@ def generate(seed):
title=reporter_page_title,
)
YoutubeRegrets2021PageFactory.create(parent=youtube_regrets)
YoutubeRegrets2022PageFactory.create(parent=youtube_regrets)
reseed(seed)

# Youtube Extension Landing page
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Generated by Django 3.2.13 on 2022-08-26 22:42

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


class Migration(migrations.Migration):

dependencies = [
('wagtailimages', '0023_add_choose_permissions'),
('wagtailcore', '0066_collection_management_permissions'),
('wagtailpages', '0041_alter_blogindexpage_related_topics'),
]

operations = [
migrations.CreateModel(
name='YoutubeRegrets2022Page',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.page')),
('search_image', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image', verbose_name='Search image')),
],
options={
'verbose_name': 'YouTube Regrets 2022 Page',
'verbose_name_plural': 'YouTube Regrets 2022 Pages',
},
bases=(wagtailmetadata.models.WagtailImageMetadataMixin, 'wagtailcore.page', models.Model),
),
]
1 change: 1 addition & 0 deletions network-api/networkapi/wagtailpages/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
YoutubeRegretsPage,
YoutubeRegretsReporterPage,
YoutubeRegrets2021Page,
YoutubeRegrets2022Page,
YoutubeRegretsReporterExtensionPage
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ class BanneredCampaignPage(PrimaryPage):
'ArticlePage',
'YoutubeRegretsReporterExtensionPage',
'YoutubeRegrets2021Page',
'YoutubeRegrets2022Page',
'YoutubeRegretsPage'
]

Expand Down
26 changes: 26 additions & 0 deletions network-api/networkapi/wagtailpages/pagemodels/youtube.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,32 @@ class Meta:
verbose_name_plural = "YouTube Regrets 2021 Pages"


class YoutubeRegrets2022Page(FoundationMetadataPageMixin, Page):

template = 'wagtailpages/pages/youtube-regrets-2022/youtube_regrets_2022.html'
max_count = 1
zen_nav = True

translatable_fields = [
# Promote tab fields
SynchronizedField('slug'),
TranslatableField('seo_title'),
SynchronizedField('show_in_menus'),
TranslatableField('search_description'),
SynchronizedField('search_image'),
# Content tab fields
TranslatableField('title'),
]

def get_context(self, request):
context = super().get_context(request)
return set_main_site_nav_information(self, context, 'Homepage')

class Meta:
verbose_name = "YouTube Regrets 2022 Page"
verbose_name_plural = "YouTube Regrets 2022 Pages"


class YoutubeRegretsReporterExtensionPage(FoundationMetadataPageMixin, Page):

template = 'wagtailpages/pages/regrets-reporter-landing-page/youtube_regrets_reporter_extension.html'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


{% block content_wrapped %}
<main role="main">
<main>
{% block main %}
<div class="transition-bg">
{# Hero #}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{% extends "pages/base.html" %}
{% load wagtailcore_tags %}

{% block body_id %}youtube-regrets-2022{% endblock %}
{% block bodyclass %}youtube-regrets-2022{% endblock %}

{% block extended_head %}
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Changa:wght@600;700&display=swap" rel="stylesheet">
{% endblock %}

{# Empty header; Do not add <header role="banner"> to the page #}
{% block header_wrapped %}{% endblock %}

{% block content_wrapped %}
<main>
{% block main %}
{% endblock %}
</main>
{% endblock %}


{% block footer_block %}
{% include "partials/footer.html" %}
{% endblock %}