{% extends "base.html" %}
{% block content %}


<div class='col-sm-6 col-sm-offset-3'>
    <h1>{{ title }}</h1>
<form method='GET' action='' class='row'>
        <div class='col-sm-6'>
            <div class='input-group'>
                <input class='form-control' type='text' name='q' placeholder='Search posts' value='{{ request.GET.q }}'/>
                <span class='input-group-btn'>
                    <!-- <input class='btn btn-default' type='submit' value='Search' /> -->
                    <button class='btn btn-default' type='submit'>Search <i class="fa fa-search"></i></button>
                </span>
            </div>
        </div>
</form>
{% for obj in object_list %}
<div class="row">
  <div class="col-sm-12">
    <div class="thumbnail">
        {% if obj.image %}
         <img src='{{ obj.image.url }}' class='img-responsive' />
        {% endif %}
      <div class="caption post-detail-item">
        {% if obj.draft %}<h3>Staff only: Draft</h3>{% endif %} {% if obj.publish > today %}<h3>Staff Only: Future Post</h3>{% endif %}
        <h3><a href='{{ obj.get_absolute_url }}'>{{ obj.title }}</a> <small>{{ obj.publish }}</small></h3>
        <p><a class='like-btn' data-href='{{ obj.get_api_like_url }}' data-likes='{{ obj.likes.count }}'  href='{{ obj.get_like_url }}'>{{ obj.likes.count }} Like</a></p>
        {% if obj.user.get_full_name %}<p>Author: {{ obj.user.get_full_name }}</p>{% endif %}
        {{ obj.get_markdown|truncatechars_html:120 }}
        <p><a href="{{ obj.get_absolute_url }}" class="btn btn-primary" role="button">View</a></p>
      </div>
    </div>
  </div>
<hr/>
</div>
{% endfor %}


<div class="pagination">
    <span class="step-links">
        {% if object_list.has_previous %}
            <a href="?{{ page_request_var }}={{ object_list.previous_page_number }}{% if request.GET.q %}&q={{ request.GET.q }}{% endif %}">previous</a>
        {% endif %}

        <span class="current">
            Page {{ object_list.number }} of {{ object_list.paginator.num_pages }}.
        </span>

        {% if object_list.has_next %}
            <a href="?{{ page_request_var }}={{ object_list.next_page_number }}{% if request.GET.q %}&q={{ request.GET.q }}{% endif %}">next</a>
        {% endif %}
    </span>
</div>




</div>

{% endblock content %}