all_playlists.html 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. {% extends 'base.html' %}
  2. {% block content %}
  3. <div id="search-results">
  4. {% if messages %}
  5. {% for message in messages %}
  6. <div class="alert {% if message.tags %} alert-{{ message.tags }}{% endif %} alert-dismissible fade show" role="alert">
  7. {{ message|safe }}
  8. <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
  9. </div>
  10. {% endfor %}
  11. {% endif %}
  12. <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
  13. <h1 class="h2">{{ playlist_type_display|title }} <span class="badge bg-primary rounded-pill">{{ playlists.count }}</span></h1>
  14. <div class="btn-toolbar mb-2 mb-md-0">
  15. <div class="btn-group me-2">
  16. <button type="button" class="btn btn-outline-info">Grid</button>
  17. <button type="button" class="btn btn-outline-info">List</button>
  18. </div>
  19. <div class="btn-group">
  20. <button type="button" class="btn btn-outline-success dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
  21. Sort By
  22. </button>
  23. <ul class="dropdown-menu">
  24. <li><a class="dropdown-item" href="{% url 'order_playlists_by' playlist_type 'playlist-duration-in-seconds' %}">Duration</a></li>
  25. <li><a class="dropdown-item" href="{% url 'order_playlists_by' playlist_type 'video-count' %}"># Videos</a></li>
  26. <li><a class="dropdown-item" href="#">Recently Accessed</a></li>
  27. </ul>
  28. </div>
  29. </div>
  30. </div>
  31. {% if playlists %}
  32. <div class="">
  33. <input class="form-control" type="text"
  34. name="search" placeholder="Begin to search playlists..."
  35. hx-post="{% url 'search_playlists' playlist_type %}"
  36. hx-trigger="keyup changed delay:500ms"
  37. hx-target="#search-results"
  38. hx-indicator=".htmx-indicator">
  39. <br>
  40. </div>
  41. <div id="search-results">
  42. <div class="row row-cols-1 row-cols-md-3 g-4">
  43. {% for playlist in playlists %}
  44. <div class="col">
  45. <div class="card h-100" style="background-color: #1A4464;">
  46. <a style="background-color: #9CC5E5;" href="{% url 'playlist' playlist.playlist_id %}" class="list-group-item list-group-item-action" aria-current="true">
  47. <div class="card-body">
  48. <h5 class="card-title">
  49. {{ playlist.name }}
  50. {% if playlist.is_private_on_yt %}<small><span class="badge bg-light text-dark">Private</span></small> {% endif %}
  51. {% if playlist.is_from_yt %}<small><span class="badge bg-danger text-dark">YT</span></small> {% endif %}
  52. </h5>
  53. <p class="card-text">
  54. {% if playlist.description %}
  55. {{ playlist.description }}
  56. {% else %}
  57. No description
  58. {% endif %}
  59. </p>
  60. <small>
  61. <span class="badge bg-primary rounded-pill">{{ playlist.video_count }} videos</span>
  62. <span class="badge bg-primary rounded-pill">{{ playlist.playlist_duration }} </span>
  63. </small>
  64. </div>
  65. </a>
  66. </div>
  67. </div>
  68. {% endfor %}
  69. {% else %}
  70. <h5 class="text-white align-content-center">Nothing to see here. Add something!</h5>
  71. </div>
  72. </div>
  73. {% endif %}
  74. <br>
  75. <!-- list view
  76. <div class="table-responsive">
  77. {% if playlists %}
  78. <div class="list-group">
  79. {% for playlist in playlists %}
  80. <a style="background-color: #969291;" href="https://www.youtube.com/playlist?list={{ playlist.playlist_id }}" class="list-group-item list-group-item-action" aria-current="true">
  81. <div class="d-flex w-100 justify-content-between">
  82. <h5 class="mb-1">{{ playlist.name }}</h5>
  83. <small>3 days ago</small>
  84. </div>
  85. <p class="mb-1">
  86. {% if playlist.description %}
  87. {{ playlist.description }}
  88. {% else %}
  89. No description
  90. {% endif %}
  91. </p>
  92. <small>
  93. <span class="badge bg-primary rounded-pill">{{ playlist.video_count }} videos</span>
  94. <span class="badge bg-primary rounded-pill">{{ playlist.playlist_duration }} </span>
  95. </small>
  96. </a>
  97. {% endfor %}
  98. </div>
  99. {% else %}
  100. <h2 class="text-white align-content-center">Nothing to see here.</h2>
  101. {% endif %}
  102. </div>
  103. -->
  104. </div>
  105. {% endblock %}