playlists.html 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
  2. <h1 class="h2">{{ playlist_type_display|title }} <span class="badge bg-primary rounded-pill">{{ playlists.count }}</span></h1>
  3. <div class="btn-toolbar mb-2 mb-md-0">
  4. <button type="button" class="btn btn-outline-success dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
  5. Sort By
  6. </button>
  7. <ul class="dropdown-menu">
  8. <li><a class="dropdown-item" hx-get="{% url 'order_playlists_by' playlist_type 'playlist-duration-in-seconds' %}" hx-trigger="click" hx-target="#search-results">Duration</a></li>
  9. <li><a class="dropdown-item" hx-get="{% url 'order_playlists_by' playlist_type 'video-count' %}" hx-trigger="click" hx-target="#search-results"># Videos</a></li>
  10. <li><a class="dropdown-item" hx-get="{% url 'order_playlists_by' playlist_type 'recently-accessed' %}" hx-trigger="click" hx-target="#search-results">Recently Accessed</a></li>
  11. </ul>
  12. </div>
  13. </div>
  14. <div class="">
  15. <input class="form-control border border-secondary" type="text"
  16. name="search" placeholder="Begin to search playlists..."
  17. value="{{ search_query }}"
  18. hx-post="{% url 'search_playlists' playlist_type %}"
  19. hx-trigger="keyup changed delay:1s"
  20. hx-target="#search-results"
  21. hx-indicator=".htmx-indicator" autofocus onfocus="this.setSelectionRange(this.value.length,this.value.length);">
  22. <br>
  23. </div>
  24. <div class="row row-cols-1 row-cols-md-3 g-4">
  25. {% if playlists %}
  26. {% for playlist in playlists %}
  27. <div class="col">
  28. <div class="card" style="background-color: #515355;">
  29. <a style="background-color: #1A4464;" href="{% url 'playlist' playlist.playlist_id %}" class="list-group-item list-group-item-action" aria-current="true">
  30. <div class="card-body">
  31. <h5 class="card-title text-white">
  32. {{ playlist.name }}
  33. </h5>
  34. <p class="card-text">
  35. {% if playlist.is_user_owned %}<small><span class="badge bg-light text-black-50">OWNED</span></small>{% else %}<small><span class="badge bg-light text-black-50">IMPORTED</span></small>{% endif %}
  36. {% if playlist.is_private_on_yt %}<small><span class="badge bg-secondary text-white">Private</span></small> {% endif %}
  37. {% if playlist.is_from_yt %}<small><span class="badge bg-danger text-black-50">YT</span></small> {% endif %}
  38. </p>
  39. {% if playlist.tags.all %}
  40. <p class="card-text">
  41. <span class="d-flex justify-content-start flex-wrap">
  42. <small>
  43. <span style="color: #eed868;" class="me-lg-1 mb-lg-1">
  44. <i class="fas fa-tags"></i>
  45. </span>
  46. </small>
  47. {% for tag in playlist.tags.all %}
  48. <span class="badge rounded-pill bg-info mb-lg-1 me-lg-1 text-black-50">
  49. {{ tag.name }}
  50. </span>
  51. {% endfor %}
  52. </span>
  53. </p>
  54. {% endif %}
  55. <small>
  56. <span class="badge bg-primary rounded-pill">{{ playlist.video_count }} videos</span>
  57. <span class="badge bg-primary rounded-pill">{{ playlist.playlist_duration }} </span>
  58. </small>
  59. </div>
  60. </a>
  61. </div>
  62. </div>
  63. {% endfor %}
  64. {% else %}
  65. <h5 class="text-white align-content-center">Nothing found :(</h5>
  66. {% endif %}
  67. </div>
  68. <br>