templates/front/gallery/index.html.twig line 1

Open in your IDE?
  1. {% extends 'layouts/default.html.twig' %}
  2. {% block title %} {{ 'app.gallery.title'|trans }} {{ parent() }} {% endblock %}
  3. {% block breadcrumb_title %}{{ 'app.gallery.title'|trans }}{% endblock %}
  4. {% block breadcrumb_sub_title %}{{ 'app.gallery.introduction'|trans }}{% endblock %}
  5. {% block body %}
  6.     <!--Start Latest gallery Area-->
  7.     <section class="latest-portfolio-area">
  8.         <div class="container">
  9.             <div class="gallery-box">
  10.                 <div class="row masonary-layout">
  11.                     {% for media in medias %}
  12.                         {% include 'front/gallery/media.html.twig' with {'media': media} %}
  13.                     {% endfor %}
  14.                 </div>
  15.             </div>
  16.             {% if page < medias.pageCount %}
  17.                 <div class="row load-more-section">
  18.                     <div class="col-xl-12">
  19.                         <div class="all-portfolio-button text-center">
  20.                             <a class="btn-one load-more"><span class="txt" style="color: black; cursor:pointer">{{ 'app.gallery.view_more'|trans }}</span></a>
  21.                         </div>
  22.                     </div>
  23.                 </div>
  24.             {% endif %}
  25.         </div>
  26.     </section>
  27.     <!--End Latest gallery Area-->
  28. {% endblock %}
  29. {% block javascripts %}
  30.     <script>
  31.         $( document ).ready(function() {
  32.             var currentPage = {{ page }},
  33.                 totalPages = {{ medias.pageCount }};
  34.             $(".load-more").click(function(e) {
  35.                 var nextPage = currentPage + 1;
  36.                 var url = Routing.generate('front_gallery_load.' + locale, {page: nextPage});
  37.                 $.get(url, function(data, status){
  38.                     if (status == 'success') {
  39.                         currentPage = nextPage;
  40.                         $(".gallery-box").append(data);
  41.                         if (currentPage === totalPages) {
  42.                             $(".load-more-section").css('display', 'none');
  43.                         }
  44.                     }
  45.                 });
  46.             });
  47.         });
  48.     </script>
  49. {% endblock %}