{% extends 'partials/base.html.twig' %}


{% block content %}
{% include 'partials/head.html.twig' %}
<div class="columns large-3 medium-3 medium-offset-0 small-10 small-offset-1 side_container">
  {% include 'partials/sidebar.html.twig' %}
</div>

  <div class="post columns large-9 medium-9 small-12">
    <div class="row">
      <div class=" columns large-1 medium-1 medium-offset-0 small-10 small-offset-1" style="height:auto;">
        <div class="row post_picto_container">
          <div class="columns large-12 medium-12 medium-offset-0 small-1 small-offset-8 ">
            <div class="post_picto">
              <a href="mailto:mail?subject={{ page.title }}&body={{ uri.url }}">
              <img src="{{ url('theme://images/contact.svg') }}" alt="">
              </a>
            </div>
          </div>
          <div class="columns large-12 medium-12 small-1">
            <div class="post_picto">
              <a href="https://www.facebook.com/sharer/sharer.php?u={{uri.url }}" target="_blank">
              <img src="{{ url('theme://images/f.svg') }}" alt="">
              </a>
            </div>
          </div>
          <div class="columns large-12 medium-12 small-1">
            <div class="post_picto">
              <a href="https://twitter.com/intent/tweet?url={{ uri.url  }}&text={{ page.title }}" target="_blank">
              <img src="{{ url('theme://images/t.svg') }}" alt="">
              </a>
            </div>
          </div>
          <div class="columns large-12 medium-12 small-1">
            <div class="post_picto">
              <a href="https://www.linkedin.com/shareArticle?mini=true&url={{ uri.url }}&title={{ page.title }}" target="_blank">
              <img src="{{ url('theme://images/in.svg') }}" alt="">
              </a>
            </div>
          </div>
        </div>
      </div>
      <div class="columns post_content large-11 large-offset-0 medium-11 medium-offset-0 small-10 small-offset-1">
        <div class="row info_post">
          {% for cat in page.header.taxonomy.tag %}
            {% if cat == "Tribune" %}
                 {% set source = url('theme://images/trib.svg') %}
            {% else %}
                  {% set source = url('theme://images/com.svg') %}
            {% endif %}

            <div class=" columns large-12"><span class="post_cat"><img src="{{ source }}" alt="">  {{ cat }}</span>&nbsp;&nbsp;{{ (page.header.date != "") ? "Posté le "~page.header.date~", " : '' }} {{ (page.header.publish_date != "") ? "modifié le "~page.header.publish_date : '' }} {{ (page.header.author != "") ? "par "~page.header.author : '' }}</div>

          {% endfor %}
        </div>

        <p>
          {{ page.content }}
        </p>


      </div>

    </div>

  </div>
  <div class="post_bottom columns large-12 ">
    <div class="row">
      <div class="columns large-12 medium-12 small-12">
          <h1 class="inter" >{{ page.find('/actualites').title }}</h1>
      </div>

      {% for post in page.find('/actualites').children.remove(page.slug).order('date', 'desc').slice(0, 2) %}
          {% set source = post.header.media_thumbnail %}
          {% if source != null%}
            {% set info = "url('"~post.url~"/"~source~"')" %}
          {% else %}
            {% set info = null %}
          {% endif %}
          <div class=" columns large-6 medium-6 medium-offset-0 small-8 small-offset-2 recent-posts">
            <div  class=" row ">
              <div  class="columns large-12 thumb_news">
                <a style="background:{{ info }};" href="{{ post.url }}">
                  <div class="row">
                    <div class="columns large-8 align-self-bottom">
                      <mark>{{ post.title }}</mark>
                      <span class="tag" ><span>{{ post.header.taxonomy.tag|first }}</span></span>
                    </div>
                  </div>

                </a>
              </div>
            </div>
          </div>
      {% endfor %}
      {% for post in page.find('/actualites').children.remove(page.slug).order('date', 'desc').slice(2,3) %}
      {% set source = post.header.media_thumbnail %}
      {% if source != null%}
        {% set info = "url('"~post.url~"/"~source~"')" %}
      {% else %}
        {% set info = null %}
      {% endif %}
          <div  class="columns large-4 medium-4 medium-offset-0 small-8 small-offset-2 recent-posts">
            <div  class=" row ">
              <div  class="columns large-12 thumb_news">
                <a style="background:{{ info }};" href="{{ post.url }}">
                  <div class="row">
                    <div class="columns large-11 align-self-bottom">
                      <mark>{{ post.title }}</mark>
                      <span class="tag" ><span>{{ post.header.taxonomy.tag|first }}</span></span>
                    </div>
                  </div>
                </a>
              </div>
            </div>
          </div>
      {% endfor %}
      <div class="columns large-12 medium-12 medium-offset-0 small-8 small-offset-2 ">
        <a class="seemore" href="../actualites"> voir toutes les actualités</a>
      </div>
    </div>
  </div>
  <script>
  
  $("p img").each(function(){
    $(this).attr("src", window.location.href+"/"+$(this).attr("src"))
  });

</script>
{% endblock %}
