templates/blog/articles.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.         .dot {
  179.             height: 6px;
  180.             width: 6px;
  181.             margin-left: 3px;
  182.             margin-right: 3px;
  183.             margin-top: 2px !important;
  184.             background-color: #7f3e98!important;
  185.             border-radius: 50%;
  186.             display: inline-block
  187.         }
  188.         .padded {
  189.             padding: 100px 0;
  190.         }
  191.         .wrapper-grey {
  192.             background: #F4F4F4;
  193.         }
  194.         .avatar {
  195.             width: 30px;
  196.             border-radius: 50%;
  197.         }
  198.         .avatar-bordered {
  199.             box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  200.             border: white 1px solid;
  201.         }
  202.         .avatar-large {
  203.             width: 50px;
  204.         }
  205.         /* .banner {
  206.           color: white;
  207.           text-align: center;
  208.           height: 100vh;
  209.           background-size: cover !important;
  210.           display: flex;
  211.           align-items: center;
  212.           justify-content: center;
  213.         }
  214.         .banner h1 {
  215.           font-size: 50px;
  216.           font-weight: bold;
  217.           text-shadow: 0px 1px rgba(0, 0, 0, 0.2);
  218.         }
  219.         .banner p {
  220.           font-size: 25px;
  221.           font-weight: lighter;
  222.           color: rgba(255, 255, 255, 0.8);
  223.           margin-bottom: 50px;
  224.         } */
  225.         .card {
  226.             height: 250px;
  227.             text-shadow: 0 1px 3px rgba(0,0,0,0.6);
  228.             background-size: cover !important;
  229.             color: white;
  230.             position: relative;
  231.             border-radius: 5px;
  232.             margin-bottom: 20px;
  233.         }
  234.         .card-user {
  235.             position: absolute;
  236.             right: 10px;
  237.             top: 10px;
  238.         }
  239.         .card-category {
  240.             position: absolute;
  241.             top: 10px;
  242.             left: 10px;
  243.             font-size: 20px;
  244.         }
  245.         .card-description {
  246.             position: absolute;
  247.             bottom: 10px;
  248.             left: 10px;
  249.         }
  250.         .card-description h2 {
  251.             font-size: 22px;
  252.         }
  253.         .card-description p {
  254.             font-size: 15px;
  255.         }
  256.         .card-link {
  257.             position: absolute;
  258.             top: 0;
  259.             bottom: 0;
  260.             width: 100%;
  261.             z-index:2;
  262.             background: black;
  263.             opacity: 0;
  264.         }
  265.         .card-link:hover{
  266.             opacity: 0.1;
  267.         }
  268.         .features img {
  269.             width: 100px;
  270.         }
  271.         .features h2 {
  272.             font-size: 20px;
  273.             margin-bottom: 10px;
  274.         }
  275.         .features p {
  276.             font-size: 15px;
  277.             font-weight: lighter;
  278.         }
  279.     </style>
  280. {% endblock %}
  281. {% block body %}
  282.     <div class=" d-flex flex-column flex-row-fluid" >
  283.         <div class="card-body row" style="margin-top: 20px">
  284.             <h1 style="font-weight: bolder;font-size: 38px;margin-bottom: 5px" class="bold text-left text-primary">
  285.                 {% if blog_name == ''%} {{ 'blog_title'|trans}} {% else%} {{ blog_name|raw }} {% endif%}
  286.             </h1>
  287.             {% if school_notifs|length >0 or educati_notifs|length>0 %}
  288.                 <div class="">
  289.                     <div class="row">
  290.                         <div class="col-md-12">
  291.                             <div class="d-flex justify-content-between align-items-center breaking-news " style="
  292.                                     border-bottom-style: solid;border-bottom-color:  #7f3e9824!important;border-bottom-width: 2px;
  293.                                     ">
  294.                                 <marquee style="display: inline-block;font-size: 16px;min-height: 35px; padding-top: 6px;" class="news-scroll" behavior="scroll" direction="left" onmouseover="this.stop();" onmouseout="this.start();">
  295.                                     {% if school_notifs|length >0  %}
  296.                                         {% for no in school_notifs %}
  297.                                             {% if no.startAt is not null %}
  298.                                                 {% if date_now >= no.startAt %}
  299.                                                     {% if no.expiredAt is not null  %}
  300.                                                         {% if no.expiredAt >= date_now %}
  301.                                                             {{ no.content|raw}} <i class="dot" style="margin-right: 10px"></i>
  302.                                                         {% endif %}
  303.                                                     {% else %}
  304.                                                         {{ no.content|raw}} <i class="dot" style="margin-right: 10px"></i>
  305.                                                     {% endif %}
  306.                                                 {% endif %}
  307.                                             {% else %}
  308.                                                 {% if no.expiredAt is not null  %}
  309.                                                     {% if no.expiredAt >= date_now %}
  310.                                                         {{ no.content|raw}} <i class="dot" style="margin-right: 10px"></i>
  311.                                                     {% endif %}
  312.                                                 {% else %}
  313.                                                     {{ no.content|raw}} <i class="dot" style="margin-right: 10px"></i>
  314.                                                 {% endif %}
  315.                                             {% endif %}
  316.                                         {% endfor %}
  317.                                     {% endif %}
  318.                                 </marquee>
  319.                             </div>
  320.                         </div>
  321.                     </div>
  322.                 </div>
  323.             {% endif %}
  324.             <div class="container-fluid categorie-div" style="margin-top: 18px;background: #f3f3f3;">
  325.                 <div class="d-flex align-items-center" style="width: 100%">
  326.                     <div class="flex-shrink-0">
  327.                         <a href="#" class="btn-left btn-link p-2 toggle3 text-dark"><i class="bi bi-caret-left"></i></a>
  328.                     </div>
  329.                     <div class="flex-grow-1  o-hidden" style="overflow-x: scroll">
  330.                         <ul class="nav nav-blog nav-fill small position-relative flex-nowrap div-ul-link" style="margin-bottom: 8px">
  331.                             {%  for cat in categories %}
  332.                                 <li class="nav-item">
  333.                                     <a href="{{ path('app_show_category_articles',{'slug':cat.slug})  }}" class="header-nav-link" style="">{{ cat.name }}</a>
  334.                                 </li>
  335.                             {% endfor %}
  336.                         </ul>
  337.                     </div>
  338.                     <div class="flex-shrink-0">
  339.                         <a href="#" class="btn-right btn-link toggle3 p-2 text-dark"><i class="bi bi-caret-right"></i></a>
  340.                     </div>
  341.                 </div>
  342.             </div>
  343.             <div class="separator" style="border-width: 5px"></div>
  344.             <div class="container mt-4">
  345.                 <div class=" p-3 row">
  346.                     <div class="col-lg-8 col-md-8 col-sm-12">
  347.                         {% for a in articles %}
  348.                             <div class="row mb-8">
  349.                                 <div class="col-md-3 col-lg-3 col-sm-12">
  350.                                     <div class="position-relative snipimage">
  351.                                         <a href="{{ path('blog_show_article',{'slug':a.slug}) }}">
  352.                                             {% if a.imageCover != '' %}
  353.                                                 <img style="object-fit: cover;width: 300px;" src="{{ asset('uploads/'~a.imageCover) }}" class=" img-fluid  img-responsive">
  354.                                             {% else %}
  355.                                                 <img style="object-fit: cover;width: 300px" src="{{ asset('assets/media/avatars/blank.png') }}" class=" img-fluid img-responsive">
  356.                                             {% endif %}
  357.                                         </a>
  358.                                     </div>
  359.                                 </div>
  360.                                 <div class="col-md-9 col-lg-9 col-sm-12">
  361.                                     <div class="mt-2">
  362.                                         <div class="d-flex justify-content-between align-items-center">
  363.                                             <a href="{{ path('blog_show_article',{'slug':a.slug}) }}"><h5 class="mb-1">{{ a.title}} </h5></a>
  364.                                         </div>
  365.                                         <div class="fs-13 mb-2" style="color: #7a7a7a">
  366.                                             <span class="mr-2 badge badge-primary">{{ a.category.name }} </span>
  367.                                         </div>
  368.                                         <div class="d-flex justify-content-md-start justify-content-between views-content mt-2">
  369.                                             <a href="{{ path('blog_show_article',{'slug':a.slug}) }}">
  370.                                                 {{ a.content|striptags|u.truncate(200, '...')|raw  }}
  371.                                             </a>
  372.                                         </div>
  373.                                         <div class="d-flex align-items-center mb-2">
  374.                                             <div class="ms-3">
  375.                                                 <span class="text-muted fs-7 mb-1"><span class="bi bi-clock"></span> {{ a.date|date('Y-m-d') }}</span>
  376.                                             </div>
  377.                                         </div>
  378.                                     </div>
  379.                                 </div>
  380.                             </div>
  381.                             <div class="separator" style="margin-bottom: 20px; height: 4px"></div>
  382.                         {% endfor %}
  383.                         {{ knp_pagination_render(articles) }}
  384.                     </div>
  385.                     <div class="col-lg-4 col-md-4 col-sm-12">
  386.                         {% include 'blog/ads_list.html.twig' %}
  387.                     </div>
  388.                 </div>
  389.             </div>
  390.         </div>
  391.     </div>
  392. {% endblock %}
  393.  {% block js %}
  394.      <script id="templateAds" type="text/html">
  395.          <div class="col-md-12">
  396.              <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]]');">
  397.                  <div class="card-category" style="text-shadow: 1px 1px 2px #7f3e98, 0 0 1em #7f3e98, 0 0 0.2em #7f3e98;">[[title]]</div>
  398.                  <div class="card-description">
  399.                      <p style="text-shadow: 1px 1px 2px #7f3e98, 0 0 1em #7f3e98, 0 0 0.2em #7f3e98;">[[content]]</p>
  400.                  </div>
  401.                  <a target="_blank" class="card-link" href="[[link]]" ></a>
  402.              </div>
  403.          </div>
  404.      </script>
  405.      <script src="{{ asset('assets/plugins/custom/ckeditor/ckeditor-classic.bundle.js') }}"></script>
  406.      <script>
  407.          $('.toggle3').click(function(){
  408.              $('.nav-blog').toggleClass("justify-content-end");
  409.              $('.toggle3').toggleClass("text-light");
  410.          });
  411.          $.ajax({
  412.              url: "{{ path('list_ads_json',{'limit':10,'offset':0}) }}"+'?lang='+getCookie('lang'),
  413.              type: 'GET',
  414.              dataType: 'json',
  415.              success: function(res){
  416.                  let templateRep = document.getElementById("templateAds");
  417.                  let templateRepHtml = templateRep.innerHTML;
  418.                  let listHtml = "";
  419.                  res.data.forEach(function (e){
  420.                      let link = "{{ path('display_ads',{'slug':'0000'}) }}";
  421.                      link = link.replace('0000',e.slug)
  422.                      listHtml += templateRepHtml
  423.                          .replace("[[image]]",e.image)
  424.                          .replace("[[link]]",link)
  425.                          .replace("[[title]]",e.title)
  426.                          .replace("[[content]]",e.description);
  427.                  });
  428.                  $('#ads_list').html(listHtml);
  429.              },
  430.              error :function (error) {
  431.                  console.log(error);
  432.              }
  433.          });
  434.      </script>
  435.  {% endblock %}