{#-
 This file is part of Supysonic.
 Supysonic is a Python implementation of the Subsonic server API.

 Copyright (C) 2013-2018 Alban 'spl0k' Féron
                    2017 Óscar García Amor

 Distributed under terms of the GNU AGPLv3 license.
-#}
{% extends "layout.html" %}
{% block navbar_playlists %}
<li class="active"><a href="{{ url_for('frontend.playlist_index') }}">Playlists <span
                      class="sr-only">(current)</span></a></li>
{% endblock %}
{% block body %}
<div class="page-header first-header">
  <h2>Playlist "{{ playlist.name }}"</h2>
</div>
{% if playlist.user.id == request.user.id %}
<h3>Edit</h3>
<form method="post">
<table id="playlist" class="table">
  <thead>
    <tr><th>Name</th><th>Public</th><th></th></tr>
  </thead>
  <tbody>
    <tr>
      <td><input type="text" class="form-control" name="name" value="{{ playlist.name }}" /></td>
      <td><input type="checkbox" name="public" {% if playlist.public %}checked="true"{% endif %} /></td>
      <td><input class="btn btn-default" type="submit" /></td>
    </tr>
  </tbody>
</table>
</form>
{% endif %}
<h3>Tracks</h3>
<table class="table table-striped">
  <thead>
    <tr><th>Artist</th><th>Title</th><th>Album</th><th>Length</th></tr>
  </thead>
  <tbody>
    {% for t in playlist.get_tracks() %}
    <tr><td>{{ t.album.artist.name }}</td><td>{{ t.title }}</td><td>{{ t.album.name }}</td><td>{{ t.duration_str() }}</td></tr>
    {% endfor %}
  </tbody>
</table>
{% endblock %}
