{% load ninecms_extras %}
{% comment %}
Block template for static content
Author: George Karakostas
Copyright: Copyright 2015, George Karakostas
Licence: BSD-3
Email: gkarak@9-dev.com
{% endcomment %}
<div class="static content {{ classes }}">
    <div class="body">{{ node.body|safe }}</div>
    {% if node.image_set.all %}
        <div class="imageset">
            {% for img in node.image_set.all %}
                <div class="image thumbnail">
                    <img src="{{ img.image.url|image_style:'large' }}" alt="{{ img.title }}">
                </div>
            {% endfor %}
        </div>
    {% endif %}
    {#  Attention: it is recommended that this is disabled and added on particular templates only (causes db hit) #}
    {% if node.video_set.all %}
        <video id="node-{{ node.id }}" class="video-js vjs-default-skin" preload="auto" autoplay loop
                {% for source in node.video_set.all %}
                    {% if source.type == 'jpg' %}poster="{{ source.video.url }}"{% endif %}
                {% endfor %}>
            {% for source in node.video_set.all %}
                {% if source.type != 'swf' and source.type != 'jpg' %}
                    <source src="{{ source.video.url }}" type="{{ source.get_type_display }}" media="{{ source.media }}"/>
                {% elif source.type == 'swf' %}
                    <embed src="{{ source.video.url }}" type="application/x-shockwave-flash"></embed>
                {% elif source.type == 'jpg' %}
                    <img src="{{ source.video.url }}" alt="{{ content.title }}">
                {% endif %}
            {% endfor %}
            <p class="vjs-no-js">To view this video please enable JavaScript, and consider upgrading to a web browser that <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a></p>
        </video>
    {% endif %}
</div>
