Commit 75e3845d by Matt Tuchfarber

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.
parent 17dd47bf
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
.program_title { .program_title {
font-weight: bold; font-weight: bold;
margin-top: $baseline
} }
.logo { .logo {
...@@ -23,10 +24,12 @@ ...@@ -23,10 +24,12 @@
.main-banner { .main-banner {
color: white; color: white;
margin-bottom: 1px; margin-bottom: 1px;
background-size: cover;
background-repeat: no-repeat;
background-position: center;
.authoring-org-logo { .authoring-org-logo {
background-color: $white; background-color: $white;
margin-bottom: $baseline;
} }
.btn { .btn {
...@@ -34,7 +37,6 @@ ...@@ -34,7 +37,6 @@
} }
.btn, .btn,
.authoring-org-logo,
h1, h1,
h2, h2,
a { a {
...@@ -48,6 +50,7 @@ ...@@ -48,6 +50,7 @@
button { button {
background-color: transparent; background-color: transparent;
color: $white
} }
iframe { iframe {
......
...@@ -44,7 +44,7 @@ expected_learning_items = program['expected_learning_items'] ...@@ -44,7 +44,7 @@ expected_learning_items = program['expected_learning_items']
authoring_organizations = program['authoring_organizations'] authoring_organizations = program['authoring_organizations']
min_hours_effort_per_week = program['min_hours_effort_per_week'] min_hours_effort_per_week = program['min_hours_effort_per_week']
max_hours_effort_per_week = program['max_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', '') banner_image = program.get('banner_image', {}).get('large', {}).get('url', '')
%> %>
...@@ -54,7 +54,7 @@ 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']}</%block> <%block name="pagetitle">${program['title']}</%block>
<div id="program-details-page" class="container"> <div id="program-details-page" class="container">
<div class="row main-banner" style="background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5) ), url(${banner_image}) no-repeat center;"> <div class="row main-banner" style="background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5) ), url(${banner_image});">
<div class="col col-12 col-md-8"> <div class="col col-12 col-md-8">
% if authoring_organizations and authoring_organizations[0]['logo_image_url']: % if authoring_organizations and authoring_organizations[0]['logo_image_url']:
<div> <div>
...@@ -80,12 +80,14 @@ banner_image = program.get('banner_image', {}).get('large', {}).get('url', '') ...@@ -80,12 +80,14 @@ banner_image = program.get('banner_image', {}).get('large', {}).get('url', '')
</div> </div>
</div> </div>
<div class="col col-12 col-md-4"> <div class="col col-12 col-md-4">
% if video_url:
<div id="program_video"> <div id="program_video">
<button type="button" class="btn" aria-label="${_('Play')}" onclick="playVideo('${video_url}')"> <button type="button" class="btn" aria-label="${_('Play')}" onclick="playVideo('${video_url}')">
<span class="icon fa fa-4x fa-play-circle" aria-hidden="true"></span> <span class="icon fa fa-4x fa-play-circle" aria-hidden="true"></span>
</button> </button>
<iframe class="align-middle" title="${_('YouTube Video')}" src="" frameborder="0" allowfullscreen style="display:none;"></iframe> <iframe class="align-middle" title="${_('YouTube Video')}" src="" frameborder="0" allowfullscreen style="display:none;"></iframe>
</div> </div>
% endif
</div> </div>
</div> </div>
<div class="row quick-nav"> <div class="row quick-nav">
......
...@@ -81,6 +81,11 @@ class StdImageFactory(ImageFactoryBase): ...@@ -81,6 +81,11 @@ class StdImageFactory(ImageFactoryBase):
url = factory.Faker('image_url') url = factory.Faker('image_url')
class VideoFactory(DictFactoryBase):
src = factory.Faker('url')
description = factory.Faker('sentence')
def generate_sized_stdimage(): def generate_sized_stdimage():
return { return {
size: StdImageFactory() for size in ['large', 'medium', 'small', 'x-small'] size: StdImageFactory() for size in ['large', 'medium', 'small', 'x-small']
...@@ -187,6 +192,7 @@ class ProgramFactory(DictFactoryBase): ...@@ -187,6 +192,7 @@ class ProgramFactory(DictFactoryBase):
title = factory.Faker('catch_phrase') title = factory.Faker('catch_phrase')
type = factory.Faker('word') type = factory.Faker('word')
uuid = factory.Faker('uuid4') uuid = factory.Faker('uuid4')
video = VideoFactory()
weeks_to_complete = fake.random_int(1, 45) weeks_to_complete = fake.random_int(1, 45)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment