templates/blog/articles_category.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block title %}
  3.     {% if blog_name == ''%} {{ 'blog_title'|trans}} {% else%} {{ blog_name|striptags|raw }} {% endif%}
  4. {% endblock %}
  5. {% block css %}
  6.     <style>
  7.         .card {
  8.             border: none;
  9.             color: #fff;
  10.             border-radius: 12px
  11.         }
  12.         .user-timing {
  13.             right: 9px;
  14.             bottom: 9px;
  15.             color: #fff
  16.         }
  17.         .views-content {
  18.             color: #606271
  19.         }
  20.         .views {
  21.             font-size: 12px
  22.         }
  23.         .dots {
  24.             display: flex;
  25.             height: 10px;
  26.             width: 10px;
  27.             background-color: green;
  28.             border-radius: 50%;
  29.             margin-left: 5px;
  30.             margin-bottom: 6px
  31.         }
  32.         .days-ago {
  33.             margin-top: -10px;
  34.             color: #606271
  35.         }
  36.         .snipimage img {
  37.             height: 150px
  38.         }
  39.         .widget {
  40.             position: relative;
  41.             display: block;
  42.             margin-bottom: 30px;
  43.         }
  44.         .widget_title {
  45.             background-color: #fff;
  46.             z-index: 3;
  47.         }
  48.         .widget_title:after {
  49.             position: relative;
  50.             display: inline-block;
  51.             bottom: 35px;
  52.             left: 52%;
  53.             content: " ";
  54.             width: 50%;
  55.             border-top: 2px solid #eee;
  56.             z-index: 1;
  57.         }
  58.         .widget_black h2:after {
  59.             display: table;
  60.             position: relative;
  61.             left: 50%;
  62.             bottom: 10px;
  63.             height: 2px;
  64.             content: " ";
  65.             text-shadow: none;
  66.             width: 15%;
  67.             background-color: #000;
  68.             z-index: 2;
  69.         }
  70.         .widget i:hover {
  71.             color: #f7510f;
  72.             cursor: pointer;
  73.         }
  74.         .widget_adv {
  75.             text-align: center;
  76.             margin: 30px;
  77.         }
  78.         .widget_advertisement {
  79.             text-align: center;
  80.             margin: 30px 0;
  81.         }
  82.         .widget_body img {
  83.             float: left;
  84.             position: relative;
  85.             margin-right: 25px;
  86.         }
  87.         .widget .add_img {
  88.             display: inline-block;
  89.             padding: 12px 12px;
  90.         }
  91.         .widget .media {
  92.             margin-top: 0;
  93.             margin-bottom: 30px;
  94.         }
  95.         .widget .media-heading {
  96.             margin-bottom: 5px;
  97.             font-size: 15px;
  98.             line-height: 18px;
  99.         }
  100.         .widget .media-date {
  101.             color: #b2b0b0;
  102.         }
  103.         .widget_article_social {
  104.             color: #a5a5a5;
  105.             margin-top: 15px;
  106.         }
  107.         .widget_article_social i {
  108.             padding: 5px;
  109.             margin-right: 5px;
  110.             color: #fff;
  111.             font-size: 10px;
  112.             background-color: #a5a5a5;
  113.         }
  114.         .widget_article_social span {
  115.             margin-right: 10px;
  116.         }
  117.         .widget_article_social a {
  118.             font-weight: bold;
  119.         }
  120.         .widget_img {
  121.             text-align: center;
  122.             margin: 0 auto;
  123.         }
  124.         .widget .adv_img {
  125.             display: inline-block;
  126.         }
  127.         .widget_body .btn {
  128.             border-radius: 0;
  129.         }
  130.         .widget hr {
  131.             border-color: #e0e0e0;
  132.         }
  133.         .widget-title hr {
  134.             border-width: 4px;
  135.             margin-bottom: 0;
  136.         }
  137.         .widget-title hr:before {
  138.             width: 80px;
  139.             background-color: #ddd;
  140.             display: block;
  141.             height: 4px;
  142.             position: relative;
  143.             content: "";
  144.             top: -4px;
  145.         }
  146.         .widget_divider {
  147.             display: inline-block;
  148.             vertical-align: baseline;
  149.             zoom: 1;
  150.             width: 98%;
  151.             position: relative;
  152.             text-align: right;
  153.             text-transform: uppercase;
  154.             font-size: 11px;
  155.         }
  156.         .widget_divider::after {
  157.             content: '';
  158.             display: block;
  159.             width: 75%;
  160.             left: 0;
  161.             text-align: right;
  162.             position: absolute;
  163.             top: 12px;
  164.             border-top: 1px solid #f1f1f1;
  165.         }
  166.         .media-body, .media-left, .media-right{
  167.             display: table-cell;
  168.             vertical-align: top;
  169.         }
  170.         .media-left, .media > .pull-left{
  171.             padding-right: 10px;
  172.         }
  173.         .media-body{
  174.         }
  175.         marquee p {
  176.             display: contents;
  177.         }
  178.         .padded {
  179.             padding: 100px 0;
  180.         }
  181.         .wrapper-grey {
  182.             background: #F4F4F4;
  183.         }
  184.         .avatar {
  185.             width: 30px;
  186.             border-radius: 50%;
  187.         }
  188.         .avatar-bordered {
  189.             box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  190.             border: white 1px solid;
  191.         }
  192.         .avatar-large {
  193.             width: 50px;
  194.         }
  195.         /* .banner {
  196.           color: white;
  197.           text-align: center;
  198.           height: 100vh;
  199.           background-size: cover !important;
  200.           display: flex;
  201.           align-items: center;
  202.           justify-content: center;
  203.         }
  204.         .banner h1 {
  205.           font-size: 50px;
  206.           font-weight: bold;
  207.           text-shadow: 0px 1px rgba(0, 0, 0, 0.2);
  208.         }
  209.         .banner p {
  210.           font-size: 25px;
  211.           font-weight: lighter;
  212.           color: rgba(255, 255, 255, 0.8);
  213.           margin-bottom: 50px;
  214.         } */
  215.         .card {
  216.             height: 250px;
  217.             text-shadow: 0 1px 3px rgba(0,0,0,0.6);
  218.             background-size: cover !important;
  219.             color: white;
  220.             position: relative;
  221.             border-radius: 5px;
  222.             margin-bottom: 20px;
  223.         }
  224.         .card-user {
  225.             position: absolute;
  226.             right: 10px;
  227.             top: 10px;
  228.         }
  229.         .card-category {
  230.             position: absolute;
  231.             top: 10px;
  232.             left: 10px;
  233.             font-size: 20px;
  234.         }
  235.         .card-description {
  236.             position: absolute;
  237.             bottom: 10px;
  238.             left: 10px;
  239.         }
  240.         .card-description h2 {
  241.             font-size: 22px;
  242.         }
  243.         .card-description p {
  244.             font-size: 15px;
  245.         }
  246.         .card-link {
  247.             position: absolute;
  248.             top: 0;
  249.             bottom: 0;
  250.             width: 100%;
  251.             z-index:2;
  252.             background: black;
  253.             opacity: 0;
  254.         }
  255.         .card-link:hover{
  256.             opacity: 0.1;
  257.         }
  258.         .features img {
  259.             width: 100px;
  260.         }
  261.         .features h2 {
  262.             font-size: 20px;
  263.             margin-bottom: 10px;
  264.         }
  265.         .features p {
  266.             font-size: 15px;
  267.             font-weight: lighter;
  268.         }
  269.     </style>
  270. {% endblock %}
  271. {% block body %}
  272.     <div class=" d-flex flex-column flex-row-fluid" style="margin-top: 25px">
  273.         <div class="card-body row">
  274.             <h1 style="font-weight: bolder;font-size: 38px;margin-bottom: 35px" class="bold text-left text-primary">{% if blog_name == ''%} {{ 'blog_title'|trans}} {% else%} {{ blog_name|raw }} {% endif%}<span style="float: right" class="fs-3">  >> {{ current_category.name }}</span></h1>
  275.             <div class="container-fluid categorie-div" style="margin-top: 18px;background: #f3f3f3;">
  276.                 <div class="d-flex align-items-center" style="width: 100%">
  277.                     <div class="flex-shrink-0">
  278.                         <a href="#" class="btn-left btn-link p-2 toggle3 text-dark"><i class="bi bi-caret-left"></i></a>
  279.                     </div>
  280.                     <div class="flex-grow-1  o-hidden" style="overflow-x: scroll">
  281.                         <ul class="nav nav-blog nav-fill small position-relative flex-nowrap div-ul-link" style="margin-bottom: 8px">
  282.                             {%  for cat in categories %}
  283.                                 <li class="nav-item">
  284.                                     <a href="{{ path('app_show_category_articles',{'slug':cat.slug})  }}" class="header-nav-link" style="">{{ cat.name }}</a>
  285.                                 </li>
  286.                             {% endfor %}
  287.                         </ul>
  288.                     </div>
  289.                     <div class="flex-shrink-0">
  290.                         <a href="#" class="btn-right btn-link toggle3 p-2 text-dark"><i class="bi bi-caret-right"></i></a>
  291.                     </div>
  292.                 </div>
  293.             </div>
  294.             <div class="separator" style="border-width: 5px"></div>
  295.             <div class="container mt-4">
  296.                 <div class=" p-3 row">
  297.                     <div class="col-lg-8 col-md-8 col-sm-12">
  298.                         {% for a in articles %}
  299.                             <div class="row mb-8">
  300.                                 <div class="col-md-3 col-lg-3 col-sm-12">
  301.                                     <div class="position-relative snipimage">
  302.                                         <a href="{{ path('blog_show_article',{'slug':a.slug}) }}">
  303.                                             {% if a.imageCover != '' %}
  304.                                                 <img style="object-fit: cover;width: 300px;" src="{{ asset('uploads/'~a.imageCover) }}" class=" img-fluid  img-responsive">
  305.                                             {% else %}
  306.                                                 <img style="object-fit: cover;width: 300px" src="{{ asset('assets/media/avatars/blank.png') }}" class=" img-fluid img-responsive">
  307.                                             {% endif %}
  308.                                         </a>
  309.                                     </div>
  310.                                 </div>
  311.                                 <div class="col-md-9 col-lg-9 col-sm-12">
  312.                                     <div class="mt-2">
  313.                                         <div class="d-flex justify-content-between align-items-center">
  314.                                             <a href="{{ path('blog_show_article',{'slug':a.slug}) }}"><h5 class="mb-1">{{ a.title}} </h5></a>
  315.                                         </div>
  316.                                         <div class="fs-13 mb-2" style="color: #7a7a7a">
  317.                                             <span class="mr-2 badge badge-primary">{{ a.category.name }} </span>
  318.                                         </div>
  319.                                         <div class="d-flex justify-content-md-start justify-content-between views-content mt-2">
  320.                                             <a href="{{ path('blog_show_article',{'slug':a.slug}) }}">
  321.                                                 {{ a.content|striptags|u.truncate(200, '...')|raw  }}
  322.                                             </a>
  323.                                         </div>
  324.                                         <div class="d-flex align-items-center mb-2">
  325.                                             <div class="ms-3">
  326.                                                 <span class="text-muted fs-7 mb-1"><span class="bi bi-clock"></span> {{ a.date|date('Y-m-d') }}</span>
  327.                                             </div>
  328.                                         </div>
  329.                                     </div>
  330.                                 </div>
  331.                             </div>
  332.                             <div class="separator" style="margin-bottom: 20px; height: 4px"></div>
  333.                         {% endfor %}
  334.                         {{ knp_pagination_render(articles) }}
  335.                     </div>
  336.                     <div class="col-lg-4 col-md-4 col-sm-12">
  337.                         {% include 'blog/ads_list.html.twig' %}
  338.                     </div>
  339.                 </div>
  340.             </div>
  341.         </div>
  342.     </div>
  343. {% endblock %}
  344.  {% block js %}
  345.      <script src="{{ asset('assets/plugins/custom/ckeditor/ckeditor-classic.bundle.js') }}"></script>
  346.      <script id="templateAds" type="text/html">
  347.          <div class="col-md-12">
  348.              <div class="card" style="max-height: 220px; background: linear-gradient(rgba(0,0,0,0.3), rgba(0,0,0,0.2)), url('{{ asset('uploads/') }}[[image]]');">
  349.                  <div class="card-category" style="text-shadow: 1px 1px 2px #7f3e98, 0 0 1em #7f3e98, 0 0 0.2em #7f3e98;">[[title]]</div>
  350.                  <div class="card-description">
  351.                      <p style="text-shadow: 1px 1px 2px #7f3e98, 0 0 1em #7f3e98, 0 0 0.2em #7f3e98;">[[content]]</p>
  352.                  </div>
  353.                  <a target="_blank" class="card-link" href="[[link]]" ></a>
  354.              </div>
  355.          </div>
  356.      </script>
  357.      <script>
  358.          $.ajax({
  359.              url: "{{ path('list_ads_json',{'limit':10,'offset':0}) }}"+'?lang='+getCookie('lang'),
  360.              type: 'GET',
  361.              dataType: 'json',
  362.              success: function(res){
  363.                  let templateRep = document.getElementById("templateAds");
  364.                  let templateRepHtml = templateRep.innerHTML;
  365.                  let listHtml = "";
  366.                  res.data.forEach(function (e){
  367.                      let link = "{{ path('display_ads',{'slug':'0000'}) }}";
  368.                      link = link.replace('0000',e.slug)
  369.                      listHtml += templateRepHtml
  370.                          .replace("[[image]]",e.image)
  371.                          .replace("[[link]]",link)
  372.                          .replace("[[title]]",e.title)
  373.                          .replace("[[content]]",e.description);
  374.                  });
  375.                  $('#ads_list').html(listHtml);
  376.              },
  377.              error :function (error) {
  378.                  console.log(error);
  379.              }
  380.          });
  381.      </script>
  382.      <script>
  383.          $('.toggle3').click(function(){
  384.              $('.nav-blog').toggleClass("justify-content-end");
  385.              $('.toggle3').toggleClass("text-light");
  386.          });
  387.      </script>
  388.  {% endblock %}