templates/Nordinfo/Main/detail_post.html.twig line 1

Open in your IDE?
  1. {% extends 'Nordinfo/Main/base.html.twig' %}
  2. {% set show_btt = true %}
  3. {% block title %}{{ post.title }} - Nord Info{% endblock %}
  4. {% block body_class %}body-post-details{% endblock %}
  5. {% block header_epingles %}
  6.   {{ include('Lenord/Main/parts/epingles.html.twig') }}
  7. {% endblock %}
  8. {% block header_breadcrumb %}
  9.   {{ include('Nordinfo/Main/parts/breadcrumb.html.twig') }}
  10. {% endblock %}
  11. {% block body %}
  12.   {% if post.dateDebut is defined and post.dateDebut != null %}
  13.     {% set date_segments = post.dateDebut | split('/') %}
  14.     {% set date = date_segments[1] ~ '/' ~ date_segments[0] ~ '/' ~ date_segments[2] %}
  15.   {% else %}
  16.     {% set date = "" %}
  17.   {% endif %}
  18.   {% if post.dateFin is defined and post.dateFin != null %}
  19.     {% set date_segmentss = post.dateFin | split('/') %}
  20.     {% set date_fin = date_segmentss[1] ~ '/' ~ date_segmentss[0] ~ '/' ~ date_segmentss[2] %}
  21.   {% else %}
  22.     {% set date_fin = "" %}
  23.   {% endif %}
  24.   {% if post.type.type == 'video' %}
  25.     <main role="main" class="mainContent pt-5 pb-5" id="mainContent" tabindex="-1" {% if related_posts|length > 0 %}style="position:relative;"{% endif %}>
  26.       {% if referer is not null %}
  27.         {% set url_back = referer %}
  28.       {% else %}
  29.         {% set url_back = path('info') %}
  30.       {% endif %}
  31.       {% include 'Nordinfo/Main/parts/back_btn.html.twig' with {'back_btn_class':''} %}
  32.       <div class="container containerPostExtraInfo">
  33.         <p class="text-center fsXs">
  34.                     <span class="lsMd ttUppercase">
  35.                         {% if post.topics|length > 1 %}{% for top in post.topics %}{% if loop.index != 1 %}, {% endif %}{{ top.displayName }}{% endfor %}
  36.             {% else %}{% for top in post.topics %}{{ top.displayName }}{% endfor %}{% endif %}
  37.             {% if post.territories|length > 0 and post.topics|length > 0 %}<span class="separator">|</span>{% endif %}
  38.             {% if post.territories|length > 1 %}{% for t in post.territories %}{% if loop.last == false and post.territories|length > 1 %}{{ t.displayName ~", " }}{% else %}{{ t.displayName }}{% endif %}{% endfor %}
  39.             {% else %}{% for t in post.territories %}{{ t.displayName }}{% endfor %}{% endif %}
  40.                     </span>
  41.           <br>
  42.           <span class="colorGrey">{{ date|format_datetime(locale='fr', pattern="d MMMM Y") }}</span>
  43.         </p>
  44.       </div>
  45.       <article>
  46.         <div class="container">
  47.           <h1 class="text-center">{{ post.title }}</h1>
  48.         </div>
  49.         <div class="videoWrapper __detailPost" style="scroll-margin-top: 120px;">
  50.           <p class="skipLinkWrapper __top"><a href="#bottomLink" id="topLink" class="sr-only sr-only-focusable bg-white">Passez la vidéo</a></p>
  51.           <iframe allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
  52.                   allowfullscreen="allowfullscreen" height="315"
  53.                   src="https://www.youtube.com/embed/{{ youtube_video_id }}" width="560"></iframe>
  54.           <p class="skipLinkWrapper __bottom"><a href="#topLink" id="bottomLink" class="sr-only sr-only-focusable bg-white no-after">Retour avant la vidéo</a></p>
  55.         </div>
  56.         <script>
  57.           (function() {
  58.             const topLink = document.getElementById('topLink');
  59.             const bottomLink = document.getElementById('bottomLink');
  60.             const mainContent = document.getElementById('mainContent');
  61.             function scrollToAnchor(anchor) {
  62.               const target = document.querySelector(anchor);
  63.               if (!target) return;
  64.               // 1. Temporarily remove position relative because of a weird bug with content overflow
  65.               mainContent.style.position = '';
  66.               // 2. Smooth scroll
  67.               target.scrollIntoView({ behavior: 'smooth', block: 'start' });
  68.               target.focus({ preventScroll: true });
  69.               // 3. Restore after scroll finishes
  70.               // Using a small delay to ensure scroll is done
  71.               setTimeout(() => {
  72.                 mainContent.style.position = 'relative';
  73.               }, 500);
  74.             }
  75.             topLink.addEventListener('click', function(e) {
  76.               e.preventDefault();
  77.               scrollToAnchor('#bottomLink');
  78.             });
  79.             bottomLink.addEventListener('click', function(e) {
  80.               e.preventDefault();
  81.               scrollToAnchor('#topLink');
  82.             });
  83.           })();
  84.         </script>
  85.         <div class="container pt-5">
  86.           <p class="containerContent pb-4">
  87.             {{ post.shortDescription|raw }}
  88.           </p>
  89.           <div class="containerContent">{{ content_post|raw }}</div>
  90.         </div>
  91.         <div class="container-sm pt-6">
  92.           {% if is_pdf != 1 %}
  93.             {% if is_preview != 1 %}
  94.               {% include 'Nordinfo/Main/parts/article-actions.html.twig' with {'post_title':post.title, 'post_id':post.id} %}
  95.             {% endif %}
  96.             {% include 'Nordinfo/Main/parts/cards-bottom.html.twig' %}
  97.             {% if related_posts|length > 0 %}
  98.               {% include 'Nordinfo/Main/parts/related_posts.html.twig' with {related_posts: related_posts, is_video_page: true} only %}
  99.             {% endif %}
  100.           {% endif %}
  101.         </div>
  102.       </article>
  103.       {% if related_posts|length > 0 %}
  104.         <div class="gradientRelatedPosts"></div>
  105.       {% endif %}
  106.     </main>
  107.   {% elseif post.type.type == 'article' %}
  108.     <main role="main" class="mainContent pt-0 pb-5" id="mainContent" tabindex="-1" {% if related_posts|length > 0 %}style="position:relative;"{% endif %}>
  109.       <div
  110.         class="headerBanner {% if post.type.type == 'article' %}--pageDetails{% endif %} placement{% if post.getPositionImage.id is defined %}{{ post.getPositionImage.id }}{% endif %}" {% if post.illustrationdetailName is null %} style="background-image: url('{{ asset('upload/images/'~post.illustrationfilName) | imagine_filter('banner_full_width') }}')" {% else %} style="background-image: url('{{ asset('upload/images/'~post.illustrationdetailName) | imagine_filter('banner_full_width') }}')" {% endif %}></div>
  111.       <div class="container containerPostDetails {% if post.type.type == 'article' %}--pageDetails{% endif %}">
  112.         <article class="pt-5">
  113.           <p class="text-center fsXs">
  114.                         <span class="lsMd ttUppercase">
  115.                             {% if post.type.type == 'event' %}{% if post.eventType|length > 1 %}{% for top in post.eventType %}{% if loop.index != 1 %}, {% endif %}{{ top.displayName }}{% endfor %}
  116.               {% else %}{% for top in post.eventType %}{{ top.displayName }}{% endfor %}{% endif %}
  117.               {% else %}{% if post.topics|length > 1 %}{% for top in post.topics %}{% if loop.index != 1 %}, {% endif %}{{ top.displayName }}{% endfor %}
  118.               {% else %}{% for top in post.topics %}{{ top.displayName }}{% endfor %}{% endif %}
  119.               {% endif %}{% if (post.territories|length > 0 or post.eventType|length > 0) and post.topics|length > 0 %}
  120.                 <span class="separator">|</span>{% endif %}
  121.               {% if post.territories|length > 1 %}{% for t in post.territories %}{% if loop.last == false and post.territories|length > 1 %}{{ t.displayName ~", " }}{% else %}{{ t.displayName }}{% endif %}{% endfor %}
  122.               {% else %}{% for t in post.territories %}{{ t.displayName }}{% endfor %}{% endif %}
  123.                         </span>
  124.             <br>
  125.             {% if post.type.type == 'event' %}
  126.               {% if date == date_fin %}
  127.                 Le {{ date|format_datetime(locale='fr', pattern="d MMMM Y") }}
  128.               {% else %}
  129.                 Du
  130.                 {% if date_fin|format_datetime(locale='fr', pattern="Y") == date|format_datetime(locale='fr', pattern="Y") %}
  131.                   {% if date|format_datetime(locale='fr', pattern="m") ==  date_fin|format_datetime(locale='fr', pattern="m") %}
  132.                     {{ date|format_datetime(locale='fr', pattern="d") }}
  133.                   {% else %}
  134.                     {{ date|format_datetime(locale='fr', pattern="d MMMM") }}
  135.                   {% endif %}
  136.                 {% else %}
  137.                   {{ date|format_datetime(locale='fr', pattern="d MMMM Y") }}
  138.                 {% endif %}
  139.                 au {{ date_fin|format_datetime(locale='fr', pattern="d MMMM Y") }}
  140.               {% endif %}
  141.             {% else %}
  142.               <span class="colorGrey">{{ date|format_datetime(locale='fr', pattern="d MMMM Y") }}</span>
  143.             {% endif %}
  144.           </p>
  145.           <h1 class="text-center">{{ post.title }}</h1>
  146.           <p class="font-weight-bold">{{ post.getShortDescription }}</p>
  147.           <div class="containerContent pb-2">{{ content_post|raw }}</div>
  148.           {% if post.credits is not null %}
  149.             <p class="text-secondary font-italic fontWeightMedium fsXs pb-2">Crédits photo :
  150.               {{ post.credits }}
  151.             </p>
  152.           {% endif %}
  153.         </article>
  154.       </div>
  155.       <div class="container-sm --article pt-4">
  156.         <div>
  157.           {% if is_pdf != 1 %}
  158.             {% if is_preview != 1 %}
  159.               {% include 'Nordinfo/Main/parts/article-actions.html.twig' with {'post_title':post.title, 'post_id':post.id} %}
  160.             {% endif %}
  161.             {% include 'Nordinfo/Main/parts/cards-bottom.html.twig' %}
  162.             {% if related_posts|length > 0 %}
  163.               {% include 'Nordinfo/Main/parts/related_posts.html.twig' with {related_posts: related_posts} only %}
  164.             {% endif %}
  165.           {% endif %}
  166.         </div>
  167.       </div>
  168.       {% if related_posts|length > 0 %}
  169.         <div class="gradientRelatedPosts"></div>
  170.       {% endif %}
  171.     </main>
  172.   {% else %}
  173.     <main role="main" class="mainContent pt-5 pb-5" id="mainContent" tabindex="-1" {% if related_posts|length > 0 %}style="position:relative;"{% endif %}>
  174.       <div class="container containerPostExtraInfo">
  175.         {% if post.type.type == 'event' and post.eventType|length > 0 %}
  176.           <p class="articleType ttUppercase">
  177.             {% if post.eventType|length > 1 %}
  178.               {% for top in post.eventType %}
  179.                 {% if loop.index != 1 %}, {% endif %}{{ top.displayName }}
  180.               {% endfor %}
  181.             {% else %}
  182.               {% for top in post.eventType %}{{ top.displayName }}{% endfor %}
  183.             {% endif %}
  184.           </p>
  185.         {% endif %}
  186.         <p class="text-center fsXs">
  187.                     <span class="lsMd ttUppercase">
  188.                         {% if post.type.type == 'event' %}{% if event_lieu|length > 0 %}{{ event_lieu }}{% endif %}{% if event_ville|length > 0 %}{% if event_lieu|length > 0 %}
  189.               <span class="separator">|</span>{% endif %}{{ event_ville }}{% endif %}
  190.                         {% else %}{% if post.topics|length > 1 %}{% for top in post.topics %}{% if loop.index != 1 %}, {% endif %}{{ top.displayName }}{% endfor %}{% else %}{% for top in post.topics %}{{ top.displayName }}{% endfor %}{% endif %}{% if post.topics|length > 0 %}
  191.               <span class="separator">|</span>{% endif %}
  192.             {% endif %}{% if post.type.type != 'event' %}{% if post.territories|length > 1 %}{% for t in post.territories %}{% if loop.last == false and post.territories|length > 1 %}{{ t.displayName ~", " }}{% else %}{{ t.displayName }}{% endif %}{% endfor %}{% else %}{% for t in post.territories %}{{ t.displayName }}{% endfor %}{% endif %}{% endif %}
  193.                     </span>
  194.           <br>
  195.           {% if post.type.type == 'event' %}{% else %}
  196.             <span class="colorGrey">{{ date|format_datetime(locale='fr', pattern="d MMMM Y") }}</span>
  197.           {% endif %}
  198.         </p>
  199.       </div>
  200.       <article>
  201.         <div class="container">
  202.           <h1 class="text-center">{{ post.title }}</h1>
  203.           <p class="article-subtitle">{{ short_description }}</p>
  204.           {% if post.type.type == 'event' %}
  205.             <p class="articleDate">
  206.               {{ event_date|raw }}
  207.             </p>
  208.             {% if post.horaires|length > 0 %}
  209.               <div class="articleHours"><strong>Horaires :</strong><br/>
  210.                 {{ post.horaires|raw }}
  211.               </div>
  212.             {% elseif event_heures|length > 0 %}
  213.               <div class="articleHours"><strong>Horaires :</strong><br/>
  214.                 {{ event_heures|raw }}
  215.               </div>
  216.             {% endif %}
  217.             <hr class="articleSeparator"/>
  218.           {% endif %}
  219.           {% if post.organizedBy|length > 0 %}
  220.             <div class="articleOrganizedBy"><strong>organisé par :</strong>
  221.               {{ post.organizedBy }}</div>
  222.           {% endif %}
  223.           <div class="containerContent pt-2 pb-2">
  224.             {{ content_post|raw }}
  225.             {% if post.type.type == 'quiz' %}
  226.               <br/>
  227.               {% include 'Nordinfo/Main/parts/quiz_block.html.twig' with {post: post, content_post, is_detail: true} only %}
  228.             {% endif %}
  229.           </div>
  230.           <hr class="articleSeparator"/>
  231.           {% if post.tarifs|length > 0 %}
  232.             <div class="articlePrices"><strong>Tarif(s) :</strong>
  233.               {{ post.tarifs }}</div>
  234.           {% endif %}
  235.         </div>
  236.       </article>
  237.       <div class="container-sm pt-5">
  238.         {% if is_pdf != 1 %}
  239.           {% include 'Nordinfo/Main/parts/cards-bottom.html.twig' %}
  240.           <div class="mb-5">
  241.             {% if is_pdf != 1 %}
  242.               {% if post.getIllustrationFilName is defined and post.getIllustrationFilName|length > 0 %}
  243.                 <img src="{{ asset('/upload/images/'~post.getIllustrationFilName) }}" class="illustrationBottom mt-3"
  244.                      alt="">
  245.               {% endif %}
  246.             {% endif %}
  247.             {% if post.credits is not null %}
  248.               <p class="text-secondary font-italic fontWeightMedium fsXs pb-2">Crédits photo :
  249.                 {{ post.credits }}
  250.               </p>
  251.             {% endif %}
  252.           </div>
  253.           {% if is_preview != 1 %}
  254.             {% include 'Nordinfo/Main/parts/article-actions.html.twig' with {'post_title':post.title, 'post_id':post.id, 'is_event':true } %}
  255.           {% endif %}
  256.         {% endif %}
  257.         {% if is_pdf != 1 %}
  258.           {% if related_posts|length > 0 %}
  259.             {% include 'Nordinfo/Main/parts/related_posts.html.twig' with {related_posts: related_posts} only %}
  260.           {% endif %}
  261.         {% endif %}
  262.       </div>
  263.       {% if related_posts|length > 0 %}
  264.         <div class="gradientRelatedPosts"></div>
  265.       {% endif %}
  266.     </main>
  267.   {% endif %}
  268.   {{ include('Nordinfo/Main/parts/cookieManager.js.html.twig') }}
  269. {% endblock %}