templates/Tour/teaser.html.twig line 1

Open in your IDE?
  1. {# @var \Pimcore\Model\DataObject\AlpsteinTour tour #}
  2. <section class="tour-teaser teaser-animation">
  3.     {% if tour.publicTransportFriendly %}
  4.         <div class="tour-teaser__arrival">
  5.             <span class="tour-teaser__arrival-icon icon icon-traffic" aria-label="mit Bus erreichbar" data-toggle="tooltip" data-original-title="{{ 'tour.mit Bus erreichbar'|trans }}"></span>
  6.             <span class="tour-teaser__arrival-text">
  7.                 {{ 'tour.mit Bus erreichbar'|trans }}
  8.             </span>
  9.         </div>
  10.     {% endif %}
  11.     <div class="embed-responsive embed-responsive-7by9">
  12.         {% set teaserImage = null %}
  13.         {% if tour.primaryImage %}
  14.             {% set teaserImage = tour.primaryImage %}
  15.         {% elseif tour.images and tour.images[0] %}
  16.             {% set teaserImage = tour.images[0] %}
  17.         {% endif %}
  18.         {% if teaserImage %}
  19.             {% set description = getImageDescription(teaserImage, true) %}
  20.             {{ teaserImage.thumbnail('tour-teaser').html({
  21.                 imgAttributes: {
  22.                     class: 'js-lazy-img embed-responsive-item teaser-animation__img'
  23.                 },
  24.                 lowQualityPlaceholder: true,
  25.                 title: description|default(''),
  26.                 alt: description|default('')
  27.             })|raw }}
  28.         {% endif %}
  29.     </div>
  30.     <div class="tour-teaser__content d-flex flex-column justify-content-end">
  31.         <div class="vertical-gutter--2">
  32.             {% set location = getTourLocation(tour) %}
  33.             {% if location %}
  34.                 <span class="badge badge-white mr-md-2 mr-1 vertical-gutter__item">{{ location }}</span>
  35.             {% endif %}
  36.             {% if tour.ratingDifficulty %}
  37.                 {% if tour.ratingDifficulty == 3 %}
  38.                     {% set levelColor = 'dark' %}
  39.                 {% elseif tour.ratingDifficulty == 2 %}
  40.                     {% set levelColor = 'info' %}
  41.                 {% elseif tour.ratingDifficulty == 1 %}
  42.                     {% set levelColor = 'success' %}
  43.                 {% endif %}
  44.                 <span class="badge badge-{{ levelColor }} mr-2  vertical-gutter__item">{{ ('tour.difficulty' ~ tour.ratingDifficulty)|trans }}</span>
  45.             {% endif %}
  46.             {#
  47.             open: badge-success
  48.             partially-open: badge-info
  49.             closed: badge-danger
  50.             #}
  51.             {% set badge = [] %}
  52.             {% if tour.openedState %}
  53.                 {% if tour.openedState == 'open' %}
  54.                     {% set badge = {
  55.                         'color': 'success',
  56.                         'text': 'tour.Geöffnet'|trans
  57.                     } %}
  58.                 {% elseif tour.openedState == 'partially-open' %}
  59.                     {% set badge = {
  60.                         'color': 'info',
  61.                         'text': 'tour.Teilweise geöffnet'|trans
  62.                     } %}
  63.                 {% elseif tour.openedState == 'closed' %}
  64.                     {% set badge = {
  65.                         'color': 'danger',
  66.                         'text': 'tour.Geschlossen'|trans
  67.                     } %}
  68.                 {% endif %}
  69.             {% endif %}
  70.             {% if badge is not empty %}
  71.                 <span class="badge badge-{{ badge.color }} mr-2  vertical-gutter__item">
  72.                 {{ badge.text }}
  73.             </span>
  74.             {% endif %}
  75.         </div>
  76.         <div class="row row-gutter--3 pt-2">
  77.             <div class="col-auto">
  78.                 <span class="font-default-bold">{{ 'tour.Strecke'|trans }}</span> {{ (tour.length / 1000)|number_format(1, ',', '.') }} km
  79.             </div>
  80.             <div class="col-auto">
  81.                 {% set duration = tour.timeMin %}
  82.                 {% set hour = (duration/60)|round(0, 'floor') %}
  83.                 {% set minutes = duration % 60 %}
  84.                 {% if minutes < 10 %}
  85.                     {% set minutes = 0 ~ minutes %}
  86.                 {% endif %}
  87.                 <span class="font-default-bold">{{ 'tour.Dauer'|trans }}</span> {{ hour }}:{{ minutes }} h
  88.             </div>
  89.         </div>
  90.         {% set description = getImageDescription(tour.primaryImage) %}
  91.         <h3 class="tour-teaser__content__title font-default-bold mb-0"><a href="{{ linkGenerator().generate(tour, {relative: true, canoncial: false}) }}" class="stretch-link__link" title="{{ description|default('') }}">{{ tour.name }}</a></h3>
  92.     </div>
  93. </section>