2
0

video_cards.html 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. {% load humanize %}
  2. {% for video in videos %}
  3. <div class="col">
  4. <div class="card overflow-auto" style="max-width: 540px; background-color: #1A4464;">
  5. <div class="row g-0">
  6. {% if not video.is_unavailable_on_yt and not video.was_deleted_on_yt %}
  7. <div class="col-md-4">
  8. <img src="{{ video.thumbnail_url }}" class="img-fluid" style="width: 100%; height: 15vw; object-fit: cover;">
  9. </div>
  10. {% endif %}
  11. <div class="col-md-8">
  12. <div class="card-body">
  13. <h5 class="card-title"><a href="{% url 'video' video.video_id %}" style="text-decoration: none; color: white">
  14. {% if video.user_label %}
  15. <span style="border-bottom: 3px #eeeaea dashed;">{{ video.user_label }}</span>
  16. {% else %}
  17. {{ video.name|truncatewords:"15" }}
  18. {% endif %}
  19. </a>
  20. </h5>
  21. {% if not video.is_unavailable_on_yt and not video.was_deleted_on_yt %}
  22. <h5 class="card-text">
  23. <small>
  24. <span class="badge bg-dark text-white-50">{{ video.duration }}</span>
  25. {% if video.is_unavailable_on_yt %}<span class="badge bg-light text-dark">Private</span>{% endif %}
  26. {% if video.has_cc %}<span class="badge bg-danger text-dark">CC</span>{% endif %}
  27. <span class="badge bg-info text-black-50"><i class="fas fa-eye"></i> {% if video.view_count == -1 %}HIDDEN{% else %}{{ video.view_count|intword|intcomma }}{% endif %}</span>
  28. <span class="badge bg-warning text-black-50"><i class="fas fa-thumbs-up"></i> {% if video.like_count == -1 %}HIDDEN{% else %}{{ video.like_count|intword|intcomma }}{% endif %}</span>
  29. </small>
  30. </h5>
  31. {% endif %}
  32. <span class="card-text d-flex justify-content-start">
  33. <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>
  34. <input class="form-control me-1 visually-hidden" id="video-{{ video.video_id }}" value="https://www.youtube.com/watch?v={{ video.video_id }}">
  35. <button class="copy-btn btn btn-success me-1" data-clipboard-target="#video-{{ video.video_id }}">
  36. <i class="far fa-copy" aria-hidden="true"></i>
  37. </button>
  38. <button class="btn btn-dark" type="button" hx-get="{% url 'mark_video_favorite' video.video_id %}" hx-target="#video-{{ forloop.counter }}-fav">
  39. <div id="video-{{ forloop.counter }}-fav">
  40. {% if video.is_favorite %}
  41. <i class="fas fa-heart" style="color: #fafa06"></i>
  42. {% else %}
  43. <i class="far fa-heart"></i>
  44. {% endif %}
  45. </div>
  46. </button>
  47. </span>
  48. </div>
  49. </div>
  50. </div>
  51. </div>
  52. </div>
  53. {% endfor %}