templates/front/theme1/page_cms.html.twig line 1

Open in your IDE?
  1. {% extends "front/"~ app.request.server.get('APP_THEME') ~"/base.html.twig" %}
  2. {% block preload %}
  3.     {% if post.image is defined  and post.image is not empty %}
  4.         {% if post.image %}
  5.             <link rel="preload" as="image" href="{{asset_image(post.image)}}" />
  6.         {% endif %}
  7.     {% endif %}
  8.      {% if galleries is defined and galleries is not empty %}
  9.            {% for item in galleries %}
  10.                 {% if item.path is defined %}
  11.                     <link rel="preload" as="image" href="{{asset_image_gallery(item.path)}}" />
  12.                 {% endif %}
  13.            {% endfor %}
  14.     {% endif %}
  15. {% endblock %}
  16. {% block stylesheets %}
  17.     {{parent()}}
  18.     {% if modele_galerie[0].type == 4 %}
  19.         <link rel="stylesheet" type="text/css" href="{{asset('templates/front/theme1/assets/plugins/flexslider/flexslider.css')}}" media="screen" >
  20.     {% endif %}
  21. {% endblock %}
  22. {% block body %}
  23.     {% if post.imageBandeau %}
  24.         {% set imagebandeau = post.imageBandeau %}
  25.     {% elseif parametre.imageBandeau %}
  26.         {% set imagebandeau = 'uploads/images/' ~ parametre.imageBandeau %}
  27.     {% else %}
  28.         {% set imagebandeau = '' %}
  29.     {% endif %}
  30.     
  31.     {% if imagebandeau != '' %}
  32.         <section class="image-bandeau text-center">
  33.             <img class="lazyload" alt="{{post.title}}" title="{{post.title}}" data-srcset="{{imagebandeau}}" src="{{asset(imagebandeau)}}" />
  34.             <div class="cnt-bandeau text-center">
  35.                 <div class="container-fluid wrapper">
  36.                     <ol class="breadcrumb d-flex justify-content-center" itemscope itemtype="http://schema.org/BreadcrumbList">
  37.                                 <li class="breadcrumb-item" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a href="{{path('index_page_home')}}" itemprop="item"><span itemprop="name">Accueil</span></a><meta itemprop="position" content="1" /></li>
  38.                                 {% set niveau = 2 %}
  39.                                 {% if categorieTree %}
  40.                                         {% for item in categorieTree %}
  41.                                             <li class="breadcrumb-item" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a href="{{path('page',{slug:item.slug})}}" title="{{item.titre}}" itemprop="item"><span itemprop="name">{{item.titre}}</span></a><meta itemprop="position" content="2" /></li> 
  42.                                             {% set niveau = 3 %}
  43.                                             {% if item.child is defined %}
  44.                                                 {% for item in item.child %}
  45.                                                     <li class="breadcrumb-item" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a href="{{path('page',{slug:item.slug})}}" title="{{item.titre}}" itemprop="item"><span itemprop="name">{{item.titre}}</span></a><meta itemprop="position" content="3" /></li> 
  46.                                                     {% set niveau = 4 %}
  47.                                                 {% endfor %}
  48.                                             {% endif %}
  49.                                         {% endfor %}
  50.                                 {% endif %}
  51.                                 <li class="breadcrumb-item active" aria-current="page" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><span itemprop="name">{{post.title}}</span><meta itemprop="position" content="{{niveau}}" /></li>
  52.                             </ol>
  53.                             {% if categorieTree %}
  54.                                 {# {% for item in categorieTree %} #}
  55.                                     <a class="article-retour text-center" href="{{path('page',{slug:categorieTree[0].slug})}}" title="Retour">Retour</a>
  56.                                 {# {% endfor %} #}
  57.                             {% endif %}
  58.                             <h1 class="page-title">{{post.title}}</h1>
  59.                 </div>
  60.             </div>
  61.         </section>
  62.     {% endif %}
  63.     <div class="page_cms pt-5">
  64.         {% if imagebandeau == '' %}
  65.         <div class="breadcrumb-style-default">
  66.             <div class="container-fluid wrapper">
  67.                 <div class="row">
  68.                     <div class="col-lg-12">
  69.                         <div class="inner text-center">
  70.                             <ol class="breadcrumb d-flex justify-content-center" itemscope itemtype="http://schema.org/BreadcrumbList">
  71.                                 <li class="breadcrumb-item" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a href="{{path('index_page_home')}}" itemprop="item"><span itemprop="name">Accueil</span></a><meta itemprop="position" content="1" /></li>
  72.                                 {% set niveau = 2 %}
  73.                                 {% if categorieTree %}
  74.                                         {% for item in categorieTree %}
  75.                                             <li class="breadcrumb-item" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a href="{{path('page',{slug:item.slug})}}" title="{{item.titre}}" itemprop="item"><span itemprop="name">{{item.titre}}</span></a><meta itemprop="position" content="2" /></li> 
  76.                                             {% set niveau = 3 %}
  77.                                             {% if item.child is defined %}
  78.                                                 {% for item in item.child %}
  79.                                                     <li class="breadcrumb-item" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a href="{{path('page',{slug:item.slug})}}" title="{{item.titre}}" itemprop="item"><span itemprop="name">{{item.titre}}</span></a><meta itemprop="position" content="3" /></li> 
  80.                                                     {% set niveau = 4 %}
  81.                                                 {% endfor %}
  82.                                             {% endif %}
  83.                                         {% endfor %}
  84.                                 {% endif %}
  85.                                 <li class="breadcrumb-item active" aria-current="page" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><span itemprop="name">{{post.title}}</span><meta itemprop="position" content="{{niveau}}" /></li>
  86.                             </ol>
  87.                             {% if categorieTree %}
  88.                                 {# {% for item in categorieTree %} #}
  89.                                     <a class="article-retour text-center" href="{{path('page',{slug:categorieTree[0].slug})}}" title="Retour">Retour</a>
  90.                                 {# {% endfor %} #}
  91.                             {% endif %}
  92.                             <h1 class="page-title">{{post.title}}</h1>
  93.                         </div>
  94.                     </div>
  95.                 </div>
  96.             </div>
  97.         </div>
  98.         {% endif %}
  99.         <div class="container-fluid wrapper mt-3">
  100.             <div class="row gx-5 py-2">
  101.                 {% if post.summary is not empty and post.summary != "" %}
  102.                     <div class="col-sm-12 text-center">
  103.                         <h2 class="sub-title wow">{{post.summary}}</h2>
  104.                     </div>
  105.                 {% endif %}
  106.                 
  107.                 {% if post.image and post.image is not empty and categorieTree is empty %}
  108.                     <div class="col-sm-12 text-center my-4">
  109.                         <img class="lazyload img-fluid principal-img" data-srcset="{{asset_image(post.image)}}" src="{{asset_image(post.image)}}" alt="{{post.title}}" />
  110.                     </div>
  111.                 {% endif %}
  112.                 {% if post.content is not empty and post.content != "" %}
  113.                     <div class="col-lg-12 content_post">
  114.                         {{post.content|raw}}
  115.                         {% if post.typelien == null %}
  116.                             {% if categorieTree is defined and categorieTree[0] is defined  %}
  117.                                 <div class="text-center py-2">
  118.                                     <a href="{{path('page',{slug:categorieTree[0].slug})}}" class="btn btn-primary py-3 px-5 mt-3 btn-plus">Retour à la liste {{categorieTree[0].titre}}</a>
  119.                                 </div>
  120.                             {% endif %}
  121.                         {% elseif post.typelien != 1 %}
  122.                                 {% if post.typelien == '4' %}
  123.                                     <div class="text-center py-2">
  124.                                         <a href="javascript:void(0)" onclick="window.location.href = 'tel:{{post.telephone}}';" class="btn btn-primary py-3 px-5 mt-3 btn-plus">{{post.titrelien}}</a>
  125.                                     </div>
  126.                                 {% elseif post.typelien == '2' %}
  127.                                     <div class="text-center py-2">
  128.                                         <a href="{{post.lieninterne}}" class="btn btn-primary py-3 px-5 mt-3 btn-plus">{{post.titrelien}}</a>
  129.                                     </div>
  130.                                 {% elseif post.typelien == '3' %}
  131.                                     <div class="text-center py-2">
  132.                                         <a href="{{post.lienexterne}}" target="_blank" class="btn btn-primary py-3 px-5 mt-3 btn-plus">{{post.titrelien}}</a>
  133.                                     </div>
  134.                                 {% endif %}
  135.                         {% endif %}
  136.                         {% if docs and docs is not empty %}
  137.                             <div class="col-md-12 bloc-docs d-flex justify-content-center">
  138.                                 {% for doc in docs %}
  139.                                     <a class="btn-back-pulse m-2" href="{{doc.location ~ doc.path ~ '/' ~ doc.fileName}}" title="{{doc.fileName|slice(0, -4)}}" target="_blank"><i class="fa fa-file-pdf-o mr-2"></i>{{doc.fileName|slice(0, -4)}}</a>   
  140.                                 {% endfor %}
  141.                             </div>
  142.                         {% endif %}
  143.                         {% if champsPersonnalises %}
  144.                             {% for key1, champ in champsPersonnalises %}
  145.                                 {% if champ %}
  146.                                     <div class="my-4">
  147.                                     {% for key2, lbl in lblchampsPersonnalises %}
  148.                                         {% if key2 == key1 %}
  149.                                             {{lbl}} :
  150.                                         {% endif %}
  151.                                     {% endfor %}
  152.                                     <a href="{{champ}}" title="{{champ}}" target="_blank">{{champ}}</a></div>
  153.                                 {% endif %}
  154.                             {% endfor %}
  155.                         {% endif %}
  156.                     </div>
  157.                 {% endif %}
  158.             </div>
  159.             {% if next_article is defined and next_article is not empty or prev_article is defined and prev_article is not empty %}
  160.                <div class="row gx-5 py-4">
  161.                     <div class="col-lg-12 d-flex justify-content-between">
  162.                         <div class="">
  163.                             {% if prev_article is defined and prev_article is not empty %}
  164.                               <a href="{{path('page',{'slug':prev_article.slug})}}" title="{{prev_article.title}}"><span class="signe1"><i class="fa fa-arrow-left"></i></span> {{prev_article.title}}</a>
  165.                             {% endif %}
  166.                         </div>
  167.                         <div class="">
  168.                             {% if next_article is defined and next_article is not empty %}
  169.                               <a href="{{path('page',{'slug':next_article.slug})}}"  title="{{next_article.title}}">{{next_article.title}}  <span class="signe1"><i class="fa fa-arrow-right"></i></span></a>
  170.                             {% endif %}
  171.                         </div>
  172.                     </div>
  173.                 </div>
  174.             {% endif %}
  175.         </div>
  176.         {# {% if galleries and galleries is not empty %}
  177.             {{ include ('front/'~ app.request.server.get('APP_THEME') ~'/bloc/galleries.html.twig',{galleries: galleries,post:post}, with_context = false)}}
  178.         {% endif %} #}
  179.         {% if galleries and galleries is not empty and template_model_gallerie is defined and template_model_gallerie is not empty %}
  180.             {{ include(template_from_string(template_model_gallerie)) }}
  181.         {% endif %}
  182.         {% if post.urlvideo is not empty %}
  183.             <div class="container-fluid wrapper mt-3">
  184.                 <div class="col-md-12 mt-1">
  185.                     <div class="video">
  186.                         {% set id_video_externe = post.urlvideo|split('?v=')[1] %}
  187.                         <a class="video-thumbnail m-0" href="{{post.urlvideo}}" data-fancybox="video">
  188.                             <img src="https://img.youtube.com/vi/{{id_video_externe}}/maxresdefault.jpg" class="img-fluid" alt=""/>
  189.                         </a>
  190.                     </div>
  191.                 </div>
  192.             </div>
  193.         {% endif %}
  194.         {% if blocs is defined  %}
  195.             {% for bloc in blocs.Bloc %}
  196.                 {% if is_mobile() and  bloc.mobile == true   %}
  197.                     {{ include ('front/'~ app.request.server.get('APP_THEME') ~'/bloc/bloc.html.twig',{
  198.                         bloc: bloc,
  199.                     }, with_context = false)}}
  200.                 {% endif %}
  201.                 
  202.                 {% if is_full_view() and is_mobile() == false and bloc.desktop == true %}
  203.                     {{ include ('front/'~ app.request.server.get('APP_THEME') ~'/bloc/bloc.html.twig',{
  204.                         bloc: bloc,
  205.                     }, with_context = false)}}
  206.                 {% endif %}
  207.             {% endfor %}
  208.         {% endif %} 
  209.     </div> 
  210. {% endblock %}
  211. {% block javascripts %}
  212.     {{parent()}}
  213.     <script src="{{ asset('assets-admin/plugins/form-builder-io/formio.full.min.js') }}"></script>
  214.     <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>
  215.     <script>
  216.     
  217.         var current_fs, next_fs, previous_fs;
  218.         var left, opacity, scale; 
  219.         var animating; 
  220.         $(".next").click(function(){
  221.             current_fs = $(this).parent();
  222.             next_fs = $(this).parent().next();
  223.             
  224.             if (!validateForm(current_fs)) {
  225.                 return false;
  226.             }
  227.             if(animating) return false;
  228.             animating = true;
  229.         
  230.             $("#progressbar li").eq($("fieldset").index(next_fs)).addClass("active");
  231.             next_fs.show(); 
  232.             //hide the current fieldset with style
  233.             current_fs.animate({opacity: 0}, {
  234.                         step: function(now, mx) {
  235.                             //as the opacity of current_fs reduces to 0 - stored in "now"
  236.                             //1. scale current_fs down to 80%
  237.                             scale = 1 - (1 - now) * 0.2;
  238.                             //2. bring next_fs from the right(50%)
  239.                             left = (now * 50)+"%";
  240.                             //3. increase opacity of next_fs to 1 as it moves in
  241.                             opacity = 1 - now;
  242.                             current_fs.css({
  243.                         'transform': 'scale('+scale+')',
  244.                         'position': 'absolute'
  245.                     });
  246.                     next_fs.css({'left': left, 'opacity': opacity});
  247.                 }, 
  248.                 duration: 1000, 
  249.                 complete: function(){
  250.                     current_fs.hide();
  251.                     animating = false;
  252.                 }, 
  253.                 //this comes from the custom easing plugin
  254.                 easing: 'easeInOutBack'
  255.             });
  256.         });
  257.         $(".previous").click(function(){
  258.             current_fs = $(this).parent();
  259.             previous_fs = $(this).parent().prev();
  260.             // if (!validateForm(current_fs)) {
  261.             //     return false;
  262.             // }
  263.             if(animating) return false;
  264.             animating = true;
  265.             
  266.             //de-activate current step on progressbar
  267.             $("#progressbar li").eq($("fieldset").index(current_fs)).removeClass("active");
  268.             
  269.             //show the previous fieldset
  270.             previous_fs.show(); 
  271.             //hide the current fieldset with style
  272.             previous_fs.css({'transform': 'scale(1)', 'opacity': '1','position':'relative'});
  273.             current_fs.hide();
  274.             animating = false;
  275.             // current_fs.animate({opacity: 0}, {
  276.             //     step: function(now, mx) {
  277.             //         //as the opacity of current_fs reduces to 0 - stored in "now"
  278.             //         //1. scale previous_fs from 80% to 100%
  279.             //         scale = 0.8 + (1 - now) * 0.2;
  280.             //         //2. take current_fs to the right(50%) - from 0%
  281.             //         left = ((1-now) * 50)+"%";
  282.             //         //3. increase opacity of previous_fs to 1 as it moves in
  283.             //         opacity = 1 - now;
  284.             //         current_fs.css({'left': left});
  285.             //         previous_fs.css({'transform': 'scale('+scale+')', 'opacity': opacity,'position':'relative'});
  286.             //     }, 
  287.             //     duration: 800, 
  288.             //     complete: function(){
  289.             //         current_fs.hide();
  290.             //         animating = false;
  291.             //     }, 
  292.             //     //this comes from the custom easing plugin
  293.             //     easing: 'easeInOutBack'
  294.             // });
  295.         });
  296.         // $(".form-wizrd .submit.action-button").click(function(e){
  297.         //      current_fs = $(this).parent();
  298.         //      if (!validateForm(current_fs)) {
  299.         //         return false;
  300.         //      }
  301.         // });
  302.         function validateForm(current_fs) {
  303.             let formTabs, formInputs, i, valid = true;
  304.             formInputs = current_fs[0].querySelectorAll('[data-form-input]');
  305.      
  306.             for (i = 0; i < formInputs.length; i++) {
  307.                 if (formInputs[i].hasAttribute("required") && $(formInputs[i]).attr('type') != 'checkbox') {
  308.                     formInputs[i].addEventListener('keyup', (event) => {
  309.                         event.target.classList.remove("has-error");
  310.                         $(event.target.parentElement).find('.invalid-feedback').css('display','none');
  311.                        // event.target.nextElementSibling.style.display = "none";
  312.                     });
  313.                 }
  314.                 if (formInputs[i].hasAttribute("required") && $(formInputs[i]).attr('type') == 'checkbox') {
  315.                     formInputs[i].addEventListener('change', (event) => {
  316.                         if($(event.target).is(':checked')){
  317.                             $(event.target).attr('checked', true);
  318.                         }else{
  319.                             $(event.target).attr('checked', false);
  320.                         }
  321.                         event.target.classList.remove("has-error");
  322.                         $(event.target.parentElement).find('.invalid-feedback').css('display','none');
  323.                         //event.target.nextElementSibling.style.display = "none";
  324.                     });
  325.                 }
  326.                 if (formInputs[i].hasAttribute("required") && formInputs[i].nodeName == 'SELECT') {
  327.                     formInputs[i].addEventListener('change', (event) => {
  328.                         console.log('select change');
  329.                         event.target.classList.remove("has-error");
  330.                         $(event.target.parentElement).find('.invalid-feedback').css('display','none');
  331.                         //event.target.nextElementSibling.style.display = "none";
  332.                     });
  333.                 }
  334.                 if (formInputs[i].hasAttribute("required") && $(formInputs[i]).attr('type') == 'email') {
  335.                     formInputs[i].addEventListener('keyup', (event) => {
  336.                         console.log(isEmail(event.target.value));
  337.                         if (isEmail(event.target.value) == true) {
  338.                            event.target.classList.remove("has-error");
  339.                            $(event.target.parentElement).find('.invalid-feedback').css('display','none');
  340.                         }else{
  341.                             if (!event.target.classList.contains('has-error')) {
  342.                                 event.target.className += " has-error";
  343.                             }
  344.                             $(event.target.parentElement).find('.invalid-feedback').html('Veuillez choisir un email valide.');
  345.                             $(event.target.parentElement).find('.invalid-feedback').css('display','block');
  346.                         }
  347.                        // event.target.nextElementSibling.style.display = "none";
  348.                     });
  349.                 }
  350.                 if(formInputs[i].hasAttribute("required")){
  351.                     if ($(formInputs[i]).attr('type') == 'checkbox' && $(formInputs[i]).is(':checked') == false) {
  352.                         if (!formInputs[i].classList.contains('has-error')) {
  353.                             formInputs[i].className += " has-error";
  354.                         }
  355.                         $(formInputs[i].parentElement).find('.invalid-feedback').css('display','block');
  356.                         valid = false;
  357.                     }else if(formInputs[i].value == "" && ($(formInputs[i]).attr('type') == 'text' || formInputs[i].nodeName == 'SELECT' || formInputs[i].nodeName == 'TEXTAREA')){
  358.                         if (!formInputs[i].classList.contains('has-error')) {
  359.                             formInputs[i].className += " has-error";
  360.                         }
  361.                         $(formInputs[i].parentElement).find('.invalid-feedback').css('display','block');
  362.                          valid = false;
  363.                     }else if(!isEmail(formInputs[i].value) && $(formInputs[i]).attr('type') == 'email'){
  364.                         if (!formInputs[i].classList.contains('has-error')) {
  365.                             formInputs[i].className += " has-error";
  366.                         }
  367.                         $(formInputs[i].parentElement).find('.invalid-feedback').css('display','block');
  368.                          valid = false;
  369.                     }
  370.                     //formInputs[i].nextElementSibling.style.display = "block";                   
  371.                 }
  372.             }
  373.             return valid;
  374.         }
  375.         function isEmail(email) {
  376.             var EmailRegex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
  377.             return EmailRegex.test(email);
  378.         }
  379.     </script>
  380.     <script>
  381.        if(document.getElementById("builder")){
  382.         var data_fields = document.getElementById("builder").getAttribute('data-config');
  383.         if(data_fields != ''){
  384.            data_fields = JSON.parse(data_fields);
  385.            console.log(JSON.parse(data_fields));
  386.            Formio.createForm(document.getElementById('builder'), 
  387.               JSON.parse(data_fields),
  388.            ).then(function(form) {
  389.                 // Prevent the submission from going to the form.io server.
  390.                 form.nosubmit = true;
  391.                 // Triggered when they click the submit button.
  392.                 form.on('submit', function(submission) {
  393.                     var data = submission.data;
  394.                     grecaptcha.execute('{{ParametreSite().clekey}}', {action: 'create_comment'}).then(token => {
  395.                         $('#builder').find('[name=g-recaptcha-response]').val(token);
  396.                         data['g-recaptcha-response'] = token;
  397.                         data['IdForm'] = $('#builder').parent().find('input[name="IdForm"]').val();
  398.                         $('#builder').parent().find('button[type="submit"]').attr('disabled','true');
  399.                         $.ajax({
  400.                             type:"POST",
  401.                             cache:false,
  402.                             url:"{{path('save_form')}}",
  403.                             data:data,   
  404.                             success: function (data) {
  405.                                window.location = data
  406.                             }
  407.                         });
  408.                     });
  409.                 });
  410.             });
  411.         }
  412.        }
  413.     </script>
  414.     {% if modele_galerie[0].type == 4 %}
  415.         {{parent()}}
  416.         <script src="{{asset('templates/front/theme1/assets/plugins/flexslider/jquery.flexslider.js')}}" ></script>
  417.         <script>    
  418.             /*-------------------------------------------------*/
  419.             /* =  Sx flexslider 
  420.             /*-------------------------------------------------*/
  421.             if ($(".sx_flexslider").length) {
  422.             $('.flex-carousel').flexslider({
  423.             animation: "slide",
  424.             controlNav: false,
  425.             animationLoop: true,
  426.             slideshow: false,
  427.             itemWidth: 150,
  428.             asNavFor: '.flex-slider'
  429.             });
  430.             $('.flex-slider').flexslider({
  431.             animation: "slide",
  432.             controlNav: false,
  433.             animationLoop: true,
  434.             slideshow: false,
  435.             sync: ".flex-carousel"
  436.             });
  437.             }
  438.         </script>
  439.     {% endif %}
  440.     
  441. {% endblock %}