Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 9 additions & 0 deletions pages/custom_blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,12 @@ class CardImageBlock(blocks.StructBlock):

class Meta:
icon = 'image'


class StoryBlock(blocks.StreamBlock):
image = APIImageChooserBlock(required=False)
story_text = blocks.TextBlock(required=False)
embeded_video = blocks.RawHTMLBlock(required=False)

class Meta:
icon = 'openquote'
71 changes: 71 additions & 0 deletions pages/management/commands/create_impact_page.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import json
from django.core.management.base import BaseCommand
from pages.models import HomePage, Impact

class Command(BaseCommand):
help = "create initial impact page after a deployment"

def handle(self, *args, **options):
homepage = HomePage.objects.first() # there's only one home page, so this should be okay
impact_page = Impact(
title="Our Impact",
improving_access=json.dumps([
{"type": "content",
"value": {"heading": "Improving Educational Access and Learning for Everyone",
"description": "<p>Based at Rice University, OpenStax is one of the world\u2019s largest nonprofit digital learning platforms and publisher of free, open education resources. Join us and help millions of students experience an affordable, engaging education.</p>",
"button_text": "Give today", "button_href": "https://openstax.org/give"}}
]),
reach=json.dumps([
{"type": "content", "value": {"heading": "Our Reach",
"description": "<p><b>COVID-19 Impact:</b> Demand for OpenStax more than doubled in the pandemic, so our team rapidly increased learning resources to support instructors and their students with virtual learning. Please make a gift to help us continue to meet this urgent need.</p>",
"cards": [[{"type": "description",
"value": "$1.2 billion saved in education costs since 2012"},
{"type": "link_text", "value": "Read more >"},
{"type": "link_href", "value": "https://openstax.org"}], [
{"type": "description",
"value": "4 million students from 120 countries use OpenStax"},
{"type": "link_text", "value": "See the map >"},
{"type": "link_href", "value": "https://openstax.org"}], [
{"type": "description",
"value": "60 percent of higher education institutions in US use OpenStax"}], [
{"type": "description",
"value": "4 thousand+ K-12 schools use OpenStax"}]]},
}
]),
quote=json.dumps([
{"type": "content",
"value": {"quote": "<p>Amidst COVID-19, educational problems are complex and in constant flux, making it critical that we support students in their learning. OpenStax is expanding its library to new subject areas, deepening student engagement with our digital learning tools, and advancing the frontiers of learning science to help make education engaging and personal. It is through this personalization that we believe we can bring greater equity and quality to education for students worldwide.</p><p></p><p><b>\u2013 Dr. Richard Baraniuk,</b></p><p>Founder of OpenStax, Victor E. Cameron Professor of Electrical and Computer Engineering at Rice University, and Fellow of the American Academy of Arts and Sciences</p>"},
}
]),
making_a_difference=json.dumps([
{"type": "content", "value": {"heading": "Making a Difference",
"description": "<p>Learn more from those who have been directly impacted by OpenStax.</p>",
}}
]),
disruption=json.dumps([
{"type": "content", "value": {"heading": "Positive Disruption",
"description": "The price of textbooks is declining due to open education\u2019s disruption of the college textbook market, removing financial barriers to advanced education, and reducing student debt. According to an economist, \u201cThe \u2018textbook bubble\u2019 is finally starting to deflate, due to the creative destruction and competition from free/low-cost textbooks from groups like OpenStax\u201d (Mark Perry, AEI, 2019).",
"graph": {
"top_caption": "Consumer Price Index Educational Books and Supplies, January 1967 to September 2017",
"bottom_caption": "<p>https://www.aei.org/publication/wednesday-afternoon-links-30/</p><p>Published by Mark Perry on October 25, 2017, AEI.org</p>",
}},
}
]),
supporter_community=json.dumps([
{"type": "content", "value": {"heading": "Our Supporter Community",
"quote": "<p>OpenStax continues to expand to new subject areas, grade levels, and languages to reach more students. Yet, OpenStax is more than free textbooks. With a team of researchers, educators, and learning engineers at Rice University, OpenStax is creating research-based learning tools to help teachers and learners better personalize the education experience. OpenStax needs your partnership to continue its impact.</p><p></p><p>\u2013 <b>Ann Doerr</b>, OpenStax Advisor</p>",
"link_text": "View our supporters", "link_href": "https://openstax.org"},
}
]),
giving=json.dumps([
{"type": "content", "value": {"heading": "Students need your help today.",
"description": "Together, we can increase educational equity and quality for millions of students worldwide.",
"link": "Give today", "link_text": "https://openstax.org/give"},
}
])
)

homepage.add_child(instance=impact_page)
revision = impact_page.save_revision()
revision.publish()
impact_page.save()
30 changes: 30 additions & 0 deletions pages/migrations/0018_auto_20210126_0947.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Generated by Django 3.0.4 on 2021-01-26 15:47

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('wagtailcore', '0059_apply_collection_ordering'),
('wagtailredirects', '0006_redirect_increase_max_length'),
('wagtailforms', '0004_add_verbose_name_plural'),
('pages', '0017_tutorlanding'),
]

operations = [
migrations.RemoveField(
model_name='ourimpactinstitutions',
name='institutions_ptr',
),
migrations.RemoveField(
model_name='ourimpactinstitutions',
name='page',
),
migrations.DeleteModel(
name='OurImpact',
),
migrations.DeleteModel(
name='OurImpactInstitutions',
),
]
41 changes: 41 additions & 0 deletions pages/migrations/0019_auto_20210126_1056.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Generated by Django 3.0.4 on 2021-01-26 16:56

from django.db import migrations, models
import django.db.models.deletion
import pages.custom_blocks
import wagtail.core.blocks
import wagtail.core.fields
import wagtail.images.blocks


class Migration(migrations.Migration):

dependencies = [
('wagtailcore', '0059_apply_collection_ordering'),
('wagtailforms', '0004_add_verbose_name_plural'),
('wagtailredirects', '0006_redirect_increase_max_length'),
('pages', '0018_auto_20210126_0947'),
]

operations = [
migrations.CreateModel(
name='Impact',
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')),
('improving_access', wagtail.core.fields.StreamField([('image', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=False)), ('alt_text', wagtail.core.blocks.CharBlock(required=False)), ('link', wagtail.core.blocks.URLBlock(required=False)), ('alignment', pages.custom_blocks.ImageFormatChoiceBlock()), ('identifier', wagtail.core.blocks.CharBlock(help_text='Used by the frontend for Google Analytics.', required=False))])), ('heading', wagtail.core.blocks.CharBlock()), ('description', wagtail.core.blocks.RichTextBlock()), ('button_text', wagtail.core.blocks.CharBlock()), ('button_href', wagtail.core.blocks.URLBlock())], blank=True)),
('reach', wagtail.core.fields.StreamField([('heading', wagtail.core.blocks.CharBlock()), ('description', wagtail.core.blocks.RichTextBlock()), ('cards', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock([('icon', pages.custom_blocks.APIImageChooserBlock(required=False)), ('title', wagtail.core.blocks.CharBlock(required=True)), ('description', wagtail.core.blocks.RichTextBlock(required=True))])))], blank=True)),
('quote', wagtail.core.fields.StreamField([('image', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=False)), ('alt_text', wagtail.core.blocks.CharBlock(required=False)), ('link', wagtail.core.blocks.URLBlock(required=False)), ('alignment', pages.custom_blocks.ImageFormatChoiceBlock()), ('identifier', wagtail.core.blocks.CharBlock(help_text='Used by the frontend for Google Analytics.', required=False))])), ('quote', wagtail.core.blocks.RichTextBlock())], blank=True)),
('making_a_difference', wagtail.core.fields.StreamField([('heading', wagtail.core.blocks.CharBlock()), ('description', wagtail.core.blocks.RichTextBlock()), ('stories', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock([('image', pages.custom_blocks.APIImageChooserBlock(required=False)), ('story_text', wagtail.core.blocks.TextBlock(required=False)), ('embeded_video', wagtail.core.blocks.RawHTMLBlock(required=False))])))], blank=True)),
('disruption', wagtail.core.fields.StreamField([('heading', wagtail.core.blocks.CharBlock()), ('description', wagtail.core.blocks.TextBlock()), ('graph', wagtail.core.blocks.StructBlock([('top_caption', wagtail.core.blocks.CharBlock()), ('bottom_caption', wagtail.core.blocks.RichTextBlock()), ('image', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=False)), ('alt_text', wagtail.core.blocks.CharBlock(required=False)), ('link', wagtail.core.blocks.URLBlock(required=False)), ('alignment', pages.custom_blocks.ImageFormatChoiceBlock()), ('identifier', wagtail.core.blocks.CharBlock(help_text='Used by the frontend for Google Analytics.', required=False))], required=False)), ('image_alt_text', wagtail.core.blocks.CharBlock(required=False))]))], blank=True)),
('supporter_community', wagtail.core.fields.StreamField([('heading', wagtail.core.blocks.CharBlock()), ('image', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=False)), ('alt_text', wagtail.core.blocks.CharBlock(required=False)), ('link', wagtail.core.blocks.URLBlock(required=False)), ('alignment', pages.custom_blocks.ImageFormatChoiceBlock()), ('identifier', wagtail.core.blocks.CharBlock(help_text='Used by the frontend for Google Analytics.', required=False))])), ('quote', wagtail.core.blocks.RichTextBlock()), ('link_text', wagtail.core.blocks.CharBlock()), ('link_href', wagtail.core.blocks.URLBlock())], blank=True)),
('giving', wagtail.core.fields.StreamField([('heading', wagtail.core.blocks.CharBlock()), ('description', wagtail.core.blocks.TextBlock()), ('link', wagtail.core.blocks.CharBlock()), ('link_text', wagtail.core.blocks.CharBlock())], blank=True)),
],
options={
'abstract': False,
},
bases=('wagtailcore.page',),
),
migrations.DeleteModel(
name='AnnualReportPage',
),
]
22 changes: 22 additions & 0 deletions pages/migrations/0020_auto_20210126_1314.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Generated by Django 3.0.4 on 2021-01-26 19:14

from django.db import migrations
import pages.custom_blocks
import wagtail.core.blocks
import wagtail.core.fields
import wagtail.images.blocks


class Migration(migrations.Migration):

dependencies = [
('pages', '0019_auto_20210126_1056'),
]

operations = [
migrations.AlterField(
model_name='impact',
name='improving_access',
field=wagtail.core.fields.StreamField([('content', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StreamBlock([('image', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=False)), ('alt_text', wagtail.core.blocks.CharBlock(required=False)), ('link', wagtail.core.blocks.URLBlock(required=False)), ('alignment', pages.custom_blocks.ImageFormatChoiceBlock()), ('identifier', wagtail.core.blocks.CharBlock(help_text='Used by the frontend for Google Analytics.', required=False))])), ('heading', wagtail.core.blocks.CharBlock()), ('description', wagtail.core.blocks.RichTextBlock()), ('button_text', wagtail.core.blocks.CharBlock()), ('button_href', wagtail.core.blocks.URLBlock())], max_num=1), blank=True))]),
),
]
22 changes: 22 additions & 0 deletions pages/migrations/0021_auto_20210126_1318.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Generated by Django 3.0.4 on 2021-01-26 19:18

from django.db import migrations
import pages.custom_blocks
import wagtail.core.blocks
import wagtail.core.fields
import wagtail.images.blocks


class Migration(migrations.Migration):

dependencies = [
('pages', '0020_auto_20210126_1314'),
]

operations = [
migrations.AlterField(
model_name='impact',
name='improving_access',
field=wagtail.core.fields.StreamField([('content', wagtail.core.blocks.StructBlock([('image', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=False)), ('alt_text', wagtail.core.blocks.CharBlock(required=False)), ('link', wagtail.core.blocks.URLBlock(required=False)), ('alignment', pages.custom_blocks.ImageFormatChoiceBlock()), ('identifier', wagtail.core.blocks.CharBlock(help_text='Used by the frontend for Google Analytics.', required=False))])), ('heading', wagtail.core.blocks.CharBlock()), ('description', wagtail.core.blocks.RichTextBlock()), ('button_text', wagtail.core.blocks.CharBlock()), ('button_href', wagtail.core.blocks.URLBlock())], max_num=1))], blank=True),
),
]
47 changes: 47 additions & 0 deletions pages/migrations/0022_auto_20210126_1323.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Generated by Django 3.0.4 on 2021-01-26 19:23

from django.db import migrations
import pages.custom_blocks
import wagtail.core.blocks
import wagtail.core.fields
import wagtail.images.blocks


class Migration(migrations.Migration):

dependencies = [
('pages', '0021_auto_20210126_1318'),
]

operations = [
migrations.AlterField(
model_name='impact',
name='disruption',
field=wagtail.core.fields.StreamField([('content', wagtail.core.blocks.StructBlock([('heading', wagtail.core.blocks.CharBlock()), ('description', wagtail.core.blocks.TextBlock()), ('graph', wagtail.core.blocks.StructBlock([('top_caption', wagtail.core.blocks.CharBlock()), ('bottom_caption', wagtail.core.blocks.RichTextBlock()), ('image', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=False)), ('alt_text', wagtail.core.blocks.CharBlock(required=False)), ('link', wagtail.core.blocks.URLBlock(required=False)), ('alignment', pages.custom_blocks.ImageFormatChoiceBlock()), ('identifier', wagtail.core.blocks.CharBlock(help_text='Used by the frontend for Google Analytics.', required=False))], required=False)), ('image_alt_text', wagtail.core.blocks.CharBlock(required=False))]))], max_num=1))], blank=True),
),
migrations.AlterField(
model_name='impact',
name='giving',
field=wagtail.core.fields.StreamField([('content', wagtail.core.blocks.StructBlock([('heading', wagtail.core.blocks.CharBlock()), ('description', wagtail.core.blocks.TextBlock()), ('link', wagtail.core.blocks.CharBlock()), ('link_text', wagtail.core.blocks.CharBlock())], max_num=1))], blank=True),
),
migrations.AlterField(
model_name='impact',
name='making_a_difference',
field=wagtail.core.fields.StreamField([('content', wagtail.core.blocks.StructBlock([('heading', wagtail.core.blocks.CharBlock()), ('description', wagtail.core.blocks.RichTextBlock()), ('stories', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock([('image', pages.custom_blocks.APIImageChooserBlock(required=False)), ('story_text', wagtail.core.blocks.TextBlock(required=False)), ('embeded_video', wagtail.core.blocks.RawHTMLBlock(required=False))])))], max_num=1))], blank=True),
),
migrations.AlterField(
model_name='impact',
name='quote',
field=wagtail.core.fields.StreamField([('content', wagtail.core.blocks.StructBlock([('image', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=False)), ('alt_text', wagtail.core.blocks.CharBlock(required=False)), ('link', wagtail.core.blocks.URLBlock(required=False)), ('alignment', pages.custom_blocks.ImageFormatChoiceBlock()), ('identifier', wagtail.core.blocks.CharBlock(help_text='Used by the frontend for Google Analytics.', required=False))])), ('quote', wagtail.core.blocks.RichTextBlock())], max_num=1))], blank=True),
),
migrations.AlterField(
model_name='impact',
name='reach',
field=wagtail.core.fields.StreamField([('content', wagtail.core.blocks.StructBlock([('heading', wagtail.core.blocks.CharBlock()), ('description', wagtail.core.blocks.RichTextBlock()), ('cards', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock([('icon', pages.custom_blocks.APIImageChooserBlock(required=False)), ('title', wagtail.core.blocks.CharBlock(required=True)), ('description', wagtail.core.blocks.RichTextBlock(required=True))])))], max_num=1))], blank=True),
),
migrations.AlterField(
model_name='impact',
name='supporter_community',
field=wagtail.core.fields.StreamField([('content', wagtail.core.blocks.StructBlock([('heading', wagtail.core.blocks.CharBlock()), ('image', wagtail.core.blocks.StructBlock([('image', wagtail.images.blocks.ImageChooserBlock(required=False)), ('alt_text', wagtail.core.blocks.CharBlock(required=False)), ('link', wagtail.core.blocks.URLBlock(required=False)), ('alignment', pages.custom_blocks.ImageFormatChoiceBlock()), ('identifier', wagtail.core.blocks.CharBlock(help_text='Used by the frontend for Google Analytics.', required=False))])), ('quote', wagtail.core.blocks.RichTextBlock()), ('link_text', wagtail.core.blocks.CharBlock()), ('link_href', wagtail.core.blocks.URLBlock())], max_num=1))], blank=True),
),
]
Loading