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

Fixed image chooser type and tweaked some fields #1148

Merged
merged 3 commits into from
May 7, 2021
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
17 changes: 12 additions & 5 deletions pages/management/commands/create_home_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,22 @@ def handle(self, *args, **options):
homepage.features_headline="More than just books."
homepage.features_tab1_heading="For Instructors"
homepage.features_tab2_heading="For Students"
homepage.features_tab1_features=json.dumps(
[{"type": "feature_text", "value": "LMS Integration"},
{"type": "feature_text", "value": "Test banks"},
{"type": "feature_text", "value": "Answer guides"},
{"type": "feature_text", "value": "Powerpoint slides"}]
)
homepage.features_tab1_explore_text="Explore now"
homepage.features_tab1_explore_url="https://openstax.org/subjects"
homepage.features_tab1_explore_logged_in_text="Explore Now"
homepage.features_tab1_explore_logged_in_url="https://openstax.org/subjects"
homepage.features_tab2_features = json.dumps(
[{"type": "feature_text", "value": "Highlighting"},
{"type": "feature_text", "value": "Note-taking"},
{"type": "feature_text", "value": "Multiple different book formats"},
{"type": "feature_text", "value": "Low cost or free"}]
)
homepage.features_tab2_explore_text="Explore Now"
homepage.features_tab2_explore_url="https://openstax.org/subjects"
homepage.quotes_headline="Improving education for students and instructors."
Expand All @@ -44,11 +56,6 @@ def handle(self, *args, **options):
homepage.tutor_button_link="https://openstax.org/openstax-tutor"
homepage.tutor_demo_text="Schedule a demo"
homepage.tutor_demo_link="https://calendly.com/creighton-2"
homepage.tutor_features_cards=json.dumps([
{"type": "cards", "value": {"title": "Title lorem ipsum", "description": "<p>We break textbook readings into easy to digest segments with videos, simulations, and conceptual questions.</p>"}},
{"type": "cards", "value": {"title": "Title lorem ipsum", "description": "<p>Spaced practice, personalized questions, and other features help students learn more efficiently and effectively.</p>"}},
{"type": "cards", "value": {"title": "Title lorem ipsum", "description": "<p>You can build homework assignments with questions from the book, additional assessments, and personalized questions.</p>"}},
])
homepage.whats_openstax_headline="What’s OpenStax"
homepage.whats_openstax_description="OpenStax is part of Rice University, which is a 501(c)(3) nonprofit charitable corporation. Our mission is to improve educational access and learning for everyone. We do this by publishing openly licensed books, developing and improving research-based courseware, establishing partnerships with educational resource companies, and more."
homepage.whats_openstax_donate_text="We couldn’t do what we do without the help of our generous supporters."
Expand Down
35 changes: 35 additions & 0 deletions pages/migrations/0041_auto_20210506_1329.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Generated by Django 3.0.4 on 2021-05-06 18:29

from django.db import migrations
import wagtail.core.blocks
import wagtail.core.fields


class Migration(migrations.Migration):

dependencies = [
('pages', '0040_auto_20210505_1339'),
]

operations = [
migrations.RenameField(
model_name='homepage',
old_name='tutor_logo_url',
new_name='tutor_logo',
),
migrations.RenameField(
model_name='homepage',
old_name='whats_openstax_image_url',
new_name='whats_openstax_image',
),
migrations.AlterField(
model_name='homepage',
name='features_tab1_features',
field=wagtail.core.fields.StreamField([('resources', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock([('link_text', wagtail.core.blocks.CharBlock(required=False))])))]),
),
migrations.AlterField(
model_name='homepage',
name='features_tab2_features',
field=wagtail.core.fields.StreamField([('resources', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock([('link_text', wagtail.core.blocks.CharBlock(required=False))])))]),
),
]
25 changes: 25 additions & 0 deletions pages/migrations/0042_auto_20210506_1347.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Generated by Django 3.0.4 on 2021-05-06 18:47

from django.db import migrations
import wagtail.core.blocks
import wagtail.core.fields


class Migration(migrations.Migration):

dependencies = [
('pages', '0041_auto_20210506_1329'),
]

operations = [
migrations.AlterField(
model_name='homepage',
name='features_tab1_features',
field=wagtail.core.fields.StreamField([('feature_text', wagtail.core.blocks.CharBlock())]),
),
migrations.AlterField(
model_name='homepage',
name='features_tab2_features',
field=wagtail.core.fields.StreamField([('feature_text', wagtail.core.blocks.CharBlock())]),
),
]
26 changes: 26 additions & 0 deletions pages/migrations/0043_auto_20210506_1453.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Generated by Django 3.0.4 on 2021-05-06 19:53

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


class Migration(migrations.Migration):

dependencies = [
('pages', '0042_auto_20210506_1347'),
]

operations = [
migrations.RemoveField(
model_name='homepage',
name='tutor_features_cards',
),
migrations.AddField(
model_name='homepage',
name='tutor_features',
field=wagtail.core.fields.StreamField([('features', wagtail.core.blocks.ListBlock(wagtail.core.blocks.StructBlock([('image', pages.custom_blocks.APIImageChooserBlock(required=False)), ('title', wagtail.core.blocks.CharBlock(required=False))])))], default=''),
preserve_default=False,
),
]
50 changes: 25 additions & 25 deletions pages/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,20 +214,18 @@ class HomePage(Page):
features_tab2_heading = models.CharField(default='', blank=True, max_length=255)
features_tab1_features = StreamField(
blocks.StreamBlock([
('resources', blocks.ListBlock(blocks.StructBlock([
('icon', APIImageChooserBlock(required=False)),
('link_text', blocks.CharBlock(required=False)),
])))], max_num=4))
('feature_text', blocks.CharBlock())
], max_num=4)
)
features_tab1_explore_text = models.CharField(default='', blank=True, max_length=255)
features_tab1_explore_url = models.URLField(blank=True, default='')
features_tab1_explore_logged_in_text = models.CharField(default='', blank=True, max_length=255)
features_tab1_explore_logged_in_url = models.URLField(blank=True, default='')
features_tab2_features = StreamField(
blocks.StreamBlock([
('resources', blocks.ListBlock(blocks.StructBlock([
('icon', APIImageChooserBlock(required=False)),
('link_text', blocks.CharBlock(required=False)),
])))], max_num=4))
('feature_text', blocks.CharBlock())
], max_num=4)
)
features_tab2_explore_text = models.CharField(default='', blank=True, max_length=255)
features_tab2_explore_url = models.URLField(blank=True, default='')
features_bg_image = models.ForeignKey(
Expand Down Expand Up @@ -260,7 +258,7 @@ class HomePage(Page):
related_name='+'
)

tutor_logo_url = models.ForeignKey(
tutor_logo = models.ForeignKey(
'wagtailimages.Image',
null=True,
blank=True,
Expand All @@ -272,18 +270,20 @@ class HomePage(Page):
tutor_button_link = models.URLField(blank=True, default='')
tutor_demo_text = models.CharField(default='', blank=True, max_length=255)
tutor_demo_link = models.URLField(blank=True, default='')
tutor_features_cards = StreamField([
('cards', CardBlock()),
])

tutor_features = StreamField(
blocks.StreamBlock([
('features', blocks.ListBlock(blocks.StructBlock([
('image', APIImageChooserBlock(required=False)),
('title', blocks.CharBlock(required=False)),
])))], max_num=4))
whats_openstax_headline = models.CharField(default='', blank=True, max_length=255)
whats_openstax_description = models.TextField(default='', blank=True)
whats_openstax_donate_text = models.TextField(default='', blank=True)
whats_openstax_give_text = models.CharField(default='', blank=True, max_length=255)
whats_openstax_give_link = models.URLField(blank=True, default='')
whats_openstax_learn_more_text = models.CharField(default='', blank=True, max_length=255)
whats_openstax_learn_more_link = models.URLField(blank=True, default='')
whats_openstax_image_url = models.ForeignKey(
whats_openstax_image = models.ForeignKey(
'wagtailimages.Image',
null=True,
blank=True,
Expand Down Expand Up @@ -326,21 +326,21 @@ class HomePage(Page):
APIField('quotes'),
APIField('quotes_instructor_image'),
APIField('quotes_student_image'),
APIField('tutor_logo_url'),
APIField('tutor_logo'),
APIField('tutor_description'),
APIField('tutor_button_text'),
APIField('tutor_button_link'),
APIField('tutor_demo_text'),
APIField('tutor_demo_link'),
APIField('tutor_features_cards'),
APIField('tutor_features'),
APIField('whats_openstax_headline'),
APIField('whats_openstax_description'),
APIField('whats_openstax_donate_text'),
APIField('whats_openstax_give_text'),
APIField('whats_openstax_give_link'),
APIField('whats_openstax_learn_more_text'),
APIField('whats_openstax_learn_more_link'),
APIField('whats_openstax_image_url'),
APIField('whats_openstax_image'),
APIField('slug'),
APIField('seo_title'),
APIField('search_description'),
Expand All @@ -362,8 +362,8 @@ class Meta:
FieldPanel('banner_login_link'),
FieldPanel('banner_logged_in_text'),
FieldPanel('banner_logged_in_link'),
FieldPanel('banner_left_image'),
FieldPanel('banner_right_image'),
ImageChooserPanel('banner_left_image'),
ImageChooserPanel('banner_right_image'),
FieldPanel('features_headline'),
FieldPanel('features_tab1_heading'),
FieldPanel('features_tab2_heading'),
Expand All @@ -375,26 +375,26 @@ class Meta:
StreamFieldPanel('features_tab2_features'),
FieldPanel('features_tab2_explore_text'),
FieldPanel('features_tab2_explore_url'),
FieldPanel('features_bg_image'),
ImageChooserPanel('features_bg_image'),
FieldPanel('quotes_headline'),
StreamFieldPanel('quotes'),
FieldPanel('quotes_instructor_image'),
FieldPanel('quotes_student_image'),
FieldPanel('tutor_logo_url'),
ImageChooserPanel('quotes_instructor_image'),
ImageChooserPanel('quotes_student_image'),
ImageChooserPanel('tutor_logo'),
FieldPanel('tutor_description'),
FieldPanel('tutor_button_text'),
FieldPanel('tutor_button_link'),
FieldPanel('tutor_demo_text'),
FieldPanel('tutor_demo_link'),
StreamFieldPanel('tutor_features_cards'),
StreamFieldPanel('tutor_features'),
FieldPanel('whats_openstax_headline'),
FieldPanel('whats_openstax_description'),
FieldPanel('whats_openstax_donate_text'),
FieldPanel('whats_openstax_give_text'),
FieldPanel('whats_openstax_give_link'),
FieldPanel('whats_openstax_learn_more_text'),
FieldPanel('whats_openstax_learn_more_link'),
FieldPanel('whats_openstax_image_url'),
ImageChooserPanel('whats_openstax_image'),
]

promote_panels = [
Expand Down