all_playlists.html 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. {% extends 'base.html' %}
  2. {% block content %}
  3. {% if playlists %}
  4. <div id="search-results">
  5. <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
  6. <h1 class="h2">{{ playlist_type_display|title }} <span class="badge bg-primary rounded-pill">{{ playlists.count }}</span></h1>
  7. <div class="btn-toolbar mb-2 mb-md-0">
  8. <!--
  9. <div class="btn-group me-2">
  10. <button type="button" class="btn btn-outline-info">Grid</button>
  11. <button type="button" class="btn btn-outline-info">List</button>
  12. </div>
  13. -->
  14. <div class="btn-group">
  15. <button type="button" class="btn btn-outline-success dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
  16. Sort By
  17. </button>
  18. <ul class="dropdown-menu">
  19. <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>
  20. <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>
  21. <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>
  22. </ul>
  23. </div>
  24. </div>
  25. </div>
  26. <div class="">
  27. <input class="form-control border border-secondary" type="text"
  28. name="search" placeholder="Begin to search playlists..."
  29. hx-post="{% url 'search_playlists' playlist_type %}"
  30. hx-trigger="keyup changed delay:500ms"
  31. hx-target="#search-results"
  32. hx-indicator=".htmx-indicator">
  33. <br>
  34. </div>
  35. <div class="row row-cols-1 row-cols-md-3 g-4">
  36. {% for playlist in playlists %}
  37. <div class="col">
  38. <div class="card" style="background-color: #515355;">
  39. <a style="background-color: #1A4464;" href="{% url 'playlist' playlist.playlist_id %}" class="list-group-item list-group-item-action text-white-50" aria-current="true">
  40. <div class="card-body">
  41. <h5 class="card-title text-white">
  42. {{ playlist.name }}
  43. </h5>
  44. <p class="card-text">
  45. {% 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 %}
  46. {% if playlist.is_private_on_yt %}<small><span class="badge bg-secondary text-white">Private</span></small> {% endif %}
  47. {% if playlist.is_from_yt %}<small><span class="badge bg-danger text-black-50">YT</span></small> {% endif %}
  48. </p>
  49. <small>
  50. <span class="badge bg-primary rounded-pill">{{ playlist.video_count }} videos</span>
  51. <span class="badge bg-primary rounded-pill">{{ playlist.playlist_duration }} </span>
  52. </small>
  53. </div>
  54. </a>
  55. </div>
  56. </div>
  57. {% endfor %}
  58. </div>
  59. <br>
  60. </div>
  61. {% else %}
  62. <div class="container-fluid">
  63. <div class="d-flex justify-content-between align-items-center pt-3 pb-2 mb-3 border-bottom">
  64. <h1 class="h2">{{ playlist_type_display|title }} <span class="badge bg-primary rounded-pill">{{ playlists.count }}</span></h1>
  65. <div class="btn-toolbar mb-2 mb-md-0">
  66. <!--
  67. <div class="btn-group me-2">
  68. <button type="button" class="btn btn-outline-info">Grid</button>
  69. <button type="button" class="btn btn-outline-info">List</button>
  70. </div>
  71. -->
  72. <div class="btn-group">
  73. <button type="button" class="btn btn-outline-success dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
  74. Sort By
  75. </button>
  76. <ul class="dropdown-menu">
  77. <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>
  78. <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>
  79. <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>
  80. </ul>
  81. </div>
  82. </div>
  83. </div>
  84. <h5 class="text-white align-content-center">Nothing to see here. Add something!</h5>
  85. </div>
  86. {% endif %}
  87. {% endblock %}