templates/galerie/detail.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block title %}{% endblock %}
  3. {% block stylesheets %}
  4.          <link rel="stylesheet" href="{{ asset('/css/detail-galerie.css') }}">  
  5.          <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1"/> 
  6.         {% endblock %} 
  7. {% block body %}
  8.             <main class="section-services" style="z-index:-1">  </main>
  9.     <div class="section-gallery">
  10.     <div class="container">
  11.       <div class="row pb-5">
  12.         <div class="col-md-12 text-center">
  13.           <h5> {{galerie.titre}} </h5>
  14.           
  15.         </div>
  16.       </div>
  17.       <input type="hidden" id="path-img" value="{{asset('upload/galerie/images/')}}"/>
  18.       
  19.   <div id="accordion">
  20.   
  21.   <div class="card">
  22.   
  23.     <div class="card-header {{ app.request.locale == 'ar_TN' ? 'form_direction_rtl' : 'form_direction_ltr' }}" id="headingOne">
  24.     
  25.     <p>{{galerie.description}}</p>
  26.       <h5> 
  27.         <button class="btn btn-link" style="margin-top: 10px !important;" data-toggle="collapse" data-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
  28.         <span id="flesh"> > </span> {% trans  %} detail_galerie.Images{% endtrans %}   
  29.         </button>
  30.       </h5>
  31.     </div>
  32.     <div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
  33.     
  34.       <div class="card-body">
  35.       
  36.       <div class="box">
  37.       
  38.       {% set lastImageId = 0 %}
  39.         {% for image in galerie.images %}
  40.           {% if loop.index <= 2 %}
  41.           
  42.             
  43.             <div class="dream" onclick="showImg('{{image.image}}')" style="border-radius: 15px;background-image : url('{{asset('upload/galerie/images/')}}{{image.image}}')" id="dream-img">
  44.             </div>
  45.             {% set lastImageId = image.id %}
  46.             
  47.           {% endif %}
  48.         {% endfor %}
  49.         <input type="hidden" id="gallery-last-image-id" value="{{ lastImageId }}">
  50.            <button  id='gallery-more-images' type="button" class="btn btn-success" style="position: absolute;bottom: 6px;right: 6px;">{% trans  %} detail_galerie.Voir Plus {% endtrans %}</button>
  51.       </div>
  52.       </div>
  53.     </div>
  54.   </div>
  55.   <div class="card" >
  56.     <div class="card-header" id="headingTwo">
  57.       <h5 class="mb-0" >
  58.         <button class="btn btn-link  collapsed"  style="margin-top: 0px ;color: white; !important;"data-toggle="collapse" data-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
  59.        <span id="flesh"> > </span> {% trans  %} detail_galerie.Videos {% endtrans %}   
  60.         </button>
  61.       </h5>
  62.     </div>
  63.     <div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordion">
  64.       <div class="card-body">
  65.  
  66.       <div class="box" >
  67.       {% set lastVideoId = 0 %}
  68.         {% for video in galerie.videos %}
  69.           {% if loop.index <= 2 %}
  70.             <div class="dream" id="dream-img" >
  71.               <video src="/upload/galerie/videos/{{video.video}}" width="100%" controls autostart="false">  </video> 
  72.             </div> 
  73.             {% set lastVideoId = video.id %}
  74.           {% endif %}
  75.         {% endfor %}
  76.         <input type="hidden" id="gallery-last-video-id" value="{{ lastVideoId }}">
  77.            <button id='gallery-more-videos' type="button" class="btn btn-success" style="position: absolute;bottom: 6px;right: 6px;;">{% trans  %} detail_galerie.Voir Plus {% endtrans %} </button>
  78.       </div>
  79.       </div>
  80.     </div>
  81.   </div>
  82. </div>
  83.       <div id="myModal" class="modal">
  84.         
  85.         <div class="modal-content" id="img01" style="height: 100%; background-size: contain; background-repeat: no-repeat; background-position: center center;"></div>
  86.         <span class="close">&times;</span>
  87.       </div>
  88.      
  89.     </div>
  90.   </div>
  91. <script>
  92.   // Get the modal
  93. var modal = document.getElementById("myModal");
  94. // Get the image and insert it inside the modal - use its "alt" text as a caption
  95. var img = document.getElementById("dream-img");
  96. var modalImg = document.getElementById("img01");
  97. var pathImg = document.getElementById("path-img").value;
  98. {# img.onclick = function(){
  99.   modal.style.display = "block";
  100.   modalImg.style.backgroundImage = this.backgroundImage;
  101. } #}
  102. function showImg(img){
  103.     var img = pathImg + img;
  104.     modalImg.style.backgroundImage = 'url('+img+')';
  105.     modal.style.display = "block";
  106. }
  107. // Get the <span> element that closes the modal
  108. var span = document.getElementsByClassName("close")[0];
  109. // When the user clicks on <span> (x), close the modal
  110. modal.onclick = function() { 
  111.   modal.style.display = "none";
  112.   console.log('waaaa')
  113. }
  114. </script>
  115.   {% endblock %}
  116.   {% block javascripts %}
  117.   {{ parent() }}
  118. <script>
  119.   $('#gallery-more-images').click(function(){
  120.     {# alert( $('#gallery-last-image-id').val() ); #}
  121.     jQuery.ajax({
  122.         url: "{{ path('gallerie_image_list', { id : galerie.id } ) }}",
  123.         data: { lastImageId : $('#gallery-last-image-id').val() },
  124.         type: "GET",
  125.         success: function (response) {
  126.           if(response.data != " "){
  127.           $( response.data ).insertBefore( $( "#gallery-more-images" )  );
  128.           $('#gallery-last-image-id').val(response.lastId);
  129.           }
  130.         }
  131.     });
  132.   });
  133.   $('#gallery-more-videos').click(function(){
  134.     {# alert( $('#gallery-last-video-id').val() ); #}
  135.     jQuery.ajax({
  136.         url: "{{ path('gallerie_video_list', { id : galerie.id } ) }}",
  137.         data: { lastVideoId : $('#gallery-last-video-id').val() },
  138.         type: "GET",
  139.         success: function (response) {
  140.           if(response.data != " "){
  141.           $( response.data ).insertBefore( $( "#gallery-more-videos" )  );
  142.           $('#gallery-last-video-id').val(response.lastId);
  143.           }
  144.         }
  145.     });
  146.   });
  147. </script>
  148.   {% endblock %}