diff --git a/cms/constants.py b/cms/constants.py index 7d7cf3143..029c30707 100644 --- a/cms/constants.py +++ b/cms/constants.py @@ -32,6 +32,73 @@ FORMAT_HYBRID = "Hybrid" FORMAT_OTHER = "Other" +HOW_YOU_WILL_LEARN_SECTION = { + "title": "HOW YOU WILL LEARN", + "technique_items": [ + { + "type": "techniques", + "value": { + "heading": "LEARN BY DOING", + "sub_heading": "Practice processes and methods through simulations, assessments, case studies, and tools.", + "image": "static/images/how_you_will_learn/idea.png", + }, + }, + { + "type": "techniques", + "value": { + "heading": "LEARN FROM OTHERS", + "sub_heading": "Connect with an international community of professionals while working on projects based on real-world examples.", + "image": "static/images/how_you_will_learn/network.png", + }, + }, + { + "type": "techniques", + "value": { + "heading": "LEARN ON DEMAND", + "sub_heading": "Access all of the content online and watch videos on the go.", + "image": "static/images/how_you_will_learn/work-balance.png", + }, + }, + { + "type": "techniques", + "value": { + "heading": "REFLECT AND APPLY", + "sub_heading": "Bring your new skills to your organization, through examples from technical work environments and ample prompts for reflection.", + "image": "static/images/how_you_will_learn/feedback.png", + }, + }, + { + "type": "techniques", + "value": { + "heading": "DEMONSTRATE YOUR SUCCESS", + "sub_heading": "Earn a Professional Certificate and CEUs from MIT xPRO.", + "image": "static/images/how_you_will_learn/certificate.png", + }, + }, + { + "type": "techniques", + "value": { + "heading": "LEARN FROM THE BEST", + "sub_heading": "Gain insights from leading MIT faculty and industry experts.", + "image": "static/images/how_you_will_learn/trend-speaker.png", + }, + }, + ], +} + +B2B_SECTION = { + "title": "THE BEST COMPANIES CONNECT WITH THE BEST MINDS AT MIT", + "content": """ +

Deepen your team's career knowledge and expand their abilities with MIT xPRO's online courses for professionals. Develop customized learning for your team with bespoke courses and programs on your schedule. Set a standard of knowledge and skills, leading to effective communication among employees and consistency across the enterprise.

+ +

Find out what MIT xPRO can do for your team.

+ + """, + "action_title": "INQUIRE NOW", + "action_url": "https://learn-xpro.mit.edu/for-teams#b2bform", + "image": "static/images/enterprise/enterprise-colab.jpg", +} + class CatalogSorting(enum.Enum): """Catalog sorting option""" diff --git a/cms/models.py b/cms/models.py index ce99a1e85..4550690b1 100644 --- a/cms/models.py +++ b/cms/models.py @@ -78,6 +78,7 @@ CatalogSorting, ) from cms.forms import CertificatePageForm, CoursewareForm +from cms.utils import create_b2b_section, create_how_you_will_learn_section from courses.constants import DEFAULT_COURSE_IMG_PATH, PROGRAM_RUN_ID_PATTERN from courses.models import ( Course, @@ -1487,6 +1488,23 @@ class ExternalCoursePage(CourseProductPage): template = "product_page.html" + def save(self, *args, **kwargs): + if not self.id: + super().save(*args, **kwargs) + return + + icongrid_page = self.get_child_page_of_type_including_draft( + LearningTechniquesPage + ) + if not icongrid_page: + icongrid_page = create_how_you_will_learn_section() + self.add_child(instance=icongrid_page) + + b2b_page = self.get_child_page_of_type_including_draft(ForTeamsPage) + if not b2b_page: + b2b_page = create_b2b_section() + self.add_child(instance=b2b_page) + class ExternalProgramPage(ProgramProductPage): """ diff --git a/cms/utils.py b/cms/utils.py new file mode 100644 index 000000000..822ffecf6 --- /dev/null +++ b/cms/utils.py @@ -0,0 +1,36 @@ +from pathlib import Path + +from django.core.files import File +from wagtail.images.models import Image + +from cms.constants import B2B_SECTION, HOW_YOU_WILL_LEARN_SECTION + + +def create_how_you_will_learn_section(): + from cms.models import LearningTechniquesPage + + section_content = HOW_YOU_WILL_LEARN_SECTION.copy() + for technique in section_content["technique_items"]: + image_title = technique["value"]["heading"] + with Path(technique["value"]["image"]).open("rb") as img: + img_file = File(img) + image, _ = Image.objects.get_or_create( + title=image_title, defaults={"file": img_file} + ) + technique["value"]["image"] = image.id + + return LearningTechniquesPage(**section_content) + + +def create_b2b_section(): + from cms.models import ForTeamsPage + + section_content = B2B_SECTION.copy() + with Path(section_content["image"]).open("rb") as img: + img_file = File(img) + image, _ = Image.objects.get_or_create( + title=section_content["title"], defaults={"file": img_file} + ) + section_content["image"] = image + + return ForTeamsPage(**section_content) diff --git a/static/images/enterprise/enterprise-colab.jpg b/static/images/enterprise/enterprise-colab.jpg new file mode 100644 index 000000000..0e05d3074 Binary files /dev/null and b/static/images/enterprise/enterprise-colab.jpg differ diff --git a/static/images/how_you_will_learn/certificate.png b/static/images/how_you_will_learn/certificate.png new file mode 100644 index 000000000..8ea141d1a Binary files /dev/null and b/static/images/how_you_will_learn/certificate.png differ diff --git a/static/images/how_you_will_learn/feedback.png b/static/images/how_you_will_learn/feedback.png new file mode 100644 index 000000000..5cc8002cd Binary files /dev/null and b/static/images/how_you_will_learn/feedback.png differ diff --git a/static/images/how_you_will_learn/idea.png b/static/images/how_you_will_learn/idea.png new file mode 100644 index 000000000..9f328716b Binary files /dev/null and b/static/images/how_you_will_learn/idea.png differ diff --git a/static/images/how_you_will_learn/network.png b/static/images/how_you_will_learn/network.png new file mode 100644 index 000000000..edd75592e Binary files /dev/null and b/static/images/how_you_will_learn/network.png differ diff --git a/static/images/how_you_will_learn/trend-speaker.png b/static/images/how_you_will_learn/trend-speaker.png new file mode 100644 index 000000000..c9b083c13 Binary files /dev/null and b/static/images/how_you_will_learn/trend-speaker.png differ diff --git a/static/images/how_you_will_learn/work-balance.png b/static/images/how_you_will_learn/work-balance.png new file mode 100644 index 000000000..1c34690db Binary files /dev/null and b/static/images/how_you_will_learn/work-balance.png differ