search_untube_results.html 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. {% load humanize %}
  2. <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
  3. <h1 class="h2">Playlists <span class="badge bg-primary rounded-pill">{{ playlists.count|default:"0" }}</span></h1>
  4. </div>
  5. <div>
  6. <div class="row row-cols-1 row-cols-md-3 g-4">
  7. {% if playlists %}
  8. {% for playlist in playlists %}
  9. <div class="col">
  10. <div class="card" style="background-color: #1A4464;">
  11. <a style="background-color: #1A4464;" href="{% url 'playlist' playlist.playlist_id %}" class="list-group-item list-group-item-action" aria-current="true">
  12. <div class="card-body text-white">
  13. <h5 class="card-title">
  14. {{ playlist.name|truncatewords:"15" }}
  15. {% if playlist.is_private_on_yt %}<small><span class="badge bg-light text-dark">Private</span></small> {% endif %}
  16. {% if playlist.is_from_yt %}<small><span class="badge bg-danger text-dark">YT</span></small> {% endif %}
  17. </h5>
  18. <p class="card-text">
  19. {% if playlist.description %}
  20. {{ playlist.description|truncatewords:"15" }}
  21. {% else %}
  22. No description
  23. {% endif %}
  24. </p>
  25. <small>
  26. <span class="badge bg-primary rounded-pill">{{ playlist.video_count }} views</span>
  27. <span class="badge bg-primary rounded-pill">{{ playlist.playlist_duration }} </span>
  28. </small>
  29. </div>
  30. </a>
  31. </div>
  32. </div>
  33. {% endfor %}
  34. {% else %}
  35. <h5 class="text-white align-content-center">Nothing found :(</h5>
  36. {% endif %}
  37. </div>
  38. </div>
  39. <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
  40. <h1 class="h2">Videos <span class="badge bg-primary rounded-pill">{{ videos_count }}</span></h1>
  41. </div>
  42. <div>
  43. <div class="row row-cols-1 row-cols-md-3 g-4">
  44. {% if videos %}
  45. {% for video in videos %}
  46. <div class="col">
  47. <div class="card" style="background-color: #1A4464;">
  48. <div class="card-body">
  49. <h5 class="card-title text-light">
  50. {{ video.name|truncatewords:"15" }}<br>
  51. <small>
  52. <a class="badge bg-white text-black-50" href="{% url 'playlist' video.playlist.playlist_id %}">{{ video.playlist.name }}</a>
  53. <span class="badge bg-dark text-white-50">{{ video.duration }}</span>
  54. </small>
  55. {% if video.is_unavailable_on_yt %}<small><span class="badge bg-light text-dark">Private</span></small> {% endif %}
  56. {% if video.has_cc %}<small><span class="badge bg-danger text-dark">CC</span></small> {% endif %}
  57. </h5>
  58. <br>
  59. <span class="d-flex justify-content-center">
  60. <a href="https://www.youtube.com/watch?v={{ video.video_id }}" class="btn btn-info me-1" target="_blank" id="share_link" style=""><i class="fas fa-external-link-alt" aria-hidden="true"></i></a>
  61. <input class="form-control me-1 visually-hidden" id="video-{{ video.video_id }}" value="https://www.youtube.com/watch?v={{ video.video_id }}">
  62. <button class="copy-btn btn btn-success me-1" data-clipboard-target="#video-{{ video.video_id }}">
  63. <i class="far fa-copy" aria-hidden="true"></i>
  64. </button>
  65. <button class="btn btn-dark" type="button" hx-get="{% url 'mark_video_favorite' video.playlist.playlist_id video.video_id %}" hx-target="#video-{{ forloop.counter }}-fav">
  66. <div id="video-{{ forloop.counter }}-fav">
  67. {% if video.is_favorite %}
  68. <i class="fas fa-heart"></i>
  69. {% else %}
  70. <i class="far fa-heart"></i>
  71. {% endif %}
  72. </div>
  73. </button>
  74. </span>
  75. </div>
  76. </div>
  77. </div>
  78. {% endfor %}
  79. {% else %}
  80. <h5 class="text-white align-content-center">Nothing found :(</h5>
  81. {% endif %}
  82. </div>
  83. </div>
  84. <br>