all_playlists.html 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. {% extends 'base.html' %}
  2. {% block content %}
  3. <div id="search-results">
  4. <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
  5. <h1 class="h2">{{ playlist_type_display|title }} <span class="badge bg-primary rounded-pill">{{ playlists.count }}</span></h1>
  6. <div class="btn-toolbar mb-2 mb-md-0">
  7. <!--
  8. <div class="btn-group me-2">
  9. <button type="button" class="btn btn-outline-info">Grid</button>
  10. <button type="button" class="btn btn-outline-info">List</button>
  11. </div>
  12. -->
  13. <div class="btn-group">
  14. <button type="button" class="btn btn-outline-success dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
  15. Sort By
  16. </button>
  17. <ul class="dropdown-menu">
  18. <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>
  19. <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>
  20. <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>
  21. </ul>
  22. </div>
  23. </div>
  24. </div>
  25. {% if playlists %}
  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. {% else %}
  59. <h5 class="text-white align-content-center">Nothing to see here. Add something!</h5>
  60. </div>
  61. {% endif %}
  62. <br>
  63. </div>
  64. {% endblock %}