49 lines
1.8 KiB
Twig

{% set taxlist = children_only is defined ? taxonomylist.getChildPagesTags() : taxonomylist.get() %}
{% macro pageLinkName(text) %}{{ text|lower|replace({' ':'_'}) }}{% endmacro %}
{% import _self as macro %}
{% if taxlist %}
<div class="btn-toolbar filters">
<div data-toggle="buttons" class="btn-group">
{% set active = uri.param(taxonomy) == tax? 'active' : '' %}
<label class="{{active}} btn btn-default tous" data-filter="">
{% if page.template == "articles" %}
<a class="{{ active }}" href="{{ page.url }}">Tous</a>
{% else %}
<input type="radio" name="options">
Tous
{% endif %}
</label>
{% for tax,value in taxlist[taxonomy] %}
{% set active = uri.param(taxonomy) == tax? 'active' : '' %}
{% set label_class = uri.param(taxonomy) == tax ? 'label-primary' : 'label-secondary' %}
<label class="{{ active }} btn btn-default {{ macro.pageLinkName(tax) }}" data-filter="{{tax}}">
{% if page.template == "articles" %}
<a class="{{ active }}" href="{{ page.url }}/{{ taxonomy }}{{ config.system.param_sep }}{{ tax }}">{{ tax }}</a>
{% else %}
<input type="radio" name="options" >
{{tax}}
{% endif %}
</label>
{% endfor %}
</div>
{% if page.template == 'archive' %}
<div class="btn-group ">
<label class="btn-default archive">
<a href="/{{page.parent.title|lower}}">{{page.parent.title}}</a>
</label>
</div>
{% elseif page.template == 'calendrier' %}
<div class="btn-group ">
<label class="btn-default archive">
<a href="{{page.url}}/archive">Archive</a>
</label>
</div>
{% endif %}
</div>
{% endif %}