templates/home.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block stylesheets %}
  3.     {{ parent() }}
  4.     <style>
  5.         .xhibit_masonry{width:100%}
  6.         .xhibit_masonry .xhibit-item {width:calc(20% - 4px);margin:2px}
  7.         ._toolbar {position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); background-color: rgba(0, 0, 0, 0.5); padding: 10px; border-radius: 10px; z-index: 99999999;}
  8.         .xhibit_masonry .xhibit-item:after{content:'';float:left;display:inline-block;width:100%;height:100%;background:rgba(29,140,242,.15);position:absolute;left:0;top:0;z-index:-1;border-radius:5px}
  9.     </style>
  10. {% endblock stylesheets %}
  11. {% block headerJS %}
  12.     {{ parent() }}
  13.     <link type="text/css" rel="stylesheet" href="{{ asset('assets/js/jquery.xhibit/jquery.xhibit.css') }}"/>
  14.     <script src="{{ asset('assets/js/jquery.xhibit/jquery.xhibit.js') }}"></script>
  15. {% endblock headerJS %}
  16. {% block content %}
  17.     <div class="container mt-3 text-center mb-5">
  18.         <div class="mb-3 _grid" style="">
  19.             {% include 'ContentBlock/block.html.twig' with {
  20.                 'aParams': {
  21.                     'contentType': 'posts',
  22.                     'aStatus': [constant('App\\Entity\\Post::STATUS_READY')],
  23.                     'sorting': 'date',
  24.                     'max_results': 20,
  25.                     'page': app.request.get('page') ? app.request.get('page') : 1,
  26.                     'show_pagination': true,
  27.                     'item_template': 'item/post.html.twig',
  28.                     'results_items_wrapper_class': 'row justify-content-center g-2',
  29.                     'results_item_class': 'col-md-3 position-relative',
  30.                     'no_results_html': '<div class="_noContent text-center"><i class="fas fa-images mt-5 mb-4" style="font-size: 2.5em;"></i><h5>No posts found</h5></div>'
  31.                 }
  32.             } %}
  33.         </div>
  34.         {#
  35.         {% set posts = getResults({
  36.             'contentType': 'posts',
  37.             'sorting': 'date',
  38.             'max_results': 20,
  39.             'page': app.request.get('page') ? app.request.get('page') : 1
  40.         }) %}
  41.         <div class="row" style="">
  42.             <div class="_grid">
  43.                 {% for post in posts.results %}
  44.                     {% include 'item/post.html.twig' with {
  45.                         'post': post
  46.                     } %}
  47.                 {% endfor %}
  48.             </div>
  49.         </div>
  50.         <div class="container-xl row" style="">
  51.             {% if posts.pagination %}
  52.                 <div class="_pagination" style="">
  53.                     {{ knp_pagination_render(posts.pagination, 'ContentBlock/pagination.html.twig') }}
  54.                 </div>
  55.             {% endif %}
  56.         </div>
  57.         #}
  58.     </div>
  59. {% endblock content %}
  60. {% block javascripts %}
  61.     <script>
  62.         $(document).ready(function(){
  63.             {% if app.user %}
  64.                 $('._delete_post').on('click', function(e){
  65.                     e.preventDefault();
  66.                     let path = $(this).attr('href');
  67.                     Swal.fire({
  68.                         title: '',
  69.                         html: 'Are you sure you want to delete this post?',
  70.                         showDenyButton: true,
  71.                         confirmButtonText: 'Yes',
  72.                         denyButtonText: `Cancel`,
  73.                     }).then((result) => {
  74.                         if(result.isConfirmed)
  75.                         {
  76.                             parent.location.href = path;
  77.                             /*let container = $('._xlabs_results_wrapper');
  78.                             let results = container.resultsContainer();
  79.                             $.ajax({
  80.                                 url: path,
  81.                                 type: 'post',
  82.                                 dataType: 'html',
  83.                                 success: function(data){
  84.                                     results.reload();
  85.                                 },
  86.                                 error: function(){
  87.                                     results.reload();
  88.                                 }
  89.                             });*/
  90.                         } else if (result.isDenied) {
  91.                         }
  92.                     });
  93.                 });
  94.             {% endif %}
  95.             /*
  96.             $('._grid').xhibit({
  97.                 item_class: '._grid-item',
  98.                 //panning: {{ not isMobile() and not isTablet() ? 'true' : 'false' }},
  99.                 panning: false,
  100.                 popup: false,
  101.                 shine_hover: false,
  102.                 masonry: true,
  103.                 onInitialized: function(plugin){
  104.                 },
  105.                 onItemClick: function(item){
  106.                 }
  107.             });
  108.             */
  109.             /*
  110.             $('._grid2').xhibit({
  111.                 item_class: '._grid-item',
  112.                 //panning: {{ not isMobile() and not isTablet() ? 'true' : 'false' }},
  113.                 panning: false,
  114.                 popup: false,
  115.                 masonry: false,
  116.                 size_classes: ['wide', 'tall', 'big', 'small'],
  117.                 onItemClick: function(item){
  118.                 }
  119.             });
  120.             */
  121.         });
  122.     </script>
  123. {% endblock javascripts %}