diff --git a/cms/migrations/0017_sections_generalize.py b/cms/migrations/0017_sections_generalize.py new file mode 100644 index 000000000..c31bb6ebc --- /dev/null +++ b/cms/migrations/0017_sections_generalize.py @@ -0,0 +1,21 @@ +# Generated by Django 2.1.7 on 2019-05-20 13:52 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [("cms", "0016_faculty_members_subpage")] + + operations = [ + migrations.AlterModelOptions( + name="forteamspage", options={"verbose_name": "Text-Image Section"} + ), + migrations.AlterModelOptions( + name="learningtechniquespage", options={"verbose_name": "Icon Grid"} + ), + migrations.AlterModelOptions( + name="usertestimonialspage", + options={"verbose_name": "Testimonials Section"}, + ), + ] diff --git a/cms/models.py b/cms/models.py index a1d524003..0a91ca6f8 100644 --- a/cms/models.py +++ b/cms/models.py @@ -53,7 +53,8 @@ def can_create_at(cls, parent): def save(self, *args, **kwargs): # autogenerate a unique slug so we don't hit a ValidationError - self.title = self.__class__._meta.verbose_name.title() + if not self.title: + self.title = self.__class__._meta.verbose_name.title() self.slug = slugify("{}-{}".format(self.get_parent().id, self.title)) super().save(*args, **kwargs) @@ -82,7 +83,7 @@ class UserTestimonialsPage(CourseProgramChildPage): ] class Meta: - verbose_name = "Testimonials Page" + verbose_name = "Testimonials Section" class LearningOutcomesPage(CourseProgramChildPage): @@ -128,7 +129,10 @@ class LearningTechniquesPage(CourseProgramChildPage): help_text="Enter detail about how you'll learn.", ) - content_panels = [StreamFieldPanel("technique_items")] + class Meta: + verbose_name = "Icon Grid" + + content_panels = [FieldPanel("title"), StreamFieldPanel("technique_items")] class ForTeamsPage(CourseProgramChildPage): @@ -153,7 +157,12 @@ class ForTeamsPage(CourseProgramChildPage): related_name="+", help_text="Image size must be at least 750x505 pixels.", ) + + class Meta: + verbose_name = "Text-Image Section" + content_panels = [ + FieldPanel("title"), FieldPanel("content"), FieldPanel("action_title"), FieldPanel("switch_layout"), diff --git a/courses/models.py b/courses/models.py index eb64ddb1a..8d3d18489 100644 --- a/courses/models.py +++ b/courses/models.py @@ -6,6 +6,7 @@ from django.db import models from django.contrib.auth import get_user_model from django.contrib.contenttypes.fields import GenericRelation +from django.urls import reverse from cms.models import ( LearningOutcomesPage, @@ -240,6 +241,20 @@ def course_lineup(self): """Gets the CoursesInProgram subpage if associated with this program""" return self._get_child_page_of_type(CoursesInProgramPage) + @property + def url(self): + """ + Gets the URL for this resource + """ + return NotImplementedError() + + @property + def type_name(self): + """ + Gets the descriptive word for the type of this resource + """ + return "program" + def __str__(self): return self.title @@ -314,6 +329,20 @@ def unexpired_runs(self): ) ) + @property + def url(self): + """ + Gets the URL for this resource + """ + return reverse("course-detail", kwargs={"pk": self.pk}) + + @property + def type_name(self): + """ + Gets the descriptive word for the type of this resource + """ + return "course" + class Meta: ordering = ("program", "title") diff --git a/courses/templates/course_app_base.html b/courses/templates/course_app_base.html index 59a8fe71c..94d9808cc 100644 --- a/courses/templates/course_app_base.html +++ b/courses/templates/course_app_base.html @@ -1,7 +1 @@ {% extends "base.html" %} -{% load render_bundle %} - -{% block headercontent %} -
- {% render_bundle 'header' %} -{% endblock %} diff --git a/courses/templates/course_detail.html b/courses/templates/course_detail.html index 924be1aec..0399a83b1 100644 --- a/courses/templates/course_detail.html +++ b/courses/templates/course_detail.html @@ -31,13 +31,15 @@ {% include "partials/subnav.html" with product=course %} {% if course.outcomes %} {% include "partials/learning-outcomes.html" %} {% endif %} {% if course.who_should_enroll %} {% include "partials/target-audience.html" %} {% endif %} - {% if course.techniques %} {% include "partials/learning-techniques.html" %} {% endif %} - {% if course.testimonials %} {% include "partials/testimonial-carousel.html" with testimonials=course.testimonials %} {% endif %} + {% if course.techniques %} {% include "partials/learning-techniques.html" with page=course.techniques %} {% endif %} + {% if course.testimonials %} {% include "partials/testimonial-carousel.html" with page=course.testimonials %} {% endif %} {% if course.faculty %} {% include "partials/faculty-carousel.html" %} {% endif %} {% if course.program and course.program.course_lineup %} - {% include "partials/course-carousel.html" with program=course.program %} + {% with courseware_objects=course.program.courses.all page=course.program.course_lineup %} + {% include "partials/course-carousel.html" with button_title="View Full Program" button_url="#" %} + {% endwith %} {% endif %} - {% if course.for_teams %} {% include "partials/for-teams.html" %} {% endif %} + {% if course.for_teams %} {% include "partials/for-teams.html" with page=course.for_teams %} {% endif %} {% if course.faqs %} {% include "partials/faqs.html" %} {% endif %} {% endblock %} diff --git a/courses/templates/partials/course-carousel.html b/courses/templates/partials/course-carousel.html index cb8173133..fbffccda7 100644 --- a/courses/templates/partials/course-carousel.html +++ b/courses/templates/partials/course-carousel.html @@ -2,26 +2,28 @@