Commit c6b9c2f9 authored by Seb's avatar Seb
Browse files

Fixed areas that would fail if no thumbnail is found for the video

parent e998fd3b
......@@ -17,7 +17,13 @@
{% for video in videos %}
<li>
<a class="image-choice" href="{% if will_select_format %}{% url 'wagtailvideos:chooser_select_format' video.id %}{% else %}{% url 'wagtailvideos:video_chosen' video.id %}{% endif %}">
<div class="image"><img src='{{video.thumbnail.url}}' width="165" height="165" class="show-transparency"></div>
<div class="image">
{% if video.thumbnail %}
<img src='{{video.thumbnail.url}}' width="165" height="165" class="show-transparency">
{% else %}
<img width="165" height="165" class="show-transparency">
{% endif %}
</div>
<h3>{{ video.title|ellipsistrim:60 }}</h3>
</a>
</li>
......
......@@ -16,7 +16,9 @@
</ul>
</form>
<div data-video-thumb="{{ video.id }}" class='thumb icon icon-image hasthumb'>
{% if video.thumbnail %}
<img src="{{ video.thumbnail.url }}" />
{% endif %}
</div>
<script>
......
......@@ -20,8 +20,10 @@
<li>
<a class="image-choice" href="{% url 'wagtailvideos:edit' video.id %}">
<div class="image">
{% if video.thumbnail %}
<img src='{{video.thumbnail.url}}' height=165 width=165 class="show-transparency" /></img>
</div>
{% endif %}
</div>
<h3>{{ video.title|ellipsistrim:60 }}</h3>
</a>
</li>
......
......@@ -4,7 +4,7 @@
{% block chosen_state_view %}
<div class="video-thumb">
{% if video %}
{% if video and video.thumbnail %}
<img src='{{video.thumbnail.url}}' width="165" height="165" class="show-transparency">
{% else %}
<img width="165" height="165" class="show-transparency">
......
......@@ -41,7 +41,8 @@ class VideoNode(template.Node):
if not video:
raise template.TemplateSyntaxError("video tag requires a Video object as the first parameter")
self.attrs['poster'] = video.thumbnail.url
if video.thumbnail:
self.attrs['poster'] = video.thumbnail.url
mime = mimetypes.MimeTypes()
sources = ["<source src='{0}' type='{1}'>"
......
......@@ -30,7 +30,7 @@ def get_video_json(video):
'edit_link': reverse('wagtailvideos:edit', args=(video.id,)),
'title': video.title,
'preview': {
'url': video.thumbnail.url,
'url': video.thumbnail.url if video.thumbnail else '',
}
})
......
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