{% extends 'navbar.html' %}
{% block title %} {{ title }}  {% endblock %}

{% block body_block %}

{% if search %}

  {% for user in result %}

  <div class="row">
    <div class="col-sm-2">
      {% if user.user_profile.profile_pic %}
        <img src="/media/{{ user.user_profile.profile_pic }}" width="75px" height="75px" class="rounded-circle">
      {% else %}
      <img src="/media/profile_pics/download.jpg" width="75px" height="75px" class="rounded-circle" >
      {% endif %}
    </div>

    <div class="col-sm-10">

   <a href="{% url 'App_Login:user' username=user.username %}"><h6>{{ user.username }}</h6></a>
      <h6>{{ user.user_profile.full_name }}</h6>

    </div>
  </div>
  {% endfor %}


{% else %}

 <div class="row">
   <div class="col-sm-8">
     {% for post in posts %}
     <div style="border:1px solid #ddd;">
       <div class="">
 {% if post.author.user_profile.profile_pic %}
   <img src="/media/{{ post.author.user_profile.profile_pic }}" width="50px" height="50px" class="rounded-circle">
 {% else %}
 <img src="/media/profile_pics/download.jpg" width="50px" height="50px" class="rounded-circle" >
 {% endif %}
 <a href="{% url 'App_Login:user' username=post.author %}">{{ post.author }}</a>
       </div>

    <br>
    <img src="/media/{{post.image}}" width="100%">
    <div style="padding:20px;">
      <h3>{{ post.caption }}</h3>

      {% if post.pk in liked_post_list %}
<a href="{% url 'App_Posts:unliked' pk=post.pk %}"><i class="fa fa-heart" style="font-size:36px"></i></a>
      {% else %}
<a href="{% url 'App_Posts:liked' pk=post.pk %}"><i class="fa fa-heart-o" style="font-size:36px"></i></a>
      {% endif %}

    </div>
     </div>
     {% endfor %}
   </div>


   <div class="col-sm-4">
     <div class="row">
       <div class="col-sm-4">
         {% if user.user_profile.profile_pic %}
           <img src="/media/{{ user.user_profile.profile_pic }}" width="75px" height="75px" class="rounded-circle">
         {% else %}
         <img src="/media/profile_pics/download.jpg" width="75px" height="75px" class="rounded-circle" >
         {% endif %}
       </div>

       <div class="col-sm-8">
         <b>{{ user.username }}</b><br>
         <b>{{ user.user_profile.full_name }}</b>
       </div>

     </div>

   </div>

 </div>




{% endif %}


{% endblock %}
