{% extends 'foundation/front/front.html.twig' %}
{% block body_class %}{% endblock %}
{% block javascripts %}
{{ parent() }}
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [
{
"@type": "ListItem",
"position": 1,
"item": {
"@id": "{{ url('app_home') }}",
"name": "{{ 'home'|trans }}"
}
},
{
"@type": "ListItem",
"position": 2,
"item": {
"@id": "{{ url('app_accomplishments_all') }}",
"name": "{{ 'achievements'|trans }}"
}
},
{% if subCategory is defined and subCategory is not null and subCategory.category is defined and subCategory.category is not null %}
{% if subCategory.category.i18ns is defined and subCategory.category.i18ns is not empty %}
{% set localeCode = subCategory.category.i18ns[0].locale|split('_')|first %}
{% set i18nCategoryJson = (app.request.locale == localeCode and subCategory.category.i18ns[0] is defined)
? subCategory.category.i18ns[0]
: (subCategory.category.i18ns[1] is defined ? subCategory.category.i18ns[1] : null) %}
{% if i18nCategoryJson %}
{
"@type": "ListItem",
"position": 3,
"item": {
"@id": "{{ url('app_accomplishments_all') }}",
"name": "{{ i18nCategoryJson.name }}"
}
},
{% endif %}
{% endif %}
{% endif %}
{% if subCategory.i18ns is defined and subCategory.i18ns|length > 0 %}
{% set firstI18nSubCategoryJson = subCategory.i18ns|first %}
{% set localeCode = firstI18nSubCategoryJson.locale|split('_')|first %}
{% set i18nSubCategoryJson = (app.request.locale == localeCode) ? firstI18nSubCategoryJson : (subCategory.i18ns[1] is defined ? subCategory.i18ns[1] : null) %}
{% if i18nSubCategoryJson %}
{
"@type": "ListItem",
"position": {% if subCategory.category.i18ns is defined and subCategory.category.i18ns is not empty %}4{% else %}3{% endif %},
"item": {
"@id": "{{ url('app_accomplishments_sub_category_list',{'id':subCategory.id,'slug':i18nSubCategoryJson.slug}) }}",
"name": "{{ i18nSubCategoryJson.name }}"
}
}
{% endif %}
{% endif %}
]
}
</script>
{% endblock %}
{% block front %}
<main class="m_site-main m_position-relative">
<div class="m_breadcumbs">
<div class="m_container-lg">
<ul class="m_nav-breadcrumb">
<li itemscope itemtype="https://schema.org/ListItem" itemprop="itemListElement">
<a itemprop="item" href="{{ path('app_home') }}">
<i class="fa fa-home"></i>
<meta itemprop="name" content="{{ 'home'|trans }}">
</a>
<meta itemprop="position" content="1">
</li>
<li itemscope itemtype="https://schema.org/ListItem" itemprop="itemListElement">
<a itemprop="item" href="{{ path('app_accomplishments_all') }}">
{{ 'achievements'|trans }}
<meta itemprop="name" content="{{ 'achievements'|trans }}">
</a>
<meta itemprop="position" content="2">
</li>
{% if subCategory is defined and subCategory is not null and subCategory.category is defined and subCategory.category is not null %}
{% if subCategory.category.i18ns is defined and subCategory.category.i18ns is not empty %}
{% set localeCode = subCategory.category.i18ns[0].locale|split('_')|first %}
{% set i18nCategory = (app.request.locale == localeCode and subCategory.category.i18ns[0] is defined)
? subCategory.category.i18ns[0]
: (subCategory.category.i18ns[1] is defined ? subCategory.category.i18ns[1] : null) %}
{% if i18nCategory %}
<li itemscope itemtype="https://schema.org/ListItem" itemprop="itemListElement">
<a itemprop="item"
href="{{ path('app_accomplishments_all') ~ '?tab=m_cat-' ~ subCategory.category.id }}">
<span>{{ i18nCategory.name }}</span>
<meta itemprop="name" content="{{ i18nCategory.name }}">
</a>
<meta itemprop="position" content="3">
</li>
{% endif %}
{% endif %}
{% endif %}
{% if subCategory.i18ns is defined and subCategory.i18ns|length > 0 %}
{% set firstI18nSubCategory = subCategory.i18ns|first %}
{% set localeCode = firstI18nSubCategory.locale|split('_')|first %}
{% set i18nSubCategory = (app.request.locale == localeCode) ? firstI18nSubCategory : (subCategory.i18ns[1] is defined ? subCategory.i18ns[1] : null) %}
{% if i18nSubCategory %}
<li itemscope itemtype="https://schema.org/ListItem" itemprop="itemListElement">
<a itemprop="item"
href="{{ path('app_accomplishments_sub_category_list',{'id':subCategory.id,'slug':i18nSubCategory.slug}) }}">
<span>{{ i18nSubCategory.name }}</span>
<meta itemprop="name" content="{{ i18nSubCategory.name }}">
</a>
{% set position = 3 %}
{% if subCategory.category.i18ns is defined and subCategory.category.i18ns is not empty %}
{% set position = 4 %}
{% endif %}
<meta itemprop="position" content="{{ position }}">
</li>
{% endif %}
{% endif %}
</ul>
</div>
</div>
<section class="m_section-banner m_section-page">
<div class="m_section-banner-container m_position-relative">
<div class="m_banner-bg"
style="background-image: url('{% if subCategory is defined and subCategory.thumbnail is defined and subCategory.thumbnail.filename is defined %}
{{ path('proxy_avatar', {'path': subCategory.thumbnail.filename}) }}
{% endif %}');">
</div>
<div class="m_container-lg m_position-relative">
<div class="m_section-banner-desc">
<h1>
{% if subCategory is defined and subCategory.category is defined and subCategory.category.i18ns is defined %}
{% set localeCode = subCategory.category.i18ns[0].locale|split('_')|first %}
{% set i18nCategory = (app.request.locale == localeCode and subCategory.category.i18ns[0] is defined)
? subCategory.category.i18ns[0]
: (subCategory.category.i18ns[1] is defined ? subCategory.category.i18ns[1] : null) %}
{% if i18nCategory %}
<span class="m_category-name">{{ i18nCategory.name }}</span>
{% endif %}
{% endif %}
{% if subCategory is defined and subCategory.i18ns is defined %}
{% set locale = subCategory.i18ns[0].locale|split('_')|first %}
{% set i18nSubCategory = (app.request.locale == locale and subCategory.i18ns[0] is defined)
? subCategory.i18ns[0]
: (subCategory.i18ns[1] is defined ? subCategory.i18ns[1] : null) %}
{% if i18nSubCategory %}
<span>{{ i18nSubCategory.name }}</span>
{% endif %}
{% endif %}
</h1>
</div>
</div>
</div>
</section>
<section class="m_section-page">
<div class="m_container-lg">
<div class="m_listing-posts m_flex">
{% if accomplishments is defined and accomplishments is not empty %}
{% for elt in accomplishments %}
{% if elt.i18ns is defined and elt.i18ns is not empty %}
{% set locale = elt.i18ns[0].locale|split('_')|first %}
{% set i18n = (app.request.locale == locale and elt.i18ns[0] is defined)
? elt.i18ns[0]
: (elt.i18ns[1] is defined ? elt.i18ns[1] : null) %}
{% if i18n %}
<article class="m_item-post">
<div class="m_item-post-container m_position-relative">
<div class="m_item-post-thumb">
{% if elt.attachments is defined and elt.attachments|length > 0 and elt.attachments[0].filename is defined %}
<img alt=""
src="{{ path('proxy_avatar', {'path': elt.attachments[0].filename}) }}"/>
{% else %}
<img alt="" src="{{ asset('images/defaults/media.png') }}"/>
{% endif %}
</div>
<div class="m_item-post-content">
<h2 class="">{{ i18n.name|striptags|u.truncate(90, '...') }}</h2>
<div class="m_item-post-excerpt">
<p>
{{ i18n.description|striptags|u.truncate(90, '...')|raw }}
</p>
</div>
<a href="{{ path('app_accomplishments_detail',{'id': elt.id,'slug':i18n.slug,'subCategoryId':subCategory.id}) }}"
class="m_link-blue-underline">{{ 'detail'|trans }}</a>
</div>
<a class="m_link-overlay"
href="{{ path('app_accomplishments_detail', {'id': elt.id, 'slug':i18n.slug,'subCategoryId':subCategory.id}) }}"
title=""></a>
</div>
</article>
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
</div>
<nav class="m_pagination">
{% if totalItems > 1 %}
<div class="pagination">
{# Bouton "Précédent" #}
{% if currentPage > 1 %}
<a href="{{ path('app_accomplishments_sub_category_list', {'id': subCategory.id}) }}?page={{ currentPage - 1 }}">
<button class="pagination-btn">◀</button>
</a>
{% else %}
<button class="pagination-btn" disabled>◀</button>
{% endif %}
{# Pages numérotées #}
{% for page in 1..totalPages %}
{% if page == currentPage %}
<a href="{{ path('app_accomplishments_sub_category_list', {'id': subCategory.id}) }}?page={{ page }}">
<button class="pagination-number active">{{ page }}</button>
</a>
{% else %}
<a href="{{ path('app_accomplishments_sub_category_list', {'id': subCategory.id}) }}?page={{ page }}">
<button class="pagination-number">{{ page }}</button>
</a>
{% endif %}
{% endfor %}
{# Bouton "Suivant" #}
{% if currentPage < totalPages %}
<a href="{{ path('app_accomplishments_sub_category_list', {'id': subCategory.id}) }}?page={{ currentPage + 1 }}">
<button class="pagination-btn">▶</button>
</a>
{% else %}
<button class="pagination-btn" disabled>▶</button>
{% endif %}
</div>
{% endif %}
</nav>
</div>
</section>
</main>
{% endblock %}