{% extends 'base.html' %}


{% block content %}
<div class="row">
    <div class="row">
        <div class="medium-8 medium-offset-2 columns results-title">
            {% if section %}
            <h3> {{section }}</h3>
            {% else %}
            <h3> Search results </h3>
            {% endif %}
        </div>
    </div>
    {% for row in content %}
    {% if row.type.name == 'news' %}
    <div class="row">
        <div class= "medium-8 medium-offset-2 columns">
            <h6 class="sidebar-date"> <font color="#ef4e5c"> <b> {{row.datestart}} </b> 
            {{ row.title }} <br />
            {{ row.formatted_header|striptags|safe }} </font> 
            </h6>
        </div>
    </div>
    {% else %}
    <div class="row results">
        <div class="small-6 medium-4 medium-offset-2 large-2 large-offset-2 columns">
            {% if row.image_url %}
            <a href="{{ row.get_absolute_url }}"> <img src="{{ row.image_url }}"> </a>
            {% endif %}
        </div>
        <div class="small-6 medium-4 end columns">
            <a href="{{ row.get_absolute_url }}" class="sidebar-title">{{ row.title }}</a>
            {% if row.type.name == 'events' %}
            <h6 class="sidebar-date"> <font color="#ef4e5c">  <b> {{ row.datestart }} {% if row.dateend %} - {{row.dateend}} {% endif %} </b></font> 
            {% if row.place %}<br/> {{row.place}} {% endif%}</h6>
            {% endif %}
            <p> {{row.formatted_teaser}} </p>
            <a href="{{ row.get_absolute_url }}">read more</a> </p>
        </div>
    </div>
    {% endif %}
    {% endfor %}
    <br>
    <br>
    {% if content.has_other_pages %}
    <div class="row">
        <div class="medium-8 medium-offset-2 end columns">
          <ul class="pagination">
            {% if content.has_previous %}
              <li><a href="?{{ base_query }}&page={{ content.previous_page_number }}">&laquo;</a></li>
            {% else %}
              <li class="disabled"><span>&laquo;</span></li>
            {% endif %}
            {% for i in content.paginator.page_range %}
              {% if content.number == i %}
                <li class="active"><span>{{ i }} <span class="sr-only">(current)</span></span></li>
              {% else %}
              <li><a href="?{{ base_query }}page={{ i }}">{{ i }}</a></li>
              {% endif %}
            {% endfor %}
            {% if content.has_next %}
                <li><a href="?{{ base_query }}page={{ content.next_page_number }}">&raquo;</a></li>
            {% else %}
              <li class="disabled"><span>&raquo;</span></li>
            {% endif %}
          </ul>
        </div>
    </div>
{% endif %}
</div>
{% endblock %}