templates/front/partials/cards/publication.html.twig line 1

Open in your IDE?
  1. {% set size = size ?? 'M' %}
  2. {% set picSizes = [[454, 244], [467, 251], [703, 377], [356,191]] %}
  3. {% if size == 'L' %}
  4.     {# same from mobile to lg, more landscape for desktop #}
  5.     {% set picSizes = [[680, 260], [467, 251], [703, 377], [356,191]] %}
  6. {% endif %}
  7. {% set templateType = 'pic' %}
  8. {% if type == 'study' %}
  9.     {% set ctaLabel = 'Lire l\'étude' %}
  10.     {% set tag = 'Étude' %}
  11. {% elseif type == 'activity-report' %}
  12.     {% set ctaLabel = 'Voir le rapport d\'activité' %}
  13.     {% set tag = 'Rapport d\'activité' %}
  14. {% elseif type == 'thematic-brochure' %}
  15.     {% set templateType = 'picto' %}
  16.     {% set ctaLabel = 'Voir la plaquette' %}
  17.     {% set tag = 'Plaquette thématique' %}
  18. {% elseif type == 'practical-guide' %}
  19.     {% set templateType = 'picto' %}
  20.     {% set ctaLabel = 'Voir la note adhérent' %}
  21.     {% set tag = 'Note adhérent' %}
  22. {% elseif type == 'btob-news' %}
  23.     {% set ctaLabel = 'Lire le BtoB news' %}
  24.     {% set tag = 'BtoB news' %}
  25. {% elseif type == 'barometer-activity' %}
  26.     {% set ctaLabel = 'Découvrir le baromètre' %}
  27.     {% set tag = 'Baromètre d\'activité' %}
  28. {% endif %}
  29. <div class="card-common card-common--{{ size }} card-publi card-publi--{{ type }} {{ templateType == 'picto' ? 'card-publi--picto' : '' }}">
  30.     <a href="{{ page_url(publication, "front") }}" class="card-common__wrap">
  31.         <div class="card-common__tags {{ templateType == 'picto' ? 'card-common__tags--picto' : '' }}">
  32.             <span class="tag">{{ tag }}</span>
  33.             {% if publicationProperties.isMemberOnly %}
  34.                 <span class="tag tag--adherent">
  35.                     <svg width="10" height="13" class="mr-1 icon--violet">
  36.                         <use href="#icon-lock" xlink:href="#icon-lock"></use>
  37.                     </svg>
  38.                     Adhérent
  39.                 </span>
  40.             {% endif %}
  41.         </div>
  42.         {% if templateType == 'pic' %}
  43.             <picture class="card-common__pic {{ size == 'L' ?  'card-common__pic--publi-L' : 'card-common__pic--publi' }}">
  44.                 <source media="(max-width:420px)"
  45.                         data-srcset="{{ cloudinary_media(publicationProperties.image.singleMedia, 'c_fill,f_auto,q_auto,w_' ~ picSizes[3][0] ~ ',h_' ~ picSizes[3][1]) }}">
  46.                 <source media="(max-width:767px)"
  47.                         data-srcset="{{ cloudinary_media(publicationProperties.image.singleMedia, 'c_fill,f_auto,q_auto,w_' ~ picSizes[2][0] ~ ',h_' ~ picSizes[2][1]) }}">
  48.                 <source width="{{ picSizes[1][0] }}" height="{{ picSizes[1][1] }}" media="(max-width:1023px)"
  49.                         data-srcset="{{ cloudinary_media(publicationProperties.image.singleMedia, 'c_fill,f_auto,q_auto,w_' ~ picSizes[1][0] ~ ',h_' ~ picSizes[1][1]) }}">
  50.                 <img class="w-full lazyload" width="{{ picSizes[0][0] }}" height="{{ picSizes[0][1] }}"
  51.                      data-src="{{ cloudinary_media(publicationProperties.image.singleMedia, 'c_fill,f_auto,q_auto,w_' ~ picSizes[0][0] ~ ',h_' ~ picSizes[0][1]) }}"
  52.                      alt="{{ publicationProperties.image.singleMedia.alt }}"/>
  53.             </picture>
  54.         {% else %}
  55.             <div class="card-publi__picto {{ type == 'thematic-brochure' ? 'card-publi__picto--orange' : '' }}">
  56.                 {% if type == 'thematic-brochure' %}
  57.                     <svg width="48" height="66" class="mt-8 ml-16">
  58.                         <use href="#icon-publication-brochure" xlink:href="#icon-publication-brochure"></use>
  59.                     </svg>
  60.                 {% else %}
  61.                     <svg width="78" height="57" class="mt-9 ml-11">
  62.                         <use href="#icon-publication-guide" xlink:href="#icon-publication-guide"></use>
  63.                     </svg>
  64.                 {% endif %}
  65.             </div>
  66.         {% endif %}
  67.         <div class="card-common__inner mt-5">
  68.             <div>
  69.                 <p class="card-common__date {{ templateType == 'pic' ? 'text-grey-dark' : 'text-white' }}">
  70.                     <svg width="12" height="12"
  71.                          class="mr-2 {{ type == 'practical-guide' ? 'icon--white' : 'icon--violet' }}">
  72.                         <use href="#icon-hour" xlink:href="#icon-hour"></use>
  73.                     </svg>
  74.                     <span>Publié le <span
  75.                                 class="font-bold {{ templateType == 'pic' ? 'text-violet' : 'text-white' }}">{{ publicationProperties.publicationDate.date|date('d.m.Y') }}</span></span>
  76.                 </p>
  77.                 <p class="title-card {{ size == 'L' ? templateType == 'picto' ? 'title-card--XL' : 'title-card--L' : templateType == 'picto' ? 'title-card--L-pic' : '' }}   {{ templateType == 'pic' ? 'text-violet' : 'text-white' }} mb-3">
  78.                     {{ publication.title }}</p>
  79.                 {% if publication.description is defined and publication.description is not null %}
  80.                 <div class="card-publi__chapo {{ templateType == 'pic' ? 'text-grey-dark' : 'text-white' }}">
  81.                     {{ publication.description|striptags|raw }}
  82.                 </div>
  83.                 {% endif %}
  84.             </div>
  85.             <span class="cta-arrow {{ type == 'thematic-brochure' ? 'cta-arrow--circle-violet' : '' }} {{ templateType == 'pic' ? 'text-violet' : 'text-white' }} mt-5">
  86.                 {{ ctaLabel }}
  87.                 <span class="cta-arrow__circle">
  88.                     <svg width="8" height="8" class="icon--white">
  89.                         <use href="#icon-arrow" xlink:href="#icon-arrow"></use>
  90.                     </svg>
  91.                 </span>
  92.             </span>
  93.         </div>
  94.     </a>
  95.     {% if publicationProperties.document is defined and publicationProperties.document.singleMedia.publicId is not null %}
  96.         {% set isHidden = publicationProperties.isMemberOnly and app.user == null %}
  97.         {% if not isHidden %}
  98.         <a onclick="gtag('event', 'telecharger-cards', {'button_text': 'telecharger-cards'});" href="{{ cloudinary_media(publicationProperties.document.singleMedia) }}" target="_blank" rel="nofollow"
  99.            class="card-common__action {{ type == 'thematic-brochure' ? 'card-common__action--violet' : '' }} icon-center">
  100.             <svg width="20" height="20" class="icon--white">
  101.                 <use href="#icon-download" xlink:href="#icon-download"></use>
  102.             </svg>
  103.             <span class="sr-only">Télécharger le document</span>
  104.         </a>
  105.         {% endif %}
  106.     {% endif %}
  107. </div>