src/Package/Openform/Front/Templates/Search/_list.html.twig line 1

Open in your IDE?
  1. {% from '@openform_front_templates/_includes/_icons.html.twig' import searchprev, searchnext %}
  2. {% macro paginator(page, pages, entitiesCount) %}
  3.     {% if pages > 0 %}
  4.         <div class="search-result-list__pagination" id="load-more-container">
  5.             {% if page > 1 %}
  6.                 <button class="search-result-list__pagination__btn" onClick="loadAjax({{ page-1 }})">
  7.                     <span>{{ searchprev('PREV_PAGE_SEARCH'|trans({}, 'openform_front', app.request.locale)) }}</span>{{'PREV_PAGE_SEARCH'|trans({}, 'openform_front', app.request.locale)}}
  8.                 </button>
  9.             {% else %}
  10.                 <button class="search-result-list__pagination__btn" onClick="loadAjax({{ page-1 }})" disabled>
  11.                     <span>{{ searchprev('PREV_PAGE_SEARCH'|trans({}, 'openform_front', app.request.locale)) }}</span> {{'PREV_PAGE_SEARCH'|trans({}, 'openform_front', app.request.locale)}}
  12.                 </button>
  13.             {% endif %} 
  14.             <div class="search-result-list__pagination__content">
  15.                 {{ entitiesCount }} {{entitiesCount > 4 ? 'SEARCH_RESULTS'|trans({}, 'openform_front', app.request.locale) : entitiesCount < 5 and entitiesCount > 1 ? 'SEARCH_RESULTSS'|trans({}, 'openform_front', app.request.locale) : 'SEARCH_RESULT'|trans({}, 'openform_front', app.request.locale) }} / {{'SEARCH_PAGE'|trans({}, 'openform_front', app.request.locale)}} {{ page }} {{'SEARCH_OF'|trans({}, 'openform_front', app.request.locale)}} {{ pages }}
  16.             </div>
  17.             
  18.             {% if page < pages %}
  19.                 <button class="search-result-list__pagination__btn" onClick="loadAjax({{ page+1}})">
  20.                     {{'NEXT_PAGE_SEARCH'|trans({}, 'openform_front', app.request.locale)}} <span>{{ searchnext('NEXT_PAGE_SEARCH'|trans({}, 'openform_front', app.request.locale)) }}</span>
  21.                 </button>
  22.             {% else %}
  23.                 <button class="search-result-list__pagination__btn" onClick="loadAjax({{ page+1}})" disabled>
  24.                     {{'NEXT_PAGE_SEARCH'|trans({}, 'openform_front', app.request.locale)}} <span>{{ searchnext('NEXT_PAGE_SEARCH'|trans({}, 'openform_front', app.request.locale)) }}</span>
  25.                 </button>
  26.             {% endif %}
  27.         </div>
  28.     {% endif %}
  29. {% endmacro %}
  30. {% import _self as macros %}
  31. {{ _self.paginator(page, pages, entitiesCount) }}
  32. <div class="search-result-list__items">
  33.     {% if entities|length == 0 %}
  34.         {{ 'T_NO_RESULTS'|trans({}, 'openform_front', app.request.locale) }}
  35.     {% endif %}
  36.     {% for search in entities %}
  37.         <div class="search-result-list__item">
  38.             {# ANTIQUE #}
  39.             {% if search.Antique %}
  40.                 {% include "@openform_front_templates/Search/_search-item.html.twig" with { 
  41.                         entity: search.Antique,
  42.                         entityName: 'Antique',
  43.                         url: toolkit_route_localizer.generate('antique_item', {'slug': search.Antique.Translation[app.request.locale].slug}, app.request.locale) 
  44.                     } %}
  45.             {% endif %}
  46.             {# ANTIQUE SUIT #}
  47.             {% if search.AntiqueSuit %}
  48.                 {% include "@openform_front_templates/Search/_search-item.html.twig" with { 
  49.                         entity: search.AntiqueSuit,
  50.                         entityName: 'AntiqueSuit',
  51.                         url: toolkit_route_localizer.generate('antique_suit_item', {'slug': search.AntiqueSuit.Translation[app.request.locale].slug}, app.request.locale) 
  52.                     } %}
  53.             {% endif %}
  54.             {# MUSEUM #}
  55.             {% if search.Museum %}
  56.                 {% include "@openform_front_templates/Search/_search-item.html.twig" with { 
  57.                         entity: search.Museum,
  58.                         entityName: 'Museum',
  59.                         url: toolkit_route_localizer.generate('mak_item', {'makSlug':'muzea','slug': search.Museum.Translation[app.request.locale].slug}, app.request.locale) 
  60.                     } %}
  61.             {% endif %}
  62.             {# MUZEUM DEPARTMENT #}
  63.             {% if search.MuseumDepartment %}
  64.                 {% include "@openform_front_templates/Search/_search-item.html.twig" with { 
  65.                         entity: search.MuseumDepartment,
  66.                         entityName: 'MuseumDepartment',
  67.                         url: toolkit_route_localizer.generate('mak_department_item', {'makSlug':'muzea','slug': search.MuseumDepartment.Translation[app.request.locale].slug}, app.request.locale) 
  68.                     } %}
  69.             {% endif %}
  70.             {# ARCHIVE #}
  71.             {% if search.Archive %}
  72.                 {% include "@openform_front_templates/Search/_search-item.html.twig" with { 
  73.                         entity: search.Archive,
  74.                         entityName: 'Archive',
  75.                         url: toolkit_route_localizer.generate('mak_item', {'makSlug':'archiwa','slug': search.Archive.Translation[app.request.locale].slug}, app.request.locale) 
  76.                     } %}
  77.             {% endif %}
  78.             {# ARCHIVE DEPARTMENT #}
  79.             {% if search.ArchiveDepartment %}
  80.                 {% include "@openform_front_templates/Search/_search-item.html.twig" with { 
  81.                         entity: search.ArchiveDepartment,
  82.                         entityName: 'ArchiveDepartment',
  83.                         url: toolkit_route_localizer.generate('mak_department_item', {'makSlug':'archiwa','slug': search.ArchiveDepartment.Translation[app.request.locale].slug}, app.request.locale) 
  84.                     } %}
  85.             {% endif %}
  86.             {# PRIVATE COLLECTION #}
  87.             {% if search.PrivateCollection %}
  88.                 {% include "@openform_front_templates/Search/_search-item.html.twig" with { 
  89.                         entity: search.PrivateCollection,
  90.                         entityName: 'PrivateCollection',
  91.                         url: toolkit_route_localizer.generate('mak_item', {'makSlug':'kolekcje-prywatne','slug': search.PrivateCollection.Translation[app.request.locale].slug}, app.request.locale) 
  92.                     } %}
  93.             {% endif %}
  94.             {# PRIVATE COLLECTION DEPARTMENT #}
  95.             {% if search.PrivateCollectionDepartment %}
  96.                 {% include "@openform_front_templates/Search/_search-item.html.twig" with { 
  97.                         entity: search.PrivateCollectionDepartment,
  98.                         entityName: 'PrivateCollectionDepartment',
  99.                         url: toolkit_route_localizer.generate('mak_department_item', {'makSlug':'kolekcje-prywatne','slug': search.PrivateCollectionDepartment.Translation[app.request.locale].slug}, app.request.locale) 
  100.                     } %}
  101.             {% endif %}
  102.             {# NEWS #}
  103.             {% if search.News %}
  104.                 {% include "@openform_front_templates/Search/_search-item.html.twig" with { 
  105.                         entity: search.News,
  106.                         entityName: 'News',
  107.                         url: toolkit_route_localizer.generate('news_item', {'slug': search.News.Translation[app.request.locale].slug}, app.request.locale) 
  108.                     } %}
  109.             {% endif %}
  110.             {# ABOUT US #}
  111.             {% if search.AboutUs %}
  112.                 {% include "@openform_front_templates/Search/_search-item.html.twig" with { 
  113.                         entity: search.AboutUs,
  114.                         entityName: 'AboutUs',
  115.                         url: toolkit_route_localizer.generate('about_us_item', {'slug': search.AboutUs.Translation[app.request.locale].slug}, app.request.locale) 
  116.                     } %}
  117.             {% endif %}
  118.             {# PROPOSAL #}
  119.             {% if search.Proposal %}
  120.                 {% include "@openform_front_templates/Search/_search-item.html.twig" with { 
  121.                         entity: search.Proposal,
  122.                         entityName: 'Proposal',
  123.                         url: toolkit_route_localizer.generate('proposal_item', {'slug': search.Proposal.Translation[app.request.locale].slug}, app.request.locale) 
  124.                     } %}
  125.             {% endif %}
  126.             {# EXHIBITION #}
  127.             {% if search.Exhibition %}
  128.                 {% include "@openform_front_templates/Search/_search-item.html.twig" with { 
  129.                         entity: search.Exhibition,
  130.                         entityName: 'Exhibition',
  131.                         url: toolkit_route_localizer.generate('exhibition_item', {'slug': search.Exhibition.Translation[app.request.locale].slug}, app.request.locale) 
  132.                     } %}
  133.             {% endif %}
  134.             {# EXHIBITION DEPARTMENT #}
  135.             {% if search.ExhibitionDepartment %}
  136.                 {% include "@openform_front_templates/Search/_search-item.html.twig" with { 
  137.                         entity: search.ExhibitionDepartment,
  138.                         entityName: 'ExhibitionDepartment',
  139.                         url: toolkit_route_localizer.generate('exhibition_department_item', {'slug': search.ExhibitionDepartment.Translation[app.request.locale].slug}, app.request.locale) 
  140.                     } %}
  141.             {% endif %}
  142.             {# RELICT #}
  143.             {% if search.Relict %}
  144.                 {% include "@openform_front_templates/Search/_search-item.html.twig" with { 
  145.                         entity: search.Relict,
  146.                         entityName: 'Relict',
  147.                         url: toolkit_route_localizer.generate('relict_item', {'slug': search.Relict.Translation[app.request.locale].slug}, app.request.locale) 
  148.                     } %}
  149.             {% endif %}
  150.             {# RELICT PACK #}
  151.             {% if search.RelictPack %}
  152.                 {% include "@openform_front_templates/Search/_search-item.html.twig" with { 
  153.                         entity: search.RelictPack,
  154.                         entityName: 'RelictPack',
  155.                         url: toolkit_route_localizer.generate('relict_pack_item', {'slug': search.RelictPack.Translation[app.request.locale].slug}, app.request.locale) 
  156.                     } %}
  157.             {% endif %}
  158.             {# MENU PAGE #}
  159.             {% if search.MenuPage %}
  160.                 {% include "@openform_front_templates/Search/_search-item.html.twig" with { 
  161.                         entity: search.MenuPage,
  162.                         entityName: 'MenuPage',
  163.                         url: toolkit_route_localizer.generate('menu_page', {
  164.                             'slug': search.MenuPage.Translation[app.request.locale].slug,
  165.                             'makSlug': search.MenuPage.getMakSlug(app.request.locale),
  166.                             'rootParentSlug': search.MenuPage.rootParentSlug(app.request.locale),
  167.                         }, app.request.locale) 
  168.                     } %}
  169.             {% endif %}
  170.             {# MISSION #}
  171.             {% if search.Mission %}
  172.                 {% include "@openform_front_templates/Search/_search-item.html.twig" with { 
  173.                         entity: search.Mission,
  174.                         entityName: 'Mission',
  175.                         url: toolkit_route_localizer.generate('mission_item', {'slug': search.Mission.Translation[app.request.locale].slug}, app.request.locale) 
  176.                     } %}
  177.             {% endif %}
  178.             {# PAGE #}
  179.             {% if search.Page %}
  180.                 {% if search.Page.idName|length > 0 %}
  181.                     {% set url = openform_front_util.pageUrlByIdName(search.Page.idName, app.request.locale) %}
  182.                 {% else %}
  183.                     {% set url = toolkit_route_localizer.generate('page', {'slug': search.Page.Translation[app.request.locale].slug}, app.request.locale) %}
  184.                 {% endif %}
  185.                 {% include "@openform_front_templates/Search/_search-item.html.twig" with { 
  186.                         entity: search.Page,
  187.                         entityName: 'Page',
  188.                         url: url 
  189.                     } %}
  190.             {% endif %}
  191.         </div>
  192.     {% endfor %}
  193. </div>
  194. {{ _self.paginator(page, pages) }}