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