templates/main/index.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block title %}Accueil - CinéDevRT{% endblock %}
  3. {% block body %}
  4.     <main>
  5.         <div id="slider_container">
  6.             <div> Les films du moment </div>
  7.             <section id="slider">
  8.                 <div>
  9.                     <a>  </a>
  10.                     {% set sliderImgNumber = "-2" %}
  11.                     {% for movie in movies %}
  12.                         <a href="{{ path('filmsShow', {id: movie.id}) }}">
  13.                             <img src="{{ asset('uploads/' ~ movie.file) }}"> 
  14.                             <div id="sliderImg{{ sliderImgNumber }}"> </div>
  15.                         </a>
  16.                         {% set sliderImgNumber = sliderImgNumber + 1 %}
  17.                     {% endfor %}
  18.                     <a>  </a>
  19.                 </div>
  20.             </section>
  21.             <div id="arrow">
  22.                     <div> <i id="arrowLeft" onclick="slideLeft()" class="fas fa-chevron-circle-left"></i> </div>
  23.                     <div> <i id="arrowRight" onclick="slideRight()" class="fas fa-chevron-circle-right"></i> </div>
  24.             </div>
  25.         </div>
  26.         <section id="onDisplay">
  27.             <div> <h2> Films à l'affiche </h2> </div>
  28.             <section>
  29.                 {% for movie in movies %}
  30.                     <div>
  31.                         <div> <img src="{{ asset('uploads/' ~ movie.file) }}"> </div>
  32.                         <div>  
  33.                             <h3> {{ movie.title }} </h3>
  34.                             <div>
  35.                                 <div> <strong> Durée : </strong> 2h </div>
  36.                                 <div> <strong> Genres : </strong> Fantaisie, Action </div>
  37.                                 <div> <strong> Réalisateurs : </strong> {{ movie.realisedBy }} </div>
  38.                             </div>
  39.                             <a href="{{ path('filmsShow', {id: movie.id}) }}"> Séances </a>
  40.                         </div>
  41.                     </div>
  42.                 {% endfor %}
  43.             </section>
  44.         </section>
  45.         {# modal #}
  46.             <div id="modal"> 
  47.                 <div> 
  48.                     <h2> Ce site est un petit projet fictif de développeur </h2>
  49.                     <h3> Le projet est actuellement en pause et non terminé </h3>
  50.                     <p> Vous pouvez tout de même tester les fonctionnalités actuelles en créant votre compte </p>
  51.                     <p> Retrouvez davantage d'information dans la page "Contact" </p>
  52.                     <p> (Non responsive pour le moment) </p>
  53.                     <button onclick="closeModal()"> Fermer la pop up </button>
  54.                 </div>
  55.             </div>
  56.         {# end modal #}
  57.     </main>
  58.     <script>
  59.         function closeModal(){
  60.             document.getElementById("modal").style.display = "none";
  61.         }
  62.         var valueInitR;
  63.         var valueInitL;
  64.         var counter = 0;
  65.         
  66.         function resetLeftArrow() {
  67.             document.getElementById("arrowLeft").style.transform = "rotate(0deg)";
  68.         }
  69.         function resetRightArrow() {
  70.             document.getElementById("arrowRight").style.transform = "rotate(0deg)";
  71.         }
  72.         function resetTransitionLeftArrow() {
  73.             document.getElementById("arrowLeft").style.transition = "unset";
  74.         }
  75.         function resetTransitionRightArrow() {
  76.             document.getElementById("arrowRight").style.transition = "unset";
  77.         }
  78.         function slideLeft() {
  79.             console.log(counter);
  80.             switch (counter) {
  81.                 case -2:
  82.                     break;
  83.                 case -1:
  84.                     document.getElementById("slider").style.right = "33.33%";
  85.                     document.getElementById("slider").style.transform = "translateX(33.33%)";
  86.                     document.getElementById("arrowLeft").style.transform = "rotate(360deg)";
  87.                     document.getElementById("arrowLeft").style.transition = "transform 0.5s";
  88.                     document.getElementById("sliderImg-2").style.opacity = "unset";
  89.                     document.getElementById("sliderImg-2").style.backgroundColor = "unset";
  90.                     document.getElementById("sliderImg-1").style.opacity = "0.7";
  91.                     document.getElementById("sliderImg-1").style.backgroundColor = "black";
  92.                     counter--;
  93.                     break;
  94.                 case 0:
  95.                     document.getElementById("slider").style.right = "16.66%";
  96.                     document.getElementById("slider").style.transform = "translateX(-16.66%)";
  97.                     document.getElementById("arrowLeft").style.transform = "rotate(360deg)";
  98.                     document.getElementById("arrowLeft").style.transition = "transform 0.5s";
  99.                     document.getElementById("sliderImg-1").style.opacity = "unset";
  100.                     document.getElementById("sliderImg-1").style.backgroundColor = "unset";
  101.                     document.getElementById("sliderImg0").style.opacity = "0.7";
  102.                     document.getElementById("sliderImg0").style.backgroundColor = "black";
  103.                     counter--;
  104.                     break;
  105.                 case 1:
  106.                     document.getElementById("slider").style.right = "33.33%";
  107.                     document.getElementById("slider").style.transform = "translateX(-33.33%)";
  108.                     document.getElementById("arrowLeft").style.transform = "rotate(360deg)";
  109.                     document.getElementById("arrowLeft").style.transition = "transform 0.5s";
  110.                     document.getElementById("sliderImg0").style.opacity = "unset";
  111.                     document.getElementById("sliderImg0").style.backgroundColor = "unset";
  112.                     document.getElementById("sliderImg1").style.opacity = "0.7";
  113.                     document.getElementById("sliderImg1").style.backgroundColor = "black";
  114.                     counter--;
  115.                     break;
  116.                 case 2:
  117.                     document.getElementById("slider").style.right = "49.99%";
  118.                     document.getElementById("slider").style.transform = "translateX(-49.99%)";
  119.                     document.getElementById("arrowLeft").style.transform = "rotate(360deg)";
  120.                     document.getElementById("arrowLeft").style.transition = "transform 0.5s";
  121.                     document.getElementById("sliderImg1").style.opacity = "unset";
  122.                     document.getElementById("sliderImg1").style.backgroundColor = "unset";
  123.                     document.getElementById("sliderImg2").style.opacity = "0.7";
  124.                     document.getElementById("sliderImg2").style.backgroundColor = "black";                
  125.                     counter--;
  126.                     break;
  127.                 default:
  128.                     break;
  129.             }
  130.             setTimeout(resetTransitionLeftArrow, 501);
  131.             setTimeout(resetLeftArrow, 502);
  132.         }
  133.         function slideRight() {
  134.             console.log(counter);
  135.             switch (counter) {
  136.                 case -2:
  137.                     document.getElementById("slider").style.right = "16.66%";
  138.                     document.getElementById("slider").style.transform = "translateX(-16.66%)";
  139.                     document.getElementById("arrowRight").style.transform = "rotate(360deg)";
  140.                     document.getElementById("arrowRight").style.transition = "transform 0.5s";
  141.                     document.getElementById("sliderImg-1").style.opacity = "unset";
  142.                     document.getElementById("sliderImg-1").style.backgroundColor = "unset";
  143.                     document.getElementById("sliderImg-2").style.opacity = "0.7";
  144.                     document.getElementById("sliderImg-2").style.backgroundColor = "black";
  145.                     counter++;
  146.                     break;
  147.                 case -1:
  148.                     document.getElementById("slider").style.right = "33.33%";
  149.                     document.getElementById("slider").style.transform = "translateX(-33.33%)";
  150.                     document.getElementById("arrowRight").style.transform = "rotate(360deg)";
  151.                     document.getElementById("arrowRight").style.transition = "transform 0.5s";
  152.                     document.getElementById("sliderImg0").style.opacity = "unset";
  153.                     document.getElementById("sliderImg0").style.backgroundColor = "unset";
  154.                     document.getElementById("sliderImg-1").style.opacity = "0.7";
  155.                     document.getElementById("sliderImg-1").style.backgroundColor = "black";
  156.                     counter++;
  157.                     break;
  158.                 case 0:
  159.                     document.getElementById("slider").style.right = "49.99%";
  160.                     document.getElementById("slider").style.transform = "translateX(-49.99%)";
  161.                     document.getElementById("arrowRight").style.transform = "rotate(360deg)";
  162.                     document.getElementById("arrowRight").style.transition = "transform 0.5s";
  163.                     document.getElementById("sliderImg1").style.opacity = "unset";
  164.                     document.getElementById("sliderImg1").style.backgroundColor = "unset";
  165.                     document.getElementById("sliderImg0").style.opacity = "0.7";
  166.                     document.getElementById("sliderImg0").style.backgroundColor = "black";
  167.                     counter++;
  168.                     break;
  169.                 case 1:
  170.                     document.getElementById("slider").style.right = "66.66%";
  171.                     document.getElementById("slider").style.transform = "translateX(-66.66%)";
  172.                     document.getElementById("arrowRight").style.transform = "rotate(360deg)";
  173.                     document.getElementById("arrowRight").style.transition = "transform 0.5s";
  174.                     document.getElementById("sliderImg2").style.opacity = "unset";
  175.                     document.getElementById("sliderImg2").style.backgroundColor = "unset";
  176.                     document.getElementById("sliderImg1").style.opacity = "0.7";
  177.                     document.getElementById("sliderImg1").style.backgroundColor = "black";
  178.                     counter++;
  179.                     break;
  180.                 case 2:
  181.                     break;
  182.                 default:
  183.                     break;
  184.             }
  185.             setTimeout(resetTransitionRightArrow, 501);
  186.             setTimeout(resetRightArrow, 502);
  187.         }
  188.     
  189.     </script>
  190. {% endblock %}