video_cards.html 3.4 KB

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