search_untube.html 5.9 KB

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