search_untube.html 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. {% load humanize %}
  2. <div>
  3. <div class="d-flex justify-content-center">
  4. <h1> Search all of UnTube
  5. <h6>Press <code>Esc</code> to close.</h6>
  6. </h1>
  7. </div>
  8. <input class="form-control me-lg-2 bg-dark text-white" type="text"
  9. name="search" placeholder="Search UnTube"
  10. value="{{ search_query }}"
  11. hx-post="{% url 'search_UnTube' %}"
  12. hx-trigger="keyup changed delay:750ms"
  13. hx-target="#untube-searchbar-results"
  14. hx-include="[id='searchbar-radio-form']"
  15. hx-indicator=".htmx-indicator" autofocus onfocus="this.setSelectionRange(this.value.length,this.value.length);">
  16. <br>
  17. <div id="searchbar-radio-form">
  18. <div class="d-flex justify-content-center">
  19. <div class="form-check me-5">
  20. <input class="form-check-input" type="radio" name="search-settings" value="starts-with" id="starts-with-cb" {% if starts_with %} checked {% endif %}>
  21. <label class="form-check-label" for="starts-with-cb">
  22. Starts with
  23. </label>
  24. </div>
  25. <div class="form-check">
  26. <input class="form-check-input" type="radio" name="search-settings" value="contains" id="contains-cb" {% if contains %} checked {% endif %}>
  27. <label class="form-check-label" for="contains-cb">
  28. Contains
  29. </label>
  30. </div>
  31. </div>
  32. </div>
  33. </div>
  34. <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
  35. <h1 class="h2">Playlists <span class="badge bg-primary rounded-pill">{{ playlists.count|default:"0" }}</span></h1>
  36. </div>
  37. <div>
  38. <div class="row row-cols-1 row-cols-md-3 g-4">
  39. {% if playlists %}
  40. {% for playlist in playlists %}
  41. <div class="col">
  42. <div class="card" style="background-color: #1A4464;">
  43. <a style="background-color: #1A4464;" href="{% url 'playlist' playlist.playlist_id %}" class="list-group-item list-group-item-action" aria-current="true">
  44. <div class="card-body text-white">
  45. <h5 class="card-title">
  46. {{ playlist.name|truncatewords:"15" }}
  47. {% if playlist.is_private_on_yt %}<small><span class="badge bg-light text-dark">Private</span></small> {% endif %}
  48. {% if playlist.is_from_yt %}<small><span class="badge bg-danger text-dark">YT</span></small> {% endif %}
  49. </h5>
  50. <p class="card-text">
  51. {% if playlist.description %}
  52. {{ playlist.description|truncatewords:"15" }}
  53. {% else %}
  54. No description
  55. {% endif %}
  56. </p>
  57. <small>
  58. <span class="badge bg-primary rounded-pill">{{ playlist.video_count }} views</span>
  59. <span class="badge bg-primary rounded-pill">{{ playlist.playlist_duration }} </span>
  60. </small>
  61. </div>
  62. </a>
  63. </div>
  64. </div>
  65. {% endfor %}
  66. {% else %}
  67. <h5 class="text-white align-content-center">Nothing found :(</h5>
  68. {% endif %}
  69. </div>
  70. </div>
  71. <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
  72. <h1 class="h2">Videos <span class="badge bg-primary rounded-pill">{{ videos_count }}</span></h1>
  73. </div>
  74. <div>
  75. <div class="row row-cols-1 row-cols-md-3 g-4">
  76. {% if videos %}
  77. {% for video in videos %}
  78. <div class="col">
  79. <div class="card" style="background-color: #1A4464;">
  80. <div class="card-body">
  81. <h5 class="card-title text-light">
  82. {{ video.name|truncatewords:"15" }}<br>
  83. <small>
  84. <a class="badge bg-white text-black-50" href="{% url 'playlist' video.playlist.playlist_id %}">{{ video.playlist.name }}</a>
  85. <span class="badge bg-dark text-white-50">{{ video.duration }}</span>
  86. </small>
  87. {% if video.is_unavailable_on_yt %}<small><span class="badge bg-light text-dark">Private</span></small> {% endif %}
  88. {% if video.has_cc %}<small><span class="badge bg-danger text-dark">CC</span></small> {% endif %}
  89. </h5>
  90. <br>
  91. <span class="d-flex justify-content-center">
  92. <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>
  93. <input class="form-control me-1 visually-hidden" id="video-{{ video.video_id }}" value="https://www.youtube.com/watch?v={{ video.video_id }}">
  94. <button class="copy-btn btn btn-success me-1" data-clipboard-target="#video-{{ video.video_id }}">
  95. <i class="far fa-copy" aria-hidden="true"></i>
  96. </button>
  97. <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">
  98. <div id="video-{{ forloop.counter }}-fav">
  99. {% if video.is_favorite %}
  100. <i class="fas fa-heart"></i>
  101. {% else %}
  102. <i class="far fa-heart"></i>
  103. {% endif %}
  104. </div>
  105. </button>
  106. </span>
  107. </div>
  108. </div>
  109. </div>
  110. {% endfor %}
  111. {% else %}
  112. <h5 class="text-white align-content-center">Nothing found :(</h5>
  113. {% endif %}
  114. </div>
  115. </div>
  116. <br>