src/WebBundle/Resources/views/Catalog/search-content.html.twig line 1

Open in your IDE?
  1. {% set factoryInactive = false %}
  2. {% set factoryStatus = null %}
  3. {% if content.brand %}
  4.     {% set factoryStatus = content.brand.status %}
  5.     {% if factoryStatus == 3 %}
  6.         {% set factoryInactive =  'factory.discontinued' | trans  %}
  7.     {% elseif factoryStatus == 2 %}
  8.         {% set factoryInactive = 'factory.shutdown' | trans({'%date%': content.brand.statedAt}) %}
  9.     {% endif %}
  10. {% endif %}
  11. {% if result.count > 0 %}
  12.     <div itemscope="" itemtype="http://schema.org/WebPage" class="header-main-content">
  13.         <meta itemprop="name" content="{{ meta.title | raw }}">
  14.         <div class="show-active-filter-block{% if not content.amount %} without-amount{% endif %}">
  15.             <h1>{{ content.h1 | raw }}</h1>
  16.             {% if linkSamples %}
  17.                 <a class="link-samples-cat" href="{{ linkSamples }}"
  18.                 target="_blank">{{ 'article_item_more_info' | trans }}</a>
  19.             {% endif %}
  20.             {% if content.isDesigner %}
  21.                 <a class="link-list-of-Designers {% if 'strong' in content.h1 %}link-absolute{% else %}link-right{% endif %}">
  22.                     {{ 'list_designers' | trans }}
  23.                 </a>
  24.             {% endif %}
  25.             {% if is_granted('ROLE_REDACTOR') and page > 1 %}
  26.                 <span class="val big">страница {{ page }} из {{ pageCount }} (видно только админам) </span>
  27.             {% endif %}
  28.             {# отзывы reviews #}
  29.             {% if result.reviewsTotalCount is defined and result.avgReviewsStar is defined and result.reviewsTotalCount > 0 %}
  30.                 <div class="collections-rating js-collections-rating">
  31.                     <span class="rating-count">{{ result.avgReviewsStar }}</span>
  32.                     {{ include ('@Web/Common/rating_stars.html.twig', {'rating': result.avgReviewsStar, 'classname': '' }) }}
  33.                     <div class="more-info-review">
  34.                         <div class="arrow"></div>
  35.                         <div class="hd">{{ 'product_review_by' | trans({'%d%': result.avgReviewsStar}) }}</div>
  36.                         <div class="line"></div>
  37.                         <ul class="unstyled-list js-percent-rating">
  38.                             <div class="smallTimer"></div>
  39.                         </ul>
  40.                     </div>
  41.                     <a href="#" class="customerReviews js-scroll-to-reviews">
  42.                         <span>({{ result.reviewsTotalCount }})</span>
  43.                     </a>
  44.                 </div>
  45.             {% endif %}
  46.             {% if top20 is defined and top20 is null and factoryStatus != 2 %}
  47.                 {% if content.amount %}
  48.                     <span class="val big" data-count="{{ result.count }}"><span>&#8226;</span>{{ content.amount | raw }}</span>
  49.                 {% endif %}
  50.                 {# вместо тяжеловесного плагина select2 (6000строк кода js) используем легкий simple_list_drop (100 строк кода js) #}
  51.                     
  52.                 <div class="simple-list-drop-container {% if activeFilters.top is defined and activeFilters.top | filter( v => v.id == 10646 ) %}novinki{% endif %}" id="sort">
  53.                     <div class="list-drop-active" role="show-list-drop">
  54.                         <input type="text" class="active-status">
  55.                     </div>
  56.                     {# id элементов списка, которые относятся к сорту "По популярности" #}
  57.                     {% set popularListId = [1, 5] %}
  58.                     <ul class="simple-list-drop js-simple-list-drop">
  59.                         {# этот первый <li> для подгруппы сорта "По популярности: " #}
  60.                         <li class="simple-list-item subgroup" data-list-subgroup="popular">
  61.                             {{ 'catalog_by_popular' | trans }} :
  62.                         </li>
  63.                         {# блок для подгруппы сорта "по популярности #}
  64.                         <li>
  65.                             <ul>
  66.                                 {% for row in sortList %}
  67.                                     {% if row.id in popularListId %}
  68.                                         <li
  69.                                             class="simple-list-item sub-item{% if row.id == sortId %} active{% endif %}"
  70.                                             data-simpledrop-value="{{ row.id }}"
  71.                                             data-simpledrop-text="{{ row.nameSingle }}"
  72.                                         >
  73.                                             {{ row.nameMenu }}
  74.                                         </li>
  75.                                     {% endif %}
  76.                                 {% endfor %}
  77.                             </ul>
  78.                         </li>
  79.                         {% for row in sortList %}
  80.                             {% if row.id not in popularListId and row.id != '4' %}
  81.                                 <li
  82.                                     class="simple-list-item{% if row.id == sortId %} active{% endif %}"
  83.                                     data-simpledrop-value="{{ row.id }}"
  84.                                     data-simpledrop-text="{{ row.nameSingle }}"
  85.                                 >
  86.                                     {{ row.nameMenu }}
  87.                                 </li>
  88.                             {% endif %}
  89.                         {% endfor %}
  90.                     </ul>
  91.                 </div>
  92.             {% endif %}
  93.         </div>
  94.         {% if factoryStatus < 4 %}
  95.             <div
  96.                 {# класс 'desc-search' добавляется по условию, чтобы не было марджинов, когда блок пустой #}
  97.                 class="js-description catalog-key {{ content.html ? 'desc-search' }}"
  98.                 data-key="{{ content.fullKey }}"
  99.             >
  100.                 <div class="search-html" itemprop="description">
  101.                     {{ content.html | less_content(300, 'catalog_more_up' | trans, 'catalog_more_down' | trans) | raw }}
  102.                 </div>
  103.                 {% if content.isDesigner %}
  104.                     <div id="list_designer_menu_load">               
  105.                         <div class="designer_container">
  106.                             <h2>{{ 'list_designers' | trans }}</h2>
  107.                             <div id="designer_list_content"></div>
  108.                         </div>
  109.                     </div>
  110.                 {% endif %}
  111.                 <div class="both"></div>
  112.             </div>
  113.         {% endif %}
  114.     </div>
  115. {% endif %}
  116. <div class="both"></div>
  117. {% if factoryStatus < 4 %}
  118.     {# спиннер для подгрузки при скролле вверх #}
  119.     <div id="loadingSearchBefore"></div>
  120.     <div class="get-active-filters" data-action="{{ path('app_catalog_filter', {key: 'get-uri'} ) }}"></div>
  121.     <div
  122.         id="search-result"
  123.         data-total-result={{ result.count }}
  124.         data-per-page-count={{ result.list | length }}
  125.         data-key="{{ content.key }}"
  126.         class="clearfix"
  127.         data-page={{ page }}
  128.         data-empty-msg-block {{ result.count == 0 ? 'style="display: none"' : '' }}
  129.         data-has-more={{ page < pageCount }}
  130.     >
  131.         <div class="set-z-index-boxify"></div>
  132.         {% include '@Web/Catalog/search-result.html.twig' with {'result': result} %}
  133.     </div>
  134.     {% if page < pageCount %}
  135.         <a rel="next" href="{{ app.request.pathinfo }}?page={{ page + 1 }}" class="link-more">
  136.             Load more...
  137.         </a>
  138.         <a href="{{ app.request.pathinfo }}" class="link-more">First page</a>
  139.     {% endif %}
  140.     {# данный блок появляется, если результат поиска нулевой #}
  141.     <div class="no-project-msg" style="display: {{ result.count == 0 ? 'table' : 'none' }};" data-empty-msg>
  142.         {% if fMsg is defined %}
  143.             <h4>
  144.                 <b>{{ (content.brand.status == 1 ? 'catalog.alert.factory2' : 'catalog.alert.factory') | trans({'%name%': fMsg.name}) }}</b>
  145.             </h4>
  146.             <p>
  147.                 {{ 'catalog.alert.msg_catalog' | trans({'%link%':fMsg.url, '%catalogue%': ('catalog_simple_title' | trans) }) | raw }}
  148.             </p>
  149.         {% elseif msg is defined %}
  150.             <h3>
  151.                 <b>{{ 'catalog.alert.designer' | trans({'%designerTiles%': msg.name}) }}</b>
  152.             </h3>
  153.             <p>
  154.                 {{ 'catalog.alert.msg_catalog' | trans({'%designerTiles%':msg.url, '%catalogue%': ('catalog_simple_title' | trans) }) | raw }}
  155.             </p>
  156.         {% else %}
  157.             {{ 'catalog_msg.no_results' | trans }}
  158.         {% endif %}
  159.     </div>
  160. {% endif %}
  161. <div id="loadingSearch"></div>
  162. <div class="both"></div>