{% extends "base.html" %}
{% load static %}

{% block title %}Albums{% endblock %}

{% block content %}

<div class="row">
    <div class="col-lg-12">
        <h1>Albums</h1>
    </div>
</div>

{% if object_list %}
{% for album in object_list.all %}
<div class="row">
    <div class="col-lg-12 album-sample">
        <h2><a href="{{album.get_absolute_url}}">{{album.title}}</a></h2>
        <p>{{album.date_added | date:"F d, Y"}}</p>
        <div class="grid">
        {% for media in album.media.all %}
            {% if media.video.thumbnail %}
            <div class="grid-item ">
                <a href="{{media.video.get_absolute_url }}" >
                    <img src="{{media.video.thumbnail.url }}" class="img-thumbnail video" width="200" />
                </a>
            </div>
            {% else %}
            <div class="grid-item">
                <a href="{{ media.photo.get_absolute_url }}" >
                    <img src="{{media.photo.src.url}}" class="img-thumbnail photo" width="200" /></li>
                </a>
            </div>
            {% endif %}
         {% endfor %}
    </div>
{% endfor %}
{% else %}
<div class="row">
    <div class="col-lg-12">No albums were found.</div>
</div>
{% endif %}
{% endblock %}
