{% extends "home/base.html" %}
{% block content %}
{% load static %}
{% load humanize %}
<div class="boxed-content">
    <div class="channel-banner">
        <a href="{% url 'channel_id' channel_info.channel_id %}"><img src="{{ channel_info.channel_banner_url }}" alt="channel_banner"></a>
    </div>
    <div class="info-box-item child-page-nav">
        <a href="{% url 'channel_id' channel_info.channel_id %}"><h3>Videos</h3></a>
        {% if has_streams %}
            <a href="{% url 'channel_id_live' channel_info.channel_id %}"><h3>Streams</h3></a>
        {% endif %}
        {% if has_shorts %}
            <a href="{% url 'channel_id_shorts' channel_info.channel_id %}"><h3>Shorts</h3></a>
        {% endif %}
        {% if has_playlists %}
            <a href="{% url 'channel_id_playlist' channel_info.channel_id %}"><h3>Playlists</h3></a>
        {% endif %}
        <a href="{% url 'channel_id_about' channel_info.channel_id %}"><h3>About</h3></a>
        {% if has_pending %}
            <a href="{% url 'downloads' %}?channel={{ channel_info.channel_id }}"><h3>Downloads</h3></a>
        {% endif %}
    </div>
    <div id="notifications" data="channel reindex"></div>
    <div class="view-controls">
        <div class="toggle">
            <span>Show subscribed only:</span>
            <div class="toggleBox">
                <input id="show_subed_only" onclick="toggleCheckbox(this)" type="checkbox" {% if show_subed_only %}checked{% endif %}>
                {% if not show_subed_only %}
                    <label for="" class="ofbtn">Off</label>
                {% else %}
                    <label for="" class="onbtn">On</label>
                {% endif %}
            </div>
        </div>
        <div class="view-icons">
            <img src="{% static 'img/icon-gridview.svg' %}" onclick="changeView(this)" data-origin="playlist" data-value="grid" alt="grid view">
            <img src="{% static 'img/icon-listview.svg' %}" onclick="changeView(this)" data-origin="playlist" data-value="list" alt="list view">
        </div>
    </div>
    <div class="playlist-list {{ view_style }}">
        {% if results %}
            {% for playlist in results %}
            <div class="playlist-item {{ view_style }}">
                <div class="playlist-thumbnail">
                    <a href="{% url 'playlist_id' playlist.playlist_id %}">
                        <img src="/cache/playlists/{{ playlist.playlist_id }}.jpg" alt="{{ playlist.playlist_id }}-thumbnail">
                    </a>
                </div>
                <div class="playlist-desc {{ view_style }}">
                    <a href="{% url 'channel_id' playlist.playlist_channel_id %}"><h3>{{ playlist.playlist_channel }}</h3></a>
                    <a href="{% url 'playlist_id' playlist.playlist_id %}"><h2>{{ playlist.playlist_name }}</h2></a>
                    <p>Last refreshed: {{ playlist.playlist_last_refresh }}</p>
                    {% if playlist.playlist_subscribed %}
                        <button class="unsubscribe" type="button" data-type="playlist" data-subscribe="" data-id="{{ playlist.playlist_id }}" onclick="subscribeStatus(this)" title="Unsubscribe from {{ playlist.playlist_name }}">Unsubscribe</button>
                    {% else %}
                        <button type="button" data-type="playlist" data-subscribe="true" data-id="{{ playlist.playlist_id }}" onclick="subscribeStatus(this)" title="Subscribe to {{ playlist.playlist_name }}">Subscribe</button>
                    {% endif %}
                </div>
            </div>
            {% endfor %}
        {% else %}
            <h2>No playlists found...</h2>
        {% endif %}
    </div>
</div>
<script type="text/javascript" src="{% static 'progress.js' %}"></script>
{% endblock content %}