{% extends 'Front/layout.html.twig' %}

{% set metatitle = content.metatitle ? content.metatitle : content.menu %}
{% set metadescription = content.metadescription ? content.metadescription : null %}

{% set bodyClass = content.menu.class %}

{% block body %}
    <div class="row">
        <div class="content list col">
            <div class="content-text">
                {{ content.article|replace_custom_keys|raw }}
            </div>

            <div class="row list-cards cards-testimonials">
                {% for testimonial in testimonials %}
                    {% set picture = testimonial.getWebPicture() %}
                    <div class="col-md-12">
                        <article class="item card bg-auto has-round-picture">
                            <header class="item-header">
                                    <div class="figure" style="background-image: url({% if picture is not empty %}{{ asset(picture|imagine_filter('250Lx250H'))|replace({' ' : '%20'}) }}{% endif %});"></div>
                                    <h3 class="item-title h6 text-no-transform">
                                    {{ testimonial.witness }}
                                </h3>
                                <p class="item-occupation text-small">{{ testimonial.occupation }}</p>

                                <div class="item-content">
                                <div class="item-desc quote">
                                    <p>{{ include('Front/_component/icon.html.twig', {id: 'quote', class:'icon-quote'}) }}{{ testimonial.content|striptags|truncate(300, false, '…')|raw }}</p>
                                </div>
                    
                                {% if testimonial.content|striptags|length > 300 %}
                                <footer class="item-more-actions">
                                    <p>
                                        {# <a class="btn btn-xs btn-white" data-fancybox data-type="ajax" href="{{ path('modal_testimonial', {testimonial:testimonial.id}) }}" rel="nofollow">
                                            {{ 'word.learn_more'|trans({}, 'word') }}
                                        </a> #}
                                        <a class="btn btn-xs btn-white" href="{{ path('single_testimonial', {idlevel1:content.menu.id, titlelevel1:content.menu.slug, id:testimonial.id, title: testimonial.witness|lower|replace({' ':'-'})|url_encode}) }}" rel="nofollow">
                                            {{ 'word.learn_more'|trans({}, 'word') }}
                                        </a>
                                    </p>
                                </footer>
                                {% endif %}
                            </div>
                            
                            </header>
                            
                        </article>
                    </div>
                {% endfor %}
            </div>

            {% include 'Front/Paginator/pagination.html.twig' with {
                pages:pagination|length
            } only %}
        </div>

        {% include "Front/_part/sidebar.html.twig" %}
    </div>
{% endblock %}

{% block before_body %} 
    {% set pageHeaderPicture = ( content.picture ? asset(content.getWebPath()) : null ) %}
    {% set pageHeaderTitle = content.title %}
    {% set pageHeaderIntroduction = content.introduction|replace_custom_keys|raw %}
    {% include "Front/_part/page-header.html.twig" %}
    {{ render(controller('AppBundle:Render:module', { position:'before_body' })) }}
{% endblock %}

{% block after_body %} 
    {{ render(controller('AppBundle:Render:module', { position:'after_body' })) }}
{% endblock %}