templates/actualite/view.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block title %}CEP-I Actualité{% endblock %}
  3. {% block stylesheets %}
  4.   <link rel="shortcut icon" type="image/x-icon" href="/assets/images/favicon.ico">
  5.   <link rel="stylesheet" type="text/css" href="/assets/vendor/magnific-popup.css">
  6.   <link rel="stylesheet" type="text/css" href="/assets/vendor/slick-master/slick/slick.css">
  7.   <link rel="stylesheet" type="text/css" href="/assets/vendor/selectric/public/selectric.css">
  8.   <link rel="stylesheet" type="text/css" href="/assets/css/bundle.css">
  9.   <link rel="stylesheet" type="text/css" href="/assets/font-awesome/css/fontawesome-all.css">
  10.   <style>
  11.     .block_file img {
  12.       display: block;
  13.       margin: auto;
  14.       max-width: 100% !important;
  15.     }
  16.   </style>
  17.   <script src="/assets/vendor/jquery-3.1.1.min.js"></script>
  18. {% endblock %}
  19. {% block breadcrumps %}
  20.   <div class="breadcrumps">
  21.     <div class="shell">
  22.       <ul>
  23.         <li>
  24.           <a href="{{ path('accueil') }}">Accueil</a>
  25.         </li>
  26.         <li>
  27.           <a href="{{ path('actualites') }}">Actualités</a>
  28.         </li>
  29.         <li>
  30.           <a href="{{ path('actualite_view', {'title' : actualite.link}) }}">{{ actualite.title }}</a>
  31.         </li>
  32.       </ul>
  33.     </div><!-- /.shell -->
  34.   </div><!-- /.breadcrumps -->
  35. {% endblock %}
  36. {% block body %}
  37.   <section class="section-secondary section-secondary--def">
  38.     <div class="shell shell--alt">
  39.       <div class="section__body">
  40.         <a href="{{ path('actualites') }}" class="link link-back">
  41.                         <span class="ico-container">
  42.                             <i class="ico-arrow-back"></i>
  43.                             <i class="ico-arrow-back-green"></i>
  44.                         </span>
  45.           Retour Aux Actualités
  46.         </a>
  47.         <header class="section__head">
  48.           <h5>
  49.               {% set categories = actualite.category|split(',') %}
  50.               {% for cat in categories %}
  51.                 {{ util_service.articleCategorieVersLabel(cat) }}
  52.               {% endfor %}
  53.           </h5>
  54.           <h2>
  55.               {{ actualite.title ?? '' }}
  56.           </h2>
  57.           <h6>Le {{ actualite.publishDate|date('d/m/Y') }}</h6>
  58.           <div>
  59.               {{ actualite.description ? actualite.description|nl2br : '' }}
  60.           </div>
  61.         </header><!-- /.section__head -->
  62.         <div class="intro intro--small-alt">
  63.             {% if actualite.id is defined and actualite.image is defined and actualite.image is not null %}
  64.               <div class="intro__bg" style="background-image: url(
  65.               {{ '/assets/uploads/actualite/' ~ actualite.id ~ '/' ~ actualite.image }}
  66.                       );"></div>
  67.             {% endif %}
  68.         </div><!-- /.intro-small -->
  69.           {% for paragraphe in paragraphes %}
  70.               {% set mediaPosition = paragraphe.mediaPosition == 'Droite' ? 'float: right;' : 'float: left;' %}
  71.             <div class="section__content" id="{{ loop.index }}">
  72.               <h3>{{ paragraphe.title ?? null }}</h3>
  73.                 {% if paragraphe.image is defined and paragraphe.image is not null and paragraphe.image is not empty %}
  74.                   <figure class="figure-image" style="{{ mediaPosition }}">
  75.                     <img style="height: auto; max-height: 320px;"
  76.                          src="{{ '/assets/uploads/paragraphe/' ~ paragraphe.id ~ '/' ~ paragraphe.image }}" alt
  77.                     >
  78.                   </figure>
  79.                   <p>{{ paragraphe.content ? util_service.bbcodeToHtml(paragraphe.content|escape)|raw|nl2br : null }}</p>
  80.                   <div style="clear: both;"></div>
  81.                 {% elseif paragraphe.video is defined and paragraphe.video is not null and paragraphe.video is not empty %}
  82.                   <figure class="figure-video" style="{{ mediaPosition }}">
  83.                     <div class="video">
  84.                       <iframe src="{{ paragraphe.video|replace({'youtube.com/watch?v=' : 'youtube.com/embed/'}) }}"
  85.                               frameborder="0" allowfullscreen
  86.                       ></iframe>
  87.                     </div>
  88.                   </figure>
  89.                   <p>{{ paragraphe.content ? util_service.bbcodeToHtml(paragraphe.content|escape)|raw|nl2br : null }}</p>
  90.                   <div style="clear: both;"></div>
  91.                 {% else %}
  92.                   <p>{{ paragraphe.content ? util_service.bbcodeToHtml(paragraphe.content|escape)|raw|nl2br : null }}</p>
  93.                 {% endif %}
  94.                 {% if actualite.files %}
  95.                   {% set fic = actualite.files|split('/') %}
  96.                   {% set filePath = "/assets/uploads/actualite/" ~ actualite.id ~ "/" ~ actualite.files %}
  97.                   <div class="block_file" style="width: 250px;text-align: center; font-size: 45px">
  98.                     {{ previewFile(fic[fic|length - 1],filePath)|raw }}
  99.                   </div>
  100.                 {% endif %}
  101.             </div>
  102.           {% endfor %}
  103.       </div><!-- /.section__body -->
  104.     </div><!-- /.shell -->
  105.   </section><!-- /.section -->
  106.   <section class="section section--features section--features-def">
  107.     <div class="section__bg" style="background-image: url(/assets/images/temp/bg-1.jpg);"></div><!-- /.section__bg -->
  108.     <div class="shell">
  109.       <header class="section__head">
  110.         <h2 class="title">Les Autres Actualités</h2>
  111.       </header><!-- /.section__head -->
  112.       <div class="section__body">
  113.         <div class="features">
  114.           {% for autre in autres %}
  115.           <div class="feature feature--primary">
  116.             <a href="{{ path('actualite_view', {'title' : autre.link}) }}">
  117.               {% if autre.image is defined and autre.image is not null %}
  118.                 <div class="feature__image" style="background-image: url(
  119.                 {{ '/assets/uploads/actualite/' ~ autre.id ~ '/' ~ autre.image }}
  120.                         );"></div>
  121.               {% else %}
  122.                 <div class="feature__image" style="background-color: #A0C32E;"></div>
  123.               {% endif %}
  124.               <div class="feature__body">
  125.                 <h5>
  126.                     {% set categories = autre.category|split(',') %}
  127.                     {% for cat in categories %}
  128.                         {{ util_service.articleCategorieVersLabel(cat) }}
  129.                     {% endfor %}
  130.                 </h5>
  131.                 <p>
  132.                   {{ autre.title }}
  133.                 </p>
  134.               </div><!-- /.feature__body -->
  135.             </a>
  136.           </div><!-- /.feature -->
  137.           {% endfor %}
  138.         </div><!-- /.features -->
  139.       </div><!-- /.section__body -->
  140.     </div><!-- /.shell -->
  141.   </section><!-- /.section -->
  142.   {% include '__includes__/newsletterForm.html.twig' %}
  143.   <script>
  144.     let styleDynamicImage = function() {
  145.       let imageFigures = document.getElementsByClassName('figure-image');
  146.       for (let figure of imageFigures) {
  147.         let img = figure.getElementsByTagName('img')[0];
  148.         if (img.naturalHeight > img.naturalWidth) {
  149.           figure.style.maxWidth = 'none';
  150.           img.style.maxHeight = '320px';
  151.         }
  152.       }
  153.     };
  154.     // window.onload = styleDynamicImage;
  155.   </script>
  156. {% endblock %}
  157. {% block javascripts %}
  158.   <script src="/assets/vendor/magnific-popup.js"></script>
  159.   <script src="/assets/vendor/slick-master/slick/slick.min.js"></script>
  160.   <script src="/assets/vendor/selectric/public/jquery.selectric.min.js"></script>
  161.   <script src="/assets/vendor/jquery-scrollLock.min.js"></script>
  162.   <script src="/assets/vendor/validator.js"></script>
  163.   <script src="/assets/js/bundle.js"></script>
  164. {% endblock %}