templates/includes/blocks/teaser-grid.html.twig line 1

  1. <div class="teaser-grid {% if content.inverted %}teaser-grid--inverted {% endif %}{{ content.top }}
  2.   {{ content.bottom }}" x-data="teasergrid({{ content.pages|length }},{{ content.initialItems }},3)">
  3.     <div class="teaser-grid__container">
  4.         <div class="teaser-grid__title " x-ref="title">
  5.             {% if content.teaserGridPagina %}
  6.             {% if content.teaserGridSeoHeadlinePagina %}<{{ content.teaserGridSeoHeadlinePagina }}>{% endif %}
  7.                 <div class="pagina">
  8.                     {{ content.teaserGridPagina }}
  9.                 </div>
  10.             {% if content.teaserGridSeoHeadlinePagina %}</{{ content.teaserGridSeoHeadlinePagina }}>{% endif %}
  11.             {% endif %}
  12.             {% if content.teaserGridTitleDesktop %}
  13.                 <div {% if content.teaserGridTitleMobile %}class="desktop-only"{% endif %}>
  14.                     {{ content.teaserGridTitleDesktop|raw }}
  15.                 </div>
  16.             {% endif %}
  17.         </div>
  18.         {% if content.teaserGridTitleMobile %}
  19.             <div class="teaser-grid__title mobile-only"
  20.                  x-ref="mobiletitle">
  21.                 {{ content.teaserGridTitleMobile|raw }}
  22.             </div>
  23.         {% endif %}
  24.         <div class="teaser-grid__teasers" x-ref="teasers" id="teasers">
  25.             {% for key, value in content.pages %}
  26.                 <a href="{{ sulu_content_path(value.url) }}"
  27.                    class="story-teaser {% if content.inverted %}story-teaser--inverted {% endif %}"
  28.                    x-show="show({{ key }})">
  29.                     <div class="story-teaser__media">
  30.                         {% if value.excerptAlternativeImage %}
  31.                             {% set image=value.excerptAlternativeImage %}
  32.                             <img src ="{{ image|thumbnailUrl('2880x') }}" class="story-teaser__image"
  33.                                  srcset ="{{ image|thumbnailUrl('320x') }} 320w, {{ image|thumbnailUrl('640x') }} 640w, {{ image|thumbnailUrl('1280x') }} 1280w, {{ image|thumbnailUrl('1440x') }} 1440w, {{ image|thumbnailUrl('2048x') }} 2048w" alt="{{ image.description|striptags }}"
  34.                                  x-ref="image" sizes="(min-width: 1440px) 480px, (min-width: 768px) 33vw, 100vw">
  35.                         {% endif %}
  36.                         {% if value.excerptImages and not value.excerptAlternativeImage %}
  37.                             {% set image=value.excerptImages[0] %}
  38.                             <img src ="{{ image|thumbnailUrl('2880x') }}" class="story-teaser__image"
  39.                                  srcset ="{{ image|thumbnailUrl('320x') }} 320w, {{ image|thumbnailUrl('640x') }} 640w, {{ image|thumbnailUrl('1280x') }} 1280w, {{ image|thumbnailUrl('1440x') }} 1440w, {{ image|thumbnailUrl('2048x') }} 2048w" alt="{{ image.description|striptags }}"
  40.                                  x-ref="image" sizes="(min-width: 1440px) 480px, (min-width: 768px) 33vw, 100vw">
  41.                         {% endif %}
  42.                     </div>
  43.                     <div class="story-teaser__meta">
  44.                         {% if value.excerptType %}
  45.                             <span class="story-teaser__type"
  46.                                   style="float: left">{{ value.excerptType }} |&nbsp;</span>
  47.                         {% endif %}
  48.                         {% if value.excerptTime %}
  49.                             <span class="story-teaser__time"><p>{{ value.excerptTime }}</span>
  50.                         {% endif %}
  51.                     </div>
  52.                     {% if value.excerptTitleTeaserGrid %}
  53.                         <div class="story-teaser__title">
  54.                             {{ value.excerptTitleTeaserGrid|raw }}
  55.                         </div>
  56.                     {% else %}
  57.                         <div class="story-teaser__title">
  58.                             {{ value.title|raw }}
  59.                         </div>
  60.                     {% endif %}
  61.                     <div class="story-teaser__text">
  62.                         {% if value.excerptCustomText %}
  63.                             {{ value.excerptCustomText|raw }}
  64.                         {% elseif value.excerptDescription %}
  65.                             {% set short = value.excerptDescription|split(' ') %}
  66.                             {% if short|length > 20 %}
  67.                                 {{ short|slice(0, 19)|join(' ')|raw }}...
  68.                             {% else %}
  69.                                 {{ value.excerptDescription|raw }}
  70.                             {% endif %}
  71.                         {% endif %}
  72.                     </div>
  73.                 </a>
  74.             {% endfor %}
  75.         </div>
  76.         {# button below has to be shown only as long as not all teasers are shown, not yet working #}
  77.         <div class="teaser-grid__actions" x-ref="actions" x-show="showActions()" id="teasergrid-actions">
  78.             <button class="button button--{% if content.inverted %}grey{% else %}default {% endif %}"
  79.                     x-ref="loadmore" @click="loadMore" id="moreButton">
  80.                    <span class="button__inner">
  81.                      {{ content.teaserGridExpandButtonLabel }}
  82.                    </span>
  83.             </button>
  84.         </div>
  85.     </div>
  86. </div>