From 75e3845dadeb9a0c4c3e9b7af872c91af55a7948 Mon Sep 17 00:00:00 2001 From: Matt Tuchfarber Date: Wed, 18 Oct 2017 10:19:58 -0400 Subject: [PATCH] Fix issue where program doesn't have video I wrongly assumed a video field wouldn't exist on a program that doesn't include a video. Since it exists and is set to null this fixes the retrieval of the source url. --- lms/static/sass/views/_program-marketing-page.scss | 7 +++++-- lms/templates/courseware/program_marketing.html | 6 ++++-- openedx/core/djangoapps/catalog/tests/factories.py | 6 ++++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/lms/static/sass/views/_program-marketing-page.scss b/lms/static/sass/views/_program-marketing-page.scss index b60cf3fd50..6e8149d151 100644 --- a/lms/static/sass/views/_program-marketing-page.scss +++ b/lms/static/sass/views/_program-marketing-page.scss @@ -3,6 +3,7 @@ .program_title { font-weight: bold; + margin-top: $baseline } .logo { @@ -23,10 +24,12 @@ .main-banner { color: white; margin-bottom: 1px; + background-size: cover; + background-repeat: no-repeat; + background-position: center; .authoring-org-logo { background-color: $white; - margin-bottom: $baseline; } .btn { @@ -34,7 +37,6 @@ } .btn, - .authoring-org-logo, h1, h2, a { @@ -48,6 +50,7 @@ button { background-color: transparent; + color: $white } iframe { diff --git a/lms/templates/courseware/program_marketing.html b/lms/templates/courseware/program_marketing.html index d5c8ffd955..7fbc53dd39 100644 --- a/lms/templates/courseware/program_marketing.html +++ b/lms/templates/courseware/program_marketing.html @@ -44,7 +44,7 @@ expected_learning_items = program['expected_learning_items'] authoring_organizations = program['authoring_organizations'] min_hours_effort_per_week = program['min_hours_effort_per_week'] max_hours_effort_per_week = program['max_hours_effort_per_week'] -video_url = program.get('video', {}).get('src', '') +video_url = program['video'].get('src') if program['video'] else '' banner_image = program.get('banner_image', {}).get('large', {}).get('url', '') %> @@ -54,7 +54,7 @@ banner_image = program.get('banner_image', {}).get('large', {}).get('url', '') <%block name="pagetitle">${program['title']}
-
+
% if authoring_organizations and authoring_organizations[0]['logo_image_url']:
@@ -80,12 +80,14 @@ banner_image = program.get('banner_image', {}).get('large', {}).get('url', '')
+ % if video_url:
+ % endif
diff --git a/openedx/core/djangoapps/catalog/tests/factories.py b/openedx/core/djangoapps/catalog/tests/factories.py index 945f56b3ec..78b3cabbbc 100644 --- a/openedx/core/djangoapps/catalog/tests/factories.py +++ b/openedx/core/djangoapps/catalog/tests/factories.py @@ -81,6 +81,11 @@ class StdImageFactory(ImageFactoryBase): url = factory.Faker('image_url') +class VideoFactory(DictFactoryBase): + src = factory.Faker('url') + description = factory.Faker('sentence') + + def generate_sized_stdimage(): return { size: StdImageFactory() for size in ['large', 'medium', 'small', 'x-small'] @@ -187,6 +192,7 @@ class ProgramFactory(DictFactoryBase): title = factory.Faker('catch_phrase') type = factory.Faker('word') uuid = factory.Faker('uuid4') + video = VideoFactory() weeks_to_complete = fake.random_int(1, 45)