templates/main/categorie_articles.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block title %}SiteWEB{% endblock %}
  3. {% block body %}
  4.     {% set currentPath = app.request.get('_route') %}
  5.     {% set currentparam = app.request.get('_route_params') %}
  6.     <div class="row">
  7.         <div class="col-12">
  8.             <div class="site-sous-menu">
  9.                 <select class="select2 form-control list-categories-page">
  10.                     <option {% if currentPath == 'all_categories' %} selected {% endif %} value="{{ absolute_url(path('all_categories')) }}">Toutes les catégories</option>
  11.                     {% for categorie in  categories %}
  12.                         <option {% if currentparam["slug"] == categorie.slug %} selected {% endif %} value="{{ absolute_url(path('articles_categorie', {'slug': categorie.slug})) }}">{{ categorie.nom }}</option>
  13.                     {% endfor %}
  14.                 </select>
  15.             </div>
  16.         </div>
  17.     </div>
  18.     <div class="row">
  19.         {% for article in articles %}
  20.             {% set classArticle = "" %}
  21.             {% if article.endPromo|date('Y-m-d') < "now"|date('Y-m-d') %}
  22.                 {% set classArticle = "expired-article" %}
  23.             {% endif %}
  24.             <div class="col-lg-4 col-sm-12">
  25.                 <div class="card card-article {{classArticle}}" style="margin-top:20px;">
  26.                     {% if article.best == true %}
  27.                         <div class="hot-promo" data-toggle="tooltip" title="Ne ratez pas ce promo !"></div>
  28.                         <img class="hot-promo-icon" data-toggle="tooltip" title="Ne ratez pas ce promo !" src="{{asset('img/hot-promo.png')}}"> 
  29.                     {% endif %}
  30.                     <img class="card-img-top" height="140" src="{{ vich_uploader_asset(article, 'imageFile')|imagine_filter('article')  }}" alt="img-promo">
  31.                     <div class="card-body">
  32.                         <h5 class="card-title text-center" style="float:left;font-size:15px;margin:0;" title="{{ article.titre | raw |title }}">{{ article.titre |title | slice(0, 18, true) }} {% if article.titre |length > 13 %}...{% endif %}</h5>
  33.                         <br>
  34.                         <h6 class="card-title text-left" style="float:left;">
  35.                         <a href="{{ path('article_store', {'id': article.supplier.id}) }}">
  36.                             {{article.supplier.name}}
  37.                         </a>
  38.                         </h6>
  39.                         {% if article.endPromo|date('Y-m-d') >= "now"|date('Y-m-d') %}
  40.                             <a style="float:right;" href="{{ path('web_store_article', {'slug': article.slug}) }}" class="btn btn-primary float-right">Voir Promo</a>
  41.                         {% endif %}
  42.                     </div>
  43.                     <div class="card-footer">
  44.                         <span class="period-promo {{classArticle}}"><i class="fa fa-calendar-check-o" aria-hidden="true"></i> De {{ article.beginPromo|date("d/m/Y")}} à {{ article.endPromo |date("d/m/Y")}}</span>
  45.                         <span class="nbre-comment" title="Nombre des commentaires">
  46.                             {% set nbrecomment = 0 %}
  47.                             {% for comment in article.commentaires %}
  48.                                 {% if comment.actif == 1 %}
  49.                                     {% set nbrecomment = nbrecomment + 1 %}
  50.                                 {% endif %}
  51.                             {% endfor %}
  52.                             {{ nbrecomment }} 
  53.                             <i class="fa fa-comment comment-store-articles"></i>
  54.                         </span>
  55.                     </div>
  56.                 </div>
  57.             </div>    
  58.         {% endfor %}
  59.     </div>
  60. {% endblock %}