{% comment %}
Displaying a queryset of Photos in columns, with pagination.

Expects:
 * photo_list, a queryset of Photos.
 * perms - The Django perms object.
 * page_obj - Optional, a DiggPaginator instance or False (default).
 * order - Either 'uploaded' or 'taken'.
 * view - 'list' (a generic list), 'detail' or 'day'.
{% endcomment %}

{% if photo_list|length > 0 %}
    {% if page_obj|default:False and page_obj.number > 1 %}
        {% include 'ditto/includes/pagination.html' with page_obj=page_obj only %}
    {% endif %}

    {% load ditto_core %}

    <div class="d-flex flex-wrap flickr-photos flickr-photos-columns">
        {% for photo in photo_list %}
            <div class="flickr-photo col-12 col-sm-6 col-md-4 p-3">
                <h3 class="h6">
                    <a href="{% url 'flickr:photo_detail' nsid=photo.user.nsid flickr_id=photo.flickr_id %}">{{ photo.title }}</a>
                </h3>
                <p class="flickr-photo-img mb-0">
                    <a href="{% url 'flickr:photo_detail' nsid=photo.user.nsid flickr_id=photo.flickr_id %}">
                        <img src="{{ photo.small_url }}" width="{{ photo.small_width }}" height="{{ photo.small_height }}" alt="" class="img-fluid">
                    </a>
                </p>
                <p class="flickr-photo-meta"><small class="text-muted">
                    {% if order == 'taken' %}
                        Taken
                        {% if view == 'day' %}
                            {% display_time photo.taken_time link_to_day=False granularity=photo.taken_granularity %}
                        {% else %}
                            {% display_time photo.taken_time link_to_day=True granularity=photo.taken_granularity %}
                        {% endif %}
                    {% else %}
                        Uploaded
                        {% if view == 'day' %}
                            {% display_time photo.post_time link_to_day=False granularity=photo.taken_granularity %}
                        {% else %}
                            {% display_time photo.post_time link_to_day=True granularity=photo.taken_granularity %}
                        {% endif %}
                    {% endif %}
                </small></p>
            </div> <!-- .flickr-photo -->
        {% endfor %}
    </div> <!-- .flickr-photos -->


    {% if page_obj|default:False %}
        {% include 'ditto/includes/pagination.html' with page_obj=page_obj only %}
    {% endif %}
{% else %}

    <p>There are no Photos to show.</p>
{% endif %}



