{% extends 'Front/layout.html.twig' %}
{% set metatitle = content.metatitle ? content.metatitle : content.menu ~ ' - Cgénial' %}
{% set metadescription = content.metadescription? content.metadescription: null %}

{% block javascripts %}
    <script>
        //<![CDATA[
        $(function() {
            $('.fancybox').fancybox();
            
            if( $('.filtreMedia li a').hasClass("items_{{ type }}")){
                $('.filtreMedia li a.items_{{ type }}').addClass('current');
            }
        });
        //]]>
    </script>
{% endblock %}

{% block body %}
    <div class="content media {{ content.menu.class }}">
        <div class="text">
            <h1>{{ content.title }}</h1>
            {{ content.article|raw }}<br/>
        </div>
        
        <ul class="filtreMedia">
            <li><a class="items_All" href="{{ path('list_media',{'id':parentid,'title':parenttitle,'type':'All'}) }}" >{{ content.title }}</a></li>
            {% for child in childs %}
                <li><a class="items_{{ child.id }}" href="{{ path('list_media',{'id':parentid,'title':parenttitle,'type':child.id}) }}" >{{ child.title }}</a></li>
            {% endfor %}
        </ul>

        <ul class="listMedia">
            {% for video in videos %}
                <li>
                    <div class="topVideo">
                        <h3>{{ video.title }}</h3>
                        <span class="date">{{ video.created|date("d/m/Y") }}</span>
                    </div>
                    <a href="{{ path('video',{'ref':video.path}) }}" class="imgBlock fancybox fancybox.ajax"><img src="//i1.ytimg.com/vi/{{ video.path }}/default.jpg" alt="{{ video.title }}"></a>
                    {{ video.description|striptags|truncate(200, false, '...')|raw }}
                </li>
            {% endfor %}
        </ul>
    </div>          
    {#{ render(controller('AppBundle:Templates:modules',{'menu':'default'})) }#}
{% endblock %}