playlists.html 5.4 KB

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