Clean up video partial

This commit is contained in:
Oliver Davies 2019-06-12 21:37:32 +01:00
parent 2943bcfc33
commit da7c6ce527

View file

@ -1,31 +1,16 @@
{% macro videoSrc(talk) %} {% macro videoSrc(video) %}
{# TODO: Cleanup once videos have been added to talks properly. #}
{% set videoType = talk.video.type %}
{% set videoId = talk.video.id %}
{% if talk.youtube %}
{% set videoType = 'youtube' %}
{% set videoId = talk.youtube.id %}
{% endif %}
{% if talk.vimeo %}
{% set videoType = 'vimeo' %}
{% set videoId = talk.vimeo.id %}
{% endif %}
{% set srcUrls = { {% set srcUrls = {
youtube: '//www.youtube.com/embed', youtube: '//www.youtube.com/embed',
videopress: 'https://videopress.com/embed', videopress: 'https://videopress.com/embed',
vimeo: 'https://player.vimeo.com/video', vimeo: 'https://player.vimeo.com/video',
} %} } %}
{{ srcUrls[videoType] ~ '/' ~ videoId }} {{ srcUrls[video.type] ~ '/' ~ video.id }}
{% endmacro %} {% endmacro %}
{% from _self import videoSrc %} {% from _self import videoSrc %}
{# TODO: Cleanup once videos have been added to talks properly. #} {% if page.video.id %}
{% if page.youtube.id or page.vimeo.id or page.video %}
<div class="mt-4"> <div class="mt-4">
<h2 class="mb-2">Video</h2> <h2 class="mb-2">Video</h2>
@ -33,7 +18,7 @@
<iframe <iframe
width="678" width="678"
height="408" height="408"
src="{{ videoSrc(page) }}" src="{{ videoSrc(page.video) }}"
frameborder="0" frameborder="0"
allowfullscreen allowfullscreen
> >