src/Notaris/FrontendBundle/Resources/views/news/index.html.twig line 1

Open in your IDE?
  1. {% extends '@NotarisFrontend/layout2017.html.twig' %}
  2. {% if notaryId is defined %}
  3.     {% set headTitle = info.header1  | replace({"<BR />":" "}) ~ ' - ' ~  subsite.pageTitle %}
  4. {% else %}
  5.     {% set headTitle = subsite.pageTitle %}
  6.     {#{% if subsite.slug != 'nieuws-pers' and subsite.slug != 'nouveautes' %}#}
  7.     {% set headTitle = headTitle ~ " | " ~  'nw_header_news' | trans %}
  8.     {#{% endif %}#}
  9.     {% set headTitle = headTitle ~ ' ' ~ 'alg_basetitle' | trans %}
  10. {% endif %}
  11. {% block title %}
  12.         <title>{{ headTitle }}</title>
  13. {% endblock %}
  14. {% if subsite.slug == 'nieuws-pers' or subsite.slug == 'nouveautes' %}
  15.     {% set canonicallink = url_scheme ~ '://www.' ~ _context['url_' ~ locale] ~ path('notaris_frontend_news', {_locale: locale}) %}
  16. {% else %}
  17.     {% set canonicallink = url_scheme ~ '://www.' ~ _context['url_' ~ locale] ~ path('notaris_frontend_subsite_news', {_locale: locale, subsiteslug: subsite.slug}) %}
  18. {% endif %}
  19. {% set linked_url_nl = url_nl ~ path('notaris_frontend_news.nl') %}
  20. {% set linked_url_fr = url_fr ~ path('notaris_frontend_news.fr') %}
  21. {% block extralinks %}
  22.     {% if subsite.slug == 'nieuws-pers' or subsite.slug == 'nouveautes' %}  {#for subsites i need to know the translation slug, no connection in database #}
  23.         {% set hreflang_start_nl = url_scheme ~ '://www.' ~ url_nl %}
  24.         {% set hreflang_start_x = url_scheme ~ '://www.' ~ url_nl %}
  25.         {% set hreflang_start_fr = url_scheme ~ '://www.' ~ url_fr %}
  26.         {% set xdef_lang = 'nl' %}
  27.         {% set hreflang_nl = hreflang_start_nl ~ path('notaris_frontend_news', {_locale: 'nl'}) %}
  28.         {% set hreflang_fr = hreflang_start_fr ~ path('notaris_frontend_news', {_locale: 'fr'}) %}
  29.         <link rel="alternate" hreflang="nl-be"
  30.               href="{{ hreflang_nl }}" />
  31.         <link rel="alternate" hreflang="fr-be"
  32.               href="{{ hreflang_fr }}" />
  33.         {% if notaryId is defined %}
  34.             {% if sites | length > 0 %}
  35.                 {% for key, site in sites %}
  36.                     {% if key == 'nl' %}
  37.                         {% set hreflang_start_nl = scheme_url ~ '://' ~ site %}
  38.                     {% endif %}
  39.                     {% if key == 'fr' %}
  40.                         {% set hreflang_start_fr = scheme_url ~ '://' ~ site %}
  41.                     {% endif %}
  42.                 {% endfor %}
  43.                 {% set hreflang_start_x = scheme_url ~ '://' ~ sites[notaryId.locale] %}
  44.                 {% set xdef_lang = notaryId.locale %}
  45.             {% endif %}
  46.             {% set hreflang_nl = hreflang_start_nl ~ path('notaris_frontend_news', {_locale: 'nl'}) %}
  47.             {% set hreflang_fr = hreflang_start_fr ~ path('notaris_frontend_news', {_locale: 'fr'}) %}
  48.             <link rel="alternate" hreflang="nl"
  49.                   href="{{ hreflang_nl }}" />
  50.             <link rel="alternate" hreflang="fr"
  51.                   href="{{ hreflang_fr }}" />
  52.         {% endif %}
  53.         {% set hreflang_x = hreflang_start_x ~ path('notaris_frontend_news', {_locale: xdef_lang}) %}
  54.         {#{% if ordertype != '' and currentpage == 0 %}#}
  55.             {#{% set hreflang_nl = hreflang_start_nl ~ path('notaris_frontend_news_order', {locale: 'nl', otype: ordertype}) %}#}
  56.             {#{% set hreflang_fr = hreflang_start_fr ~  path('notaris_frontend_news_order', {locale: 'fr', otype: ordertype}) %}#}
  57.             {#{% set hreflang_x = hreflang_start_x ~  path('notaris_frontend_news_order', {locale: xdef_lang, otype: ordertype}) %}#}
  58.         {#{% endif %}#}
  59.         {#{% if ordertype == '' and currentpage != 0 %}#}
  60.             {#{% set hreflang_nl = hreflang_start_nl ~ path('notaris_frontend_news_page', {locale: 'nl', page: currentpage}) %}#}
  61.             {#{% set hreflang_fr = hreflang_start_fr ~ path('notaris_frontend_news_page', {locale: 'fr', page: currentpage}) %}#}
  62.             {#{% set hreflang_x = hreflang_start_x ~  path('notaris_frontend_news_page', {locale: xdef_lang, page: currentpage}) %}#}
  63.         {#{% endif %}#}
  64.         {#{% if ordertype != '' and currentpage != 0 %}#}
  65.             {#{% set hreflang_nl = hreflang_start_nl ~ path('notaris_frontend_news_page_order', {locale: 'nl', page: currentpage, otype: ordertype}) %}#}
  66.             {#{% set hreflang_fr = hreflang_start_fr ~ path('notaris_frontend_news_page_order', {locale: 'fr', page: currentpage, otype: ordertype}) %}#}
  67.             {#{% set hreflang_x = hreflang_start_x ~  path('notaris_frontend_news_page_order', {locale: xdef_lang, page: currentpage, otype: ordertype}) %}#}
  68.         {#{% endif %}#}
  69.         <link rel="alternate" hreflang="x-default"
  70.               href="{{ hreflang_x }}" />
  71.     {% endif %}
  72.     <link rel="canonical" href="{{ canonicallink }}"  />
  73. {% endblock %}
  74. {% block extrameta %}
  75.     {{ parent() }}
  76.     <meta name="keywords" content="{{ subsite.meta.metaKeywords }}"/>
  77.     <meta name="description" lang="{{ locale }}" content="{{ subsite.meta.metaDescription }}"/>
  78.     <meta property="og:type" content="website" />
  79.     <meta property="og:url" content="{{ canonicallink }}" />
  80.     {#{% if subsite.meta.ogTitle != '' %}#}
  81.         {#<meta property="og:title" content="{{ subsite.meta.ogTitle }}" />#}
  82.     {#{% endif %}#}
  83.     <meta property="og:title" content="{{ headTitle }}" />
  84.     {% if subsite.slug == 'nieuws-pers' or subsite.slug == 'nouveautes' %}
  85.         {% if section.meta.ogDescription != '' %}
  86.             <meta property="og:description" content="{{ section.meta.ogDescription }}" />
  87.         {% endif %}
  88.     {% else %}
  89.         {% if subsite.meta.ogDescription != '' %}
  90.             <meta property="og:description" content="{{ subsite.meta.ogDescription }}" />
  91.         {% endif %}
  92.     {% endif %}
  93. {% endblock %}
  94. {% block body %}
  95.     {% if ordertype == '' %}
  96.         {% set ordertype = 'desc' %}
  97.     {% endif %}
  98.     <section class="content u-padding-top-large">
  99.         {% set isPreview = false %}
  100.         {% if preview is defined %}
  101.             {% set isPreview = true %}
  102.         {% endif %}
  103.         {% if isPreview %}
  104.             <div id="preview-label">PREVIEW</div>
  105.         {% endif %}
  106.         {{ include('@NotarisFrontend/module/sidenav.html.twig', {'subsite': subsite, 'preview': isPreview }) }}
  107.         <!-- news -->
  108.         <div id="content-center" class="content-center-large {{ subsite.stylesheet }}">
  109.             <div id="content-center-header">
  110.                 <article class="niveau3 fillcolor">
  111.                     <div class="article-content">
  112.                         <p>{{ totalnews }} {{ 'nw_bericht' | trans | raw }}{% if totalnews > 1 %}{{ 'nw_berichten_meervoud' | trans | raw }}{% endif %}, {{ 'nw_ordering' | trans | raw }}<br />
  113.                             {% if ordertype == 'desc' %}
  114.                                 {% if subsiteslug != '' %}
  115.                                     {{ 'nw_van' | trans | raw }} {{ 'nw_nieuw' | trans | raw }} &gt; {{ 'nw_oud' | trans | raw }} | <a href="{{ path('notaris_frontend_subsite_news_order', {'otype': 'asc', 'subsiteslug': subsiteslug}) }}">{{ 'nw_oud' | trans | raw }} &gt; {{ 'nw_nieuw' | trans | raw }}</a>
  116.                                 {% else %}
  117.                                     {{ 'nw_van' | trans | raw }} {{ 'nw_nieuw' | trans | raw }} &gt; {{ 'nw_oud' | trans | raw }} | <a href="{{ path('notaris_frontend_news_order', {'otype': 'asc'}) }}">{{ 'nw_oud' | trans | raw }} &gt; {{ 'nw_nieuw' | trans | raw }}</a>
  118.                                 {% endif %}
  119.                             {% else %}
  120.                                 {% if subsiteslug != '' %}
  121.                                     <a href="{{ path('notaris_frontend_subsite_news_order', {'otype': 'desc', 'subsiteslug': subsiteslug}) }}">{{ 'nw_van' | trans | raw }} {{ 'nw_nieuw' | trans | raw }} &gt; {{ 'nw_oud' | trans | raw }}</a> | {{ 'nw_oud' | trans | raw }} &gt; {{ 'nw_nieuw' | trans | raw }}
  122.                                 {% else %}
  123.                                     <a href="{{ path('notaris_frontend_news_order', {'otype': 'desc'}) }}">{{ 'nw_van' | trans | raw }} {{ 'nw_nieuw' | trans | raw }} &gt; {{ 'nw_oud' | trans | raw }}</a> | {{ 'nw_oud' | trans | raw }} &gt; {{ 'nw_nieuw' | trans | raw }}
  124.                                 {% endif %}
  125.                             {% endif %}
  126.                     </div>
  127.                 </article>
  128.             </div>
  129.             {% if totalpages > 1 %}
  130.                 <div class="prevnext-pages border-bottom">
  131.                     {% if currentpage + 1 != 1 %}
  132.                         {% if currentpage  == 1 %}
  133.                             {% if subsiteslug != '' %}
  134.                                 <a href="{{ path('notaris_frontend_subsite_news_order', {'otype': ordertype, 'subsiteslug': subsiteslug}) }}">{{ 'vorige' | trans | raw }}</a>
  135.                             {% else %}
  136.                                 <a href="{{ path('notaris_frontend_news_order', {'otype': ordertype}) }}">{{ 'vorige' | trans | raw }}</a>
  137.                             {% endif %}
  138.                         {% else %}
  139.                             {% if subsiteslug != '' %}
  140.                                 <a href="{{ path('notaris_frontend_subsite_news_page_order', {'page': currentpage - 1, 'otype': ordertype, 'subsiteslug': subsiteslug}) }}">{{ 'vorige' | trans | raw }}</a>
  141.                             {% else %}
  142.                                 <a href="{{ path('notaris_frontend_news_page_order', {'page': currentpage - 1, 'otype': ordertype, 'subsiteslug': subsiteslug}) }}">{{ 'vorige' | trans | raw }}</a>
  143.                             {% endif %}
  144.                         {% endif %}
  145.                     {% else %}
  146.                         <span>{{ 'vorige' | trans | raw }}</span>
  147.                     {% endif %}
  148.                     {% set count = 0 %}
  149.                     {% set vispages = 4 %}
  150.                     {% set index = 0 %}
  151.                     {% if currentpage + 1 <= 2 %}
  152.                         {% set start = 1 %}
  153.                     {% else %}
  154.                         {% set start = currentpage + 1 - 2 %}
  155.                         {% set vispages = vispages + 1 %}
  156.                     {% endif %}
  157.                     {% if start + 4> totalpages %}
  158.                         {% set start = totalpages - 3  %}
  159.                     {% endif %}
  160.                     {% if start < 1 %}
  161.                         {% set start = 1 %}
  162.                     {% endif %}
  163.                     {% if start != 1 %}
  164.                         <span>...</span>
  165.                     {% endif %}
  166.                     {% for  i in start..totalpages %}
  167.                         {% set count = count + 1 %}
  168.                         {% if count <= vispages %}
  169.                             {% set index = i %}
  170.                             {% if i == currentpage + 1 %}
  171.                                 <span class="current">{{ i }}</span>
  172.                             {% else %}
  173.                                 {% if subsiteslug != '' %}
  174.                                     {% if i == 1 %}
  175.                                         <a href="{{ path('notaris_frontend_subsite_news_order', {'otype': ordertype, 'subsiteslug': subsiteslug}) }}">{{ i }}</a>
  176.                                     {% else %}
  177.                                         <a href="{{ path('notaris_frontend_subsite_news_page_order', {'page': i - 1, 'otype': ordertype, 'subsiteslug': subsiteslug}) }}">{{ i }}</a>
  178.                                     {% endif %}
  179.                                 {% else %}
  180.                                     {% if i == 1 %}
  181.                                         <a href="{{ path('notaris_frontend_news_order', {'otype': ordertype}) }}">{{ i }}</a>
  182.                                     {% else %}
  183.                                         <a href="{{ path('notaris_frontend_news_page_order', {'page': i - 1, 'otype': ordertype}) }}">{{ i }}</a>
  184.                                     {% endif %}
  185.                                 {% endif %}
  186.                             {% endif %}
  187.                         {% endif %}
  188.                     {% endfor %}
  189.                     {% if index != totalpages %}
  190.                         <span>...</span>
  191.                     {% endif %}
  192.                     {% if currentpage + 1 != totalpages %}
  193.                         {% if subsiteslug != '' %}
  194.                             <a href="{{ path('notaris_frontend_subsite_news_page_order', {'page': currentpage + 1, 'otype': ordertype, 'subsiteslug': subsiteslug}) }}">{{ 'volgende' | trans | raw }}</a>
  195.                         {% else %}
  196.                             <a href="{{ path('notaris_frontend_news_page_order', {'page': currentpage + 1, 'otype': ordertype}) }}">{{ 'volgende' | trans | raw }}</a>
  197.                         {% endif %}
  198.                     {% else %}
  199.                         <span>{{ 'volgende' | trans | raw }}</span>
  200.                     {% endif %}
  201.                 </div>
  202.             {% endif %}
  203.             <section class="no-margin o-tabpannel o-tabpannel--neutral">
  204.                 <div id="info-content" class="o-tabpannel__navigation__items">
  205.                     {% for newsitem in news %}
  206.                         {% if subsiteslug == '' %}
  207.                             <a data-slug="{{ newsitem.slug }}" class="o-tabpannel__item u-color-black u-padding-left-small u-padding-right-small js-info-news-content" href="{{ path('notaris_frontend_news_detail', {'slug': newsitem.slug}) }}">
  208.                         {% else %}
  209.                             <a data-slug="{{ newsitem.slug }}" class="o-tabpannel__item u-color-black u-padding-left-small u-padding-right-small js-info-news-content" href="{{ path('notaris_frontend_subsite_news_detail', {'slug': newsitem.slug, 'subsiteslug': subsiteslug }) }}">
  210.                         {% endif %}
  211.                             <h2 class="u-h3 u-margin-none">
  212.                                 {% if newsitem.isPers %}
  213.                                 <div class="c-tooltip c-tooltip--top u-text-inline">
  214.                             <span class="{% if lastPart == subsite.slug %}u-bg-{{ subsite.stylesheet }} {% else %}u-bg-primary {% endif %}u-color-white o-tabpannel__label">{{ 'nw_pm' | trans }}</span>
  215.                                     <p class="c-tooltip__news{% if lastPart == subsite.slug %} u-bg-{{ subsite.stylesheet }}{% endif %}">{{ 'nw_pm_meaning' | trans }}</p>
  216.                                 </div>
  217.                                 {% endif %}
  218.                                 {{ newsitem.title }}
  219.                             </h2>
  220.                                 <p class="u-margin-top-tiny">
  221.                                 {# {% set txt = newsitem.introduction %} #}
  222.                                 {% if newsitem.introduction == '' %}
  223.                                     {% set words = newsitem.text | striptags | split(' ') %}
  224.                                 {% else %}
  225.                                     {% set words = newsitem.introduction | striptags | split(' ') %}
  226.                                 {% endif %}
  227.                                 {{ newsitem.publicationDate | localdate }} -
  228.                                     {% for word in words|slice(0, 22) %}
  229.                                         {% if loop.last and words|length > 22 %}
  230.                                             {{ word | replace({'.':''}) | raw }}...
  231.                                         {% else %}
  232.                                             {{ word | raw }}
  233.                                         {% endif %}
  234.                                     {% endfor %}
  235.                                 </p>
  236.                         </a>
  237.                     {% endfor %}
  238.                 </div>
  239.             </section>
  240.             {% if totalpages > 1 %}
  241.                 <div class="prevnext-pages">
  242.                     {% if currentpage + 1 != 1 %}
  243.                         {% if currentpage  == 1 %}
  244.                             {% if subsiteslug != '' %}
  245.                                 <a href="{{ path('notaris_frontend_subsite_news_order', {'otype': ordertype, 'subsiteslug': subsiteslug}) }}">{{ 'vorige' | trans | raw }}</a>
  246.                             {% else %}
  247.                                 <a href="{{ path('notaris_frontend_news_order', {'otype': ordertype}) }}">{{ 'vorige' | trans | raw }}</a>
  248.                             {% endif %}
  249.                         {% else %}
  250.                             {% if subsiteslug != '' %}
  251.                                 <a href="{{ path('notaris_frontend_subsite_news_page_order', {'page': currentpage - 1, 'otype': ordertype, 'subsiteslug': subsiteslug}) }}">{{ 'vorige' | trans | raw }}</a>
  252.                             {% else %}
  253.                                 <a href="{{ path('notaris_frontend_news_page_order', {'page': currentpage - 1, 'otype': ordertype, 'subsiteslug': subsiteslug}) }}">{{ 'vorige' | trans | raw }}</a>
  254.                             {% endif %}
  255.                         {% endif %}
  256.                     {% else %}
  257.                         <span>{{ 'vorige' | trans | raw }}</span>
  258.                     {% endif %}
  259.                     {% set count = 0 %}
  260.                     {% set vispages = 4 %}
  261.                     {% set index = 0 %}
  262.                     {% if currentpage + 1 <= 2 %}
  263.                         {% set start = 1 %}
  264.                     {% else %}
  265.                         {% set start = currentpage + 1 - 2 %}
  266.                         {% set vispages = vispages + 1 %}
  267.                     {% endif %}
  268.                     {% if start + 4> totalpages %}
  269.                         {% set start = totalpages - 3  %}
  270.                     {% endif %}
  271.                     {% if start < 1 %}
  272.                         {% set start = 1 %}
  273.                     {% endif %}
  274.                     {% if start != 1 %}
  275.                         <span>...</span>
  276.                     {% endif %}
  277.                     {% for  i in start..totalpages %}
  278.                         {% set count = count + 1 %}
  279.                         {% if count <= vispages %}
  280.                             {% set index = i %}
  281.                             {% if i == currentpage + 1 %}
  282.                                 <span class="current">{{ i }}</span>
  283.                             {% else %}
  284.                                 {% if subsiteslug != '' %}
  285.                                     {% if i == 1 %}
  286.                                         <a href="{{ path('notaris_frontend_subsite_news_order', {'otype': ordertype, 'subsiteslug': subsiteslug}) }}">{{ i }}</a>
  287.                                     {% else %}
  288.                                         <a href="{{ path('notaris_frontend_subsite_news_page_order', {'page': i - 1, 'otype': ordertype, 'subsiteslug': subsiteslug}) }}">{{ i }}</a>
  289.                                     {% endif %}
  290.                                 {% else %}
  291.                                     {% if i == 1 %}
  292.                                         <a href="{{ path('notaris_frontend_news_order', {'otype': ordertype}) }}">{{ i }}</a>
  293.                                     {% else %}
  294.                                         <a href="{{ path('notaris_frontend_news_page_order', {'page': i - 1, 'otype': ordertype}) }}">{{ i }}</a>
  295.                                     {% endif %}
  296.                                 {% endif %}
  297.                             {% endif %}
  298.                         {% endif %}
  299.                     {% endfor %}
  300.                     {% if index != totalpages %}
  301.                         <span>...</span>
  302.                     {% endif %}
  303.                     {% if currentpage + 1 != totalpages %}
  304.                         {% if subsiteslug != '' %}
  305.                             <a href="{{ path('notaris_frontend_subsite_news_page_order', {'page': currentpage + 1, 'otype': ordertype, 'subsiteslug': subsiteslug}) }}">{{ 'volgende' | trans | raw }}</a>
  306.                         {% else %}
  307.                             <a href="{{ path('notaris_frontend_news_page_order', {'page': currentpage + 1, 'otype': ordertype}) }}">{{ 'volgende' | trans | raw }}</a>
  308.                         {% endif %}
  309.                     {% else %}
  310.                         <span>{{ 'volgende' | trans | raw }}</span>
  311.                     {% endif %}
  312.                 </div>
  313.             {% endif %}
  314.         </div>
  315.         {% include '@NotarisFrontend/navigation/mobilesubnav.html.twig' with {'websiteSlug': subsite.slug, 'isSven':false, 'isHome':false, 'subsite': subsite} %}
  316.     </section>
  317. {% endblock %}
  318. {% block extrajs %}
  319.     <script>
  320.         //adresbook();
  321.         $(document).ready(function(){
  322.             $('.js-info-news-content').click(function(e){
  323.                 e.preventDefault();
  324.                 var href = $(this).attr('href');
  325.                 var slug = $(this).attr('data-slug');
  326.                 $.getJSON('{{ path('notaris_frontend_news_clicked') }}/' + slug, function(result){
  327.                     window.location.href = href;
  328.                 });
  329.             });
  330.         });
  331.     </script>
  332. {% endblock %}