templates/Frontend/Video/Index.twig line 1

  1. {% extends 'Frontend/Layout.twig' %}
  2. {% import 'Frontend/Macros.twig' as macro %}
  3. {% block javascripts %}
  4.     {{ encore_entry_script_tags('frontend') }}
  5. {% endblock %}
  6. {% block body %}
  7.     <h1>Videos</h1>
  8.     <div class="row">
  9.         <div class="col-sm-4">
  10.             <div class="mb-3 p-4 bg-body-secondary">
  11.                 <div class="mb-2">
  12.                     <label class="label-small">Studio</label>
  13.                     <select id="studio"
  14.                            autocomplete="off"
  15.                            placeholder="Search ..."
  16.                            data-controller="frontend-video-studio-search"
  17.                            data-url-search="{{ path('studio.search') }}"
  18.                            data-selected="{{ selectedStudios|json_encode }}"
  19.                     >
  20.                     </select>
  21.                 </div>
  22.                 <div class="mb-2">
  23.                     <label class="label-small">Actor</label>
  24.                     <select id="actor"
  25.                            autocomplete="off"
  26.                            placeholder="Search ..."
  27.                            data-controller="frontend-video-actor-search"
  28.                            data-url-search="{{ path('actor.search') }}"
  29.                            data-selected="{{ selectedActors|json_encode }}"
  30.                     >
  31.                     </select>
  32.                 </div>
  33.                 <div class="mb-2">
  34.                     <label for="search" class="label-small">Title</label>
  35.                     <input id="search"
  36.                            value="{{ search }}"
  37.                            class="form-control"
  38.                            type="text"
  39.                            placeholder=""
  40.                     >
  41.                 </div>
  42.                 {% for category in categories %}
  43.                 <div class="mb-2">
  44.                     <label for="category-{{ category.id }}" class="label-small">{{ category.name }}</label>
  45.                     <select id="category-{{ category.id }}"
  46.                             class="tag"
  47.                             autocomplete="off"
  48.                             placeholder="All"
  49.                             data-controller="frontend-video-tag-select"
  50.                             {#{% if category.isMultipleSelect %}multiple{% endif %}#}
  51.                     >
  52.                         <option value="">All</option>
  53.                         {% if tags[category.id] is defined %}
  54.                             {% for tag in tags[category.id] %}
  55.                                 <option value="{{ tag.id }}"{% if tag.id in selectedTagIds %} selected{% endif %}>{{ tag.name }}</option>
  56.                             {% endfor %}
  57.                         {% endif %}
  58.                     </select>
  59.                 </div>
  60.                 {% endfor %}
  61.                 <div class="mt-3">
  62.                     <button class="btn btn-secondary"
  63.                             data-controller="frontend-video-search"
  64.                             data-url="{{ path('video.index') }}"
  65.                             data-action="frontend-video-search#search"
  66.                     >
  67.                         Apply filters
  68.                     </button>
  69.                     <button class="btn btn-link"
  70.                             data-controller="frontend-video-search"
  71.                             data-url="{{ path('video.index') }}"
  72.                             data-action="frontend-video-search#clear"
  73.                     >
  74.                         Clear filters
  75.                     </button>
  76.                 </div>
  77.             </div>
  78.         </div>
  79.         <div class="col-sm-8">
  80.             <turbo-frame id="video-list-{{ paging.getPage() }}" target="_top">
  81.                 {% if videos|length == 0 %}
  82.                     <div class="alert alert-warning">No videos found that matches the search criteria.</div>
  83.                 {% else %}
  84.                     <div class="row row-cols-1 row-cols-md-3 g-3">
  85.                         {% for video in videos %}
  86.                             <div class="col mb-3">
  87.                                 <div class="card">
  88.                                     {% set img = video.getFrontImage() %}
  89.                                     {% if img %}
  90.                                         <div class="bg-light ratio ratio-4x3">
  91.                                             <img src="/img/video/{{ img.id }}/resize(150,100)/{{ img.filename }}"
  92.                                                  class="card-img-top object-fit-cover"
  93.                                                  alt=" "
  94.                                             >
  95.                                         </div>
  96.                                     {% endif %}
  97.                                     <div class="card-body">
  98.                                         <a href="{{ path('video.show', {'id':video.id}) }}" class="stretched-link">
  99.                                             <h5 class="card-title">{{ video.title }}</h5>
  100.                                         </a>
  101.                                         <p class="card-text">{{ video.description }}</p>
  102.                                     </div>
  103.                                 </div>
  104.                             </div>
  105.                         {% endfor %}
  106.                     </div>
  107.                     {% if url_next_page %}
  108.                         <turbo-frame
  109.                                 id="video-list-{{ paging.getNextPage() }}"
  110.                                 src="{{ url_next_page }}"
  111.                                 loading="lazy"
  112.                                 target="_top"
  113.                         ></turbo-frame>
  114.                     {% endif %}
  115.                 {% endif %}
  116.             </turbo-frame>
  117.         </div>
  118.     </div>
  119. {% endblock %}