templates_common/newsview.html.twig line 1

  1. {% extends 'layout.html.twig' %}
  2. {% block title %}
  3.     {{ post.title }}
  4. {% endblock title %}
  5. {% block content %}
  6.     {% include 'blocks/breadcrumbs.html.twig' with
  7.         {
  8.             items: [
  9.             [post.title|striptags|u.truncate(100, '...')|raw],
  10.         ]
  11.         } %}
  12.     <main>
  13.         <div class="container px-4">
  14.             <div class="w-[100%] mx-auto">
  15.                 <h1 class="text-center font-extrabold text-[24px] leading-[36px] lg:text-[36px] lg:leading-[62.4px]">
  16.                     {{ post.title }}</h1>
  17.                 <article
  18.                         class="{% if post.type == 'post' %}lg:border lg:border-gray-200 lg:rounded-lg lg:shadow-md my-6{% endif %}">
  19.                     {% if post.type == 'post' %}
  20.                         <div class="lg:max-w-[70%] mx-auto my-2 lg:my-6 text-[14px]">
  21.                             <time class="text-[#999fab] leading-[150%]" datetime="">
  22.                                 {% block time %}
  23.                                     {{ post.publishedAt ? post.publishedAt|date('d.m.Y') : '' }}
  24.                                 {% endblock time %}
  25.                             </time>
  26.                         </div>
  27.                     {% endif %}
  28.                     {# @TODO move to templates #}
  29.                     {% if post.id == 52 or post.id == 67 %}
  30.                     <div class="max-lg:px-4 lg:max-w-[85%] mx-auto my-2 lg:my-6 text-[14px]">
  31.                         {% else %}
  32.                         <div class="lg:max-w-[70%] mx-auto my-2 lg:my-6">
  33.                             {% endif %}
  34.                             {% if post.type == 'post' or post.isSliderActive == true %}
  35.                                 {% block slider %}
  36.                                     <div class="relative mb-6">
  37.                                         {% if post.attachments|length > 1 %}
  38.                                             <div id="news_slider_controls">
  39.                                                 <button class="w-[100px] h-[100px] absolute top-[calc(50%-50px)] z-10">
  40.                                                     <img class="w-[32px] mx-auto"
  41.                                                          src="data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath d='M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z'/%3e%3c/svg%3e"
  42.                                                          alt="">
  43.                                                 </button>
  44.                                                 <button class="w-[100px] h-[100px] absolute top-[calc(50%-50px)] right-0 z-10">
  45.                                                     <img class="w-[32px] mx-auto rotate-180"
  46.                                                          src="data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath d='M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z'/%3e%3c/svg%3e"
  47.                                                          alt="">
  48.                                                 </button>
  49.                                             </div>
  50.                                             <div id="news_slider">
  51.                                                 {% for image in post.attachments %}
  52.                                                     {% if image.path is not empty %}
  53.                                                         <img
  54.                                                                 srcset="{{ asset(image.path) | imagine_filter('slider_photo_mobile') }} 480w, {{ asset(image.path) | imagine_filter('slider_photo') }} 1280w"
  55.                                                                 sizes="(max-width: 600px) 480px, 1280px"
  56.                                                                 src="{{ asset(image.path) | imagine_filter('slider_photo') }}"
  57.                                                              alt="{{ post.title }} ">
  58.                                                     {% else %}
  59.                                                         {% if image.imageName matches '/\.(mp4|avi|webm|flv)$/' %}
  60.                                                             <div>
  61.                                                                 <video class="myVideo"
  62.                                                                        src="/images/attachments/{{ image.imageName }}"
  63.                                                                        style="display: inline-block;" controls
  64.                                                                        muted></video>
  65.                                                             </div>
  66.                                                         {% else %}
  67.                                                             <img
  68.                                                                     srcset="{{ asset('/images/attachments/' ~ image.imageName) | imagine_filter('slider_photo_mobile') }} 480w, {{ asset('/images/attachments/' ~ image.imageName) | imagine_filter('slider_photo') }} 1280w"
  69.                                                                     sizes="(max-width: 600px) 480px, 1280px"
  70.                                                                     src="{{ asset('/images/attachments/' ~ image.imageName) | imagine_filter('slider_photo') }}"
  71.                                                                     alt="{{ post.title }} ">
  72.                                                         {% endif %}
  73.                                                     {% endif %}
  74.                                                 {% endfor %}
  75.                                             </div>
  76.                                         {% elseif post.attachments|length == 1 %}
  77.                                             {% if post.attachments|first.imageName matches '/\.(mp4|avi|webm|flv)$/' %}
  78.                                                 <video class="myVideo"
  79.                                                        src="/images/attachments/{{ post.attachments|first.imageName }}"
  80.                                                        style="display: inline-block;" controls muted></video>
  81.                                             {% else %}
  82.                                                 {% if post.attachments|first.path is not empty %}
  83.                                                     <img class="mx-auto"
  84.                                                          src="{{ asset( post.attachments|first.path) }}"
  85.                                                          alt="{{ post.title }}">
  86.                                                 {% else %}
  87.                                                     <img class="mx-auto"
  88.                                                          src="{{ asset('/images/attachments/' ~ post.attachments|first.imageName) }}"
  89.                                                          alt="{{ post.title }}">
  90.                                                 {% endif %}
  91.                                             {% endif %}
  92.                                         {% endif %}
  93.                                     </div>
  94.                                 {% endblock slider %}
  95.                             {% endif %}
  96.                             {% block article %}
  97.                                 {{ post.content|raw }}
  98.                             {% endblock article %}
  99.                         </div>
  100.                 </article>
  101.                 {% if post.type == 'post' %}
  102.                     <div class="text-center my-12">
  103.                         <a class="inline-block mx-auto text-[#cda062] rounded-[28px] px-6 py-3 border-2 border-[#cda062] font-bold  hover:bg-[rgba(254,197,12,.16)]"
  104.                            href="{{ path('app_post_index', {'type': post.type}) }}">
  105.                             {{ 'Back to news'|trans }}
  106.                             <img class="inline rotate-[90deg] ml-4" src="/img/arrow-small-down.svg" alt="">
  107.                         </a>
  108.                     </div>
  109.                 {% endif %}
  110.             </div>
  111.         </div>
  112.     </main>
  113. {% endblock content %}