templates/__design/v2023/_menu/breadcrumbs.html.twig line 1

Open in your IDE?
  1. {% set route = app.request.get('_route') %}
  2. {% set city = app.request.get('city') ?? null %}
  3. {% set isDefaultCity = city == default_city() %}
  4. {% set locale = app.request.locale ?? 'ru' %}
  5. {% set specialClass = specialClass is defined ? '' ~ specialClass : '' %}
  6. {% set isAccount = isAccount is defined ? isAccount : false %}
  7.  {# <div class="swiper" id="-swiper">
  8.     <div class="swiper-wrapper" id="-list">
  9.         <a class="swiper-slide" href=""> #}
  10. {% macro _breadcrumbs_generate(items) %}
  11.     <div class="swiper breadcrumbs-swiper list-swiper" id="breadcrumbs-swiper" style="padding:0">
  12.         <ul class="breadcrumbs swiper-wrapper" itemscope itemtype="https://schema.org/BreadcrumbList" id="breadcrumbs-list">
  13.             {% for breadcrumb_item in items %}
  14.                 <li class="breadcrumbs-item swiper-slide{% if loop.last %} last-crumb{% endif %}" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
  15.                     {% if not loop.last %}
  16.                         <a href="{{ breadcrumb_item.uri }}" itemprop="item"><span itemprop="name">{{ breadcrumb_item.label|trans({}, 'breadcrumbs') }}</span></a>
  17.                     {% else %}
  18.                         <span itemprop="name">{{ breadcrumb_item.label|trans({}, 'breadcrumbs') }}</span>
  19.                     {% endif %}
  20.                     <meta itemprop="position" content="{{ loop.index - 1 }}">
  21.                 </li>
  22.             {% endfor %}
  23.         </ul>
  24.         {# <div class="swiper-scrollbar swiper-loading"></div> #}
  25.         <div class="swiper-button-list swiper-loading">
  26.             <div class="swiper-button swiper-button-prev"><span class="swiper-button-wrap swiper-button-prev-wrap"></span></div>
  27.             <div class="swiper-button swiper-button-next"><span class="swiper-button-wrap swiper-button-next-wrap"></span></div>
  28.         </div>
  29.     </div>
  30. {% endmacro %}
  31. {% set mapArray = {
  32.     'profile_list.list_by_city': 'Индивидуалки', 
  33.     'profile_list.list_by_city._pagination': 'Индивидуалки',
  34.     'profile_list.massage':'Массажистки',
  35.     'profile_list.massage._pagination':'Массажистки',
  36.     'saloon_list.list_by_city': 'Интим салоны',
  37.     'saloon_list.list_by_city._pagination': 'Интим салоны',
  38.     'profile_list.list_approved': 'Проверенные анкеты',
  39.     'profile_list.list_approved._pagination': 'Проверенные анкеты',
  40.     'profile_list.list_new': 'Новые анкеты',
  41.     'profile_list.list_new._pagination': 'Новые анкеты',
  42.     'profile_list.list_price_high': 'Элитные',
  43.     'profile_list.list_price_high._pagination': 'Элитные',
  44.     'profile_list.list_price_low': 'Дешевые',
  45.     'profile_list.list_price_low._pagination': 'Дешевые',
  46.     'profile_list.list_with_video': 'Анкеты с видео',
  47.     'profile_list.list_with_video._pagination': 'Анкеты с видео',
  48.     'profile_list.list_with_selfie': 'Анкеты с селфи',
  49.     'profile_list.list_with_selfie._pagination': 'Анкеты с селфи',
  50.     'profile_list.list_with_comments': 'Анкеты с отзывами',
  51.     'profile_list.list_with_comments._pagination': 'Анкеты с отзывами',
  52.     'profile_list.list_by_gender': 'Жиголо',
  53.     'profile_list.list_by_gender._pagination': 'Жиголо',
  54.     'profile_search.page': 'Расширенный поиск',
  55.     'profile_search.page._pagination': 'Расширенный поиск',
  56.     'profile_list.list_by_breast_type': 'Натуральная грудь',
  57.     'profile_list.list_big_breast': 'С большой грудью',
  58. } %}
  59. {% if route == null %}
  60.     {% set route = 'profile_list.massage' %}
  61. {% endif %}
  62. {# {{dump(route, mapArray[route], isDefaultCity, app.request.attributes.get('_route'))}}
  63. {{dump(app.request.attributes)}} #}
  64. {# ТОЛЬКО ДЛЯ ЛК #}
  65. {% if isAccount %}
  66.     {{ _self._breadcrumbs_generate(items) }}
  67. {# ВСЁ ЧТО НИЖЕ ОТНОСИТСЯ К ПАБЛИКУ #}
  68. {% elseif (not isDefaultCity and 'profile_list.list_by_city' in route) %}
  69.     {% set items = [
  70.         {label: 'Главная', uri: path('homepage')}
  71.     ] %}
  72.     {% if not isDefaultCity %}
  73.         {% set items = items|merge([{label: city.name|trans}]) %}
  74.     {% endif %}
  75.     {{ _self._breadcrumbs_generate(items) }}
  76. {% elseif mapArray[route] is defined and isDefaultCity and 'profile_list.list_by_city' in app.request.attributes.get('_route') %}
  77.     {% set items = [
  78.         {label: 'Главная', uri: path('homepage')},
  79.         {label: city.name|trans}
  80.     ] %}
  81.     {{ _self._breadcrumbs_generate(items) }}
  82. {% elseif mapArray[route] is defined and not (isDefaultCity and 'profile_list.list_by_city' in route) %}
  83.     {% set items = [
  84.         {label: 'Главная', uri: path('homepage')}
  85.     ] %}
  86.     {% set items = items|merge([{label: city.name|trans, uri: path('profile_list.list_by_city', {city: city.uriIdentity})}]) %}
  87.     {% set lastLabel = mapArray[route] %}
  88.     {% if 'profile_list.list_by_breast_type' in route %}
  89.         {% if app.request.attributes.get('breastType') == "natural" %}
  90.             {% set lastLabel = 'Натуральная грудь' %}
  91.         {% else %}
  92.             {% set lastLabel = 'Силиконовая грудь' %}
  93.         {% endif %}
  94.     {% endif %}
  95.     {% set items = items|merge([{label: lastLabel}]) %}
  96.     {{ _self._breadcrumbs_generate(items) }}
  97. {% elseif 'profile_list.list_by_district' in route %}
  98.     {% set district = app.request.attributes.get('district') ?? null %}
  99.     {% set items = [
  100.         {label: 'Главная', uri: path('homepage')},
  101.         {label: 'Все районы', uri: path('district_list.page', {city: district.city.uriIdentity})},
  102.         {label: district ? district.name|trans : '', uri: null}
  103.     ] %}
  104.     {{ _self._breadcrumbs_generate(items) }}
  105. {% elseif 'district_list.page' in route %}
  106.     {% set district = app.request.attributes.get('district') ?? null %}
  107.     {% set items = [
  108.         {label: 'Главная', uri: path('homepage')},
  109.         {label: 'Все районы'}
  110.     ] %}
  111.     {{ _self._breadcrumbs_generate(items) }}
  112. {% elseif 'station_list.page' in route %}
  113.     {% set district = app.request.attributes.get('district') ?? null %}
  114.     {% set items = [
  115.         {label: 'Главная', uri: path('homepage')},
  116.         {label: 'Все станции'}
  117.     ] %}
  118.     {{ _self._breadcrumbs_generate(items) }}
  119. {% elseif 'profile_list.list_by_station' in route %}
  120.     {% set station = app.request.attributes.get('station') ?? null %}
  121.     {# {% set items = [
  122.         {label: 'Главная', uri: path('homepage')},
  123.         {label: station ? 'Метро ' ~ station.name|trans : '', uri: path('profile_list.list_by_station', {city: city.uriIdentity, station: station.uriIdentity})}
  124.     ] %}
  125.     {% set page = current_listing_page() %}
  126.     {% if page and page.currentPage > 1 and page.totalCount > 0 %}
  127.         {% set items = items|merge([{label: 'Страница ' ~ page.currentPage ~ ' из ' ~ (page.totalCount / page.currentLimit)|round(0, 'ceil')}]) %}
  128.     {% endif %}
  129.     {#{label: 'Метро Москвы', uri: path('station_list.page')},#!}
  130.     <ul class="breadcrumbs" itemscope itemtype="https://schema.org/BreadcrumbList">
  131.         {% for breadcrumb_item in items %}
  132.             <li class="breadcrumbs-item{% if loop.last %} last-crumb{% endif %}" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
  133.                 {% if not loop.last %}
  134.                     <a href="{{ breadcrumb_item.uri }}" itemprop="item"><span itemprop="name">{{ breadcrumb_item.label|trans({}, 'breadcrumbs') }}</span></a>
  135.                 {% else %}
  136.                     <span itemprop="name">{{ breadcrumb_item.label|trans({}, 'breadcrumbs') }}</span>
  137.                 {% endif %}
  138.                 <meta itemprop="position" content="{{ loop.index - 1 }}">
  139.             </li>
  140.         {% endfor %}
  141.     </ul> #}
  142.     {% set items = [
  143.         {label: 'Главная', uri: path('homepage')},
  144.         {label: 'Все станции', uri: path('station_list.page', {'city': city.uriIdentity})},
  145.         {label: station ? 'Метро ' ~ station.name|trans : '', uri: path('profile_list.list_by_station', {city: city.uriIdentity, station: station.uriIdentity})}
  146.     ] %}
  147.     {{ _self._breadcrumbs_generate(items) }}
  148. {% elseif 'city_list.by_country' in route %}
  149.     {% set items = [
  150.         {label: 'Главная', uri: path('homepage')},
  151.         {label: 'По городам'}
  152.     ] %}
  153.     {{ _self._breadcrumbs_generate(items) }}
  154. {% elseif 'static_page.license' in route %}
  155.     {% set items = [
  156.         {label: 'Главная', uri: path('homepage')},
  157.         {label: 'Услувия использования'}
  158.     ] %}
  159.     {{ _self._breadcrumbs_generate(items) }}
  160. {# {% elseif 'profile_list.list_by_city' in route %}
  161.     {% set station = app.request.attributes.get('station') ?? null %}
  162.     {% set items = [
  163.         {label: 'Главная', uri: path('homepage')},
  164.         {label: 'Подмосквье', uri: path('city_list.by_country')},
  165.         {label: city.name|trans, uri: null}
  166.     ] %}
  167.     {% for breadcrumb_item in items %}
  168.         {% if not loop.last %}
  169.             {% set items = items|merge([{label: breadcrumb_item.label|trans({}, 'breadcrumbs'), uri: breadcrumb_item.uri }]) %}
  170.         {% else %}
  171.             {% set items = items|merge([{label: breadcrumb_item.label|trans({}, 'breadcrumbs') }]) %}
  172.         {% endif %}
  173.     {% endfor %} #}
  174. {% elseif item.children|length > 1 %}
  175.     {# Перегоняем в индексированный массив #}
  176.     {% set children = [] %}
  177.     {% for breadcrumb_item in item.children %}
  178.         {% set children = children|merge([breadcrumb_item]) %}
  179.     {% endfor %}
  180.     {% if route == 'profile_preview.page' %}
  181.         {#
  182.                 На странице анкеты Москвы выводим крошки вида
  183.                 Главная / ЗАО (то есть ссылка на округ) / Дорогомилово (то есть ссылка на район) / Кутузовская (то есть ссылка на метро) / индивидуалка Аня (Аня простым текстом, без ссылки)
  184.                 (согласно https://redminez.net/issues/27876),
  185.                 а на остальных Главная / Город / индивидуалка Имя
  186.         #}
  187.         {% set profile = options.profile ?? null %}
  188.         {% set items = [
  189.             {label: 'Главная', uri: path('homepage')}
  190.         ] %}
  191.         {% set children = items|merge([children[1]]) %}
  192.         {# {% set main = [
  193.             {label: 'Главная', uri: path('homepage')},
  194.             {label: city.name, uri: path('profile_list.list_by_city', {city: city.uriIdentity})}
  195.         ] %}
  196.         {% set children = main|merge([children[1]]) %} #}
  197.         {# <ul class="breadcrumbs" itemscope itemtype="https://schema.org/BreadcrumbList">
  198.             <li class="breadcrumbs-item" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
  199.                 <a href="{{ (children|first).uri }}" itemprop="item"><span itemprop="name">{{ (children|first).label }}</span></a>
  200.                 <meta itemprop="position" content="0">
  201.             </li> #}
  202.             {% set position = 1 %}
  203.             {% if city and city.id == 1 %}
  204.                 {% if not profile.masseur and profile.personParameters.gender != gender_trans() and profile.personParameters.gender != gender_male() %}
  205.                     {% set station = profile.stations|length ? profile.stations[0] : null %}
  206.                     {#{% if profile and station and station.district and station.county %}#}
  207.                     {% if profile and station and station.county %}
  208.                         {% set items = items|merge([{label: station.county.name|trans, uri: path('profile_list.list_by_county', {city: city.uriIdentity, county: station.county.uriIdentity}) }]) %}
  209.                         {% set items = items|merge([{label: station.district.name|trans, uri: path('profile_list.list_by_district', {city: city.uriIdentity, district: station.district.uriIdentity}) }]) %}
  210.                         {% set items = items|merge([{label: station.name|trans, uri: path('profile_list.list_by_station', {city: city.uriIdentity, station: station.uriIdentity}) }]) %}
  211.                         {# <li class="breadcrumbs-item" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
  212.                             <a href="{{ path('profile_list.list_by_county', {city: city.uriIdentity, county: station.county.uriIdentity }) }}" itemprop="item"><span itemprop="name">{{ station.county.name|trans }}</span></a>
  213.                             <meta itemprop="position" content="1">
  214.                         </li> #}
  215.                         {# <li class="breadcrumbs-item" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
  216.                             <a href="{{ path('profile_list.list_by_district', {city: city.uriIdentity, district: station.district.uriIdentity}) }}" itemprop="item"><span itemprop="name">{{ station.district.name|trans }}</span></a>
  217.                             <meta itemprop="position" content="2">
  218.                         </li> #}
  219.                         {# <li class="breadcrumbs-item" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
  220.                             <a href="{{ path('profile_list.list_by_station', {city: city.uriIdentity, station: station.uriIdentity}) }}" itemprop="item"><span itemprop="name">{{ station.name|trans }}</span></a>
  221.                             <meta itemprop="position" content="1">
  222.                         </li> #}
  223.                         {% set position = 4 %}
  224.                     {% else %}
  225.                         {#
  226.                             если у анкеты нет станции, то:
  227.                             Южный (ЮАО), Донской, Ленинский проспект
  228.                         #}
  229.                         {% set items = items|merge([{label: locale == 'ru' ? 'Южный (ЮАО)' : 'South (SAD)', uri: path('profile_list.list_by_county', {city: city.uriIdentity, county: 'yuzhnyj-yuao' }) }]) %}
  230.                         {% set items = items|merge([{label: locale == 'ru' ? 'Донской' : 'Donskoy', uri: path('profile_list.list_by_district', {city: city.uriIdentity, district: 'donskoj'}) }]) %}
  231.                         {% set items = items|merge([{label: locale == 'ru' ? 'Ленинский проспект' : 'Leninskij prospekt', uri: path('profile_list.list_by_station', {city: city.uriIdentity, station: 'leninskij-prospekt'}) }]) %}
  232.                         {# <li class="breadcrumbs-item" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
  233.                             <a href="{{ path('profile_list.list_by_county', {city: city.uriIdentity, county: 'yuzhnyj-yuao' }) }}" itemprop="item"><span itemprop="name">{{ locale == 'ru' ? 'Южный (ЮАО)' : 'South (SAD)' }}</span></a>
  234.                             <meta itemprop="position" content="1">
  235.                         </li>
  236.                         <li class="breadcrumbs-item" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
  237.                             <a href="{{ path('profile_list.list_by_district', {city: city.uriIdentity, district: 'donskoj'}) }}" itemprop="item"><span itemprop="name">{{ locale == 'ru' ? 'Донской' : 'Donskoy' }}</span></a>
  238.                             <meta itemprop="position" content="2">
  239.                         </li>
  240.                         <li class="breadcrumbs-item" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
  241.                             <a href="{{ path('profile_list.list_by_station', {city: city.uriIdentity, station: 'leninskij-prospekt'}) }}" itemprop="item"><span itemprop="name">{{ locale == 'ru' ? 'Ленинский проспект' : 'Leninskij prospekt' }}</span></a>
  242.                             <meta itemprop="position" content="1">
  243.                         </li> #}
  244.                         {% set position = 4 %}
  245.                     {% endif %}
  246.                 {% endif %}
  247.             {% else %}
  248.                 {% set items = items|merge([{label: city.name, uri: path('profile_list.list_by_city', {city: city.uriIdentity}) }]) %}
  249.                 {# <li class="breadcrumbs-item" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
  250.                     <a href="{{ path('profile_list.list_by_city', {city: city.uriIdentity}) }}" itemprop="item"><span itemprop="name">{{ city.name }}</span></a>
  251.                     <meta itemprop="position" content="1">
  252.                 </li> #}
  253.                 {% set position = 2 %}
  254.             {% endif %}
  255.             {% if profile.masseur %}
  256.                 {% set items = items|merge([{label: 'Массажистки', uri: path('masseur_list.page', {city: city.uriIdentity}) }]) %}
  257.                 {# <li class="breadcrumbs-item" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
  258.                     <a href="{{ path('masseur_list.page', {city: city.uriIdentity}) }}" itemprop="item"><span itemprop="name">Массажистки</span></a>
  259.                     <meta itemprop="position" content="1">
  260.                 </li> #}
  261.             {% elseif profile.personParameters.gender == gender_trans() %}
  262.                 {# {% set items = items|merge([{label: 'Трансы', uri: path('profile_list.list_by_gender', {city: city.uriIdentity, gender: gender_trans()|gender_uri}) }]) %} #}
  263.                 {# <li class="breadcrumbs-item" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
  264.                     <a href="{{ path('profile_list.list_by_gender', {city: city.uriIdentity, gender: gender_trans()|gender_uri}) }}" itemprop="item"><span itemprop="name">Трансы</span></a>
  265.                     <meta itemprop="position" content="1">
  266.                 </li> #}
  267.             {% elseif profile.personParameters.gender == gender_male() %}
  268.                 {# {% set items = items|merge([{label: 'Жиголо', uri: path('profile_list.list_by_gender', {city: city.uriIdentity, gender: gender_male()|gender_uri}) }]) %} #}
  269.                 {# <li class="breadcrumbs-item" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
  270.                     <a href="{{ path('profile_list.list_by_gender', {city: city.uriIdentity, gender: gender_male()|gender_uri}) }}" itemprop="item"><span itemprop="name">Жиголо</span></a>
  271.                     <meta itemprop="position" content="1">
  272.                 </li> #}
  273.             {% endif %}
  274.             {# <li class="breadcrumbs-item" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"> #}
  275.                 {% set profile_type_name = 'Индивидуалка' %}
  276.                 {% set profile_type_name = profile.masseur ? 'Массажистка' : profile_type_name %}
  277.                 {% set profile_type_name = profile.personParameters.gender == gender_trans() ? 'Мужчина' : profile_type_name %}
  278.                 {% set profile_type_name = profile.personParameters.gender == gender_male() ? 'Жиголо' : profile_type_name %}
  279.                 {% set breadcrumbs_list = profile_type_name ~ ' ' ~ children|last.label ~ ' ID' ~ profile.id %}
  280.                 {% set items = items|merge([{label: breadcrumbs_list }]) %}
  281.                 {# <span itemprop="name">{{ profile_type_name }} {{ children|last.label }} ID{{ profile.id }}</span> #}
  282.                 {# <meta itemprop="position" content="{{ position }}"> #}
  283.             {# </li> #}
  284.         {# </ul> #}
  285.             {{ _self._breadcrumbs_generate(items) }}
  286.         {% elseif route == 'saloon_preview.page' %}
  287.             {% set saloon = options.saloon ?? null %}
  288.             {# {% set main = [{label: 'Главная', uri: path('homepage')}] %}
  289.             {% set children = main|merge([children[1], children[2]]) %} #}
  290.             {% set items = [
  291.                 {label: 'Главная', uri: path('homepage')}
  292.             ] %}
  293.             {% set items = items|merge([children[1], children[2]]) %}
  294.             {{ _self._breadcrumbs_generate(items) }}
  295.     {% else %}
  296.         {# <ul class="breadcrumbs" itemscope itemtype="https://schema.org/BreadcrumbList"> #}
  297.             {% if route == 'profile_list.list_by_district' %}
  298.                 {# Убираем название округа #}
  299.                 {% set children = children | map((k) => k) | filter((v, k) => k != 2) %}
  300.             {% elseif route == 'profile_list.list_by_county' %}
  301.                 {# Убираем слово районы #}
  302.                 {% set children = [children[0], children[2]] %}
  303.             {% endif %}
  304.             {% if city.id == 1 %}
  305.                 {# Делаем првый элемент "Главная" #}
  306.                 {% set items = [
  307.                     {label: 'Главная', uri: path('homepage')}
  308.                 ] %}
  309.                 {% set children = items|merge([children[1]]) %}
  310.             {% else %}
  311.                 {# Делаем првый элемент "Главная", второй - город #}
  312.                 {% set items = [
  313.                     {label: 'Главная', uri: path('homepage')},
  314.                     {label: city.name, uri: path('profile_list.list_by_city', {city: city.uriIdentity})}
  315.                 ] %}
  316.                 {% set children = items|merge([children[1]]) %}
  317.             {% endif %}
  318.             {% set items = [] %}
  319.             {% for breadcrumb_item in children %}
  320.                 {# <li class="breadcrumbs-item{% if loop.last %} last-crumb{% endif %}" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"> #}
  321.                     {% if not loop.last %}
  322.                         {# <a href="{{ breadcrumb_item.uri }}" itemprop="item"><span itemprop="name">{{ breadcrumb_item.label|trans({}, 'breadcrumbs') }}</span></a> #}
  323.                         {% set items = items|merge([{label: breadcrumb_item.label|trans({}, 'breadcrumbs'), uri: breadcrumb_item.uri }]) %}
  324.                     {% else %}
  325.                         {# <span itemprop="name">{{ breadcrumb_item.label|trans({}, 'breadcrumbs') }}</span> #}
  326.                         {% set items = items|merge([{label: breadcrumb_item.label|trans({}, 'breadcrumbs') }]) %}
  327.                     {% endif %}
  328.                     {# <meta itemprop="position" content="{{ loop.index }}"> #}
  329.                 {# </li> #}
  330.             {% endfor %}
  331.         {# </ul> #}
  332.         {{ _self._breadcrumbs_generate(items) }}
  333.     {% endif %}
  334. {% endif %}