templates/bundles/OdiseoSyliusBlogPlugin/Shop/Article/BeforeAfterArticle.html.twig line 1

Open in your IDE?
  1. {% if resources|length > 0 %}
  2.     <div class="before-after-items">
  3.         {% set id = app.request.query.get('id') %}
  4.         {% set targetIndex = -1 %}
  5.         {% for index, article in resources %}
  6.             {% if article.id == id %}
  7.                 {% set targetIndex = index %}
  8.             {% endif %}
  9.         {% endfor %}
  10.         {% if targetIndex >= 0 %}
  11.             {% set previousIndex = targetIndex - 1 %}
  12.             {% set nextIndex = targetIndex + 1 %}
  13.             {% if previousIndex >= 0 %}
  14.                 {% set previousArticle = resources|slice(previousIndex, 1)|first %}
  15.                 <div class="previous-article">
  16.                     <a class="" href="{{ path('odiseo_sylius_blog_plugin_shop_article_show', {'slug' : previousArticle.slug}) }}">
  17.                         {% if previousArticle.images|length > 0 %}
  18.                             <div class="image">
  19.                                 <img src="{{ previousArticle.images[0].path|imagine_filter(filter|default('sylius_small')) }}" alt="{{ previousArticle.images[0].path }}">
  20.                             </div>
  21.                         {% endif %}
  22.                     </a>
  23.                     <div class="link-before-after">
  24.                         <span>
  25.                             <a href="{{ path('odiseo_sylius_blog_plugin_shop_article_show', {'slug' : previousArticle.slug}) }}" data-disqus-identifier="{{ url('odiseo_sylius_blog_plugin_shop_article_show', {'slug' : previousArticle.slug}) }}">
  26.                                 <svg width="8" height="15" viewBox="0 0 8 15" fill="none" xmlns="http://www.w3.org/2000/svg">
  27.                                 <path d="M6.66667 14.1666L0 7.49992L6.66667 0.833252L7.85 2.01659L2.36667 7.49992L7.85 12.9833L6.66667 14.1666Z" fill="#858585"/>
  28.                                 </svg>
  29.                                 Précédent
  30.                             </a>
  31.                         </span>
  32.                         <h3>
  33.                             <a href="{{ path('odiseo_sylius_blog_plugin_shop_article_show', {'slug' : previousArticle.slug}) }}">{{ previousArticle.translations['fr_FR'].title }}</a>
  34.                         </h3>
  35.                     </div>
  36.                 </div>
  37.             {% endif %}
  38.             {% if previousIndex >= 0 and nextIndex < articles|length%}
  39.                 <script>
  40.                     console.log('previousIndex');
  41.                 </script>
  42.                 <style>
  43.                     @media only screen and (max-width: 768px) {
  44.                         .previous-article {
  45.                             display: none !important;
  46.                         }
  47.                     }
  48.                 </style>
  49.                 {% endif %}
  50.             {% if nextIndex < articles|length %}
  51.                 {% set nextArticle = resources|slice(nextIndex, 1)|first %}
  52.                 <div class="next-article">
  53.                     <div class="link-before-after">
  54.                         <span>
  55.                             <a href="{{ path('odiseo_sylius_blog_plugin_shop_article_show', {'slug' : nextArticle.slug}) }}" data-disqus-identifier="{{ url('odiseo_sylius_blog_plugin_shop_article_show', {'slug' : nextArticle.slug}) }}">
  56.                                 Suivant
  57.                                 <svg width="9" height="15" viewBox="0 0 9 15" fill="none" xmlns="http://www.w3.org/2000/svg">
  58.                                 <path d="M1.35033 14.1666L0.166992 12.9833L5.65033 7.49992L0.166992 2.01659L1.35033 0.833252L8.01699 7.49992L1.35033 14.1666Z" fill="#858585"/>
  59.                                 </svg>
  60.                             </a>
  61.                         </span>
  62.                         <h3>
  63.                             <a href="{{ path('odiseo_sylius_blog_plugin_shop_article_show', {'slug' : nextArticle.slug}) }}">{{ nextArticle.translations['fr_FR'].title }}</a>
  64.                         </h3>
  65.                     </div>
  66.                     <a class="" href="{{ path('odiseo_sylius_blog_plugin_shop_article_show', {'slug' : nextArticle.slug}) }}">
  67.                         {% if nextArticle.images|length > 0 %}
  68.                             <div class="image">
  69.                                 <img src="{{ nextArticle.images[0].path|imagine_filter(filter|default('sylius_small')) }}" alt="{{ nextArticle.images[0].path }}">
  70.                             </div>
  71.                         {% endif %}
  72.                     </a>
  73.                 </div>
  74.             {% endif %}
  75.         {% endif %}
  76.     </div>
  77.     <style>
  78.         /*.before-after-items{*/
  79.         /*    display: flex;*/
  80.         /*    flex-direction: row;*/
  81.         /*    justify-content: space-between;*/
  82.         /*    padding-top: 4rem;*/
  83.         /*}*/
  84.         /*.before-after-items > * {*/
  85.         /*    display: flex;*/
  86.         /*    flex-direction: row;*/
  87.         /*    align-items: center;*/
  88.         /*    gap: 1rem;*/
  89.         /*}*/
  90.         /*.before-after-items > * > .link-before-after {*/
  91.         /*    display: flex;*/
  92.         /*    flex-direction: column;*/
  93.         /*    gap: 0.5rem;*/
  94.         /*    align-items: start;*/
  95.         /*}*/
  96.         /*.before-after-items > * > .link-before-after > span > a {*/
  97.         /*    display: flex;*/
  98.         /*    flex-direction: row;*/
  99.         /*    gap: 0.5rem;*/
  100.         /*    align-items: center;*/
  101.         /*    color: #858585;*/
  102.         /*}*/
  103.         /*.before-after-items > * > .link-before-after > h3 {*/
  104.         /*    margin: 0 !important;*/
  105.         /*}*/
  106.         /*.next-article{*/
  107.         /*    margin-left: auto;*/
  108.         /*}*/
  109.     </style>
  110. {% endif %}