fix pagination and header links

This commit is contained in:
msquare 2021-12-26 17:40:13 +01:00
parent 8d405b8b7c
commit e0c89e0ffe
3 changed files with 19 additions and 6 deletions

View File

@ -25,7 +25,7 @@
<ul class="navbar-nav mb-2 mb-lg-0">
{% for text,link in config('header_items', {}) %}
<li class="nav-item">
<a href="{{ link|replace({'%lang%': session_get('locale')|split('_')[0]})|escape('html_attr') }}">
<a class="nav-link" href="{{ link|replace({'%lang%': session_get('locale')|split('_')[0]})|escape('html_attr') }}">
{{ text }}
</a>
</li>

View File

@ -291,8 +291,21 @@
<code>3.1415926535897932384626433832795</code>
</p>
</div>
<div class="col">
<h4>Pagination</h4>
<ul class="pagination">
<li class="page-item active">
<a class="page-link" href="#">1</a>
</li>
<li class="page-item">
<a class="page-link" href="#">2</a>
</li>
<li class="page-item">
<a class="page-link" href="#">3</a>
</li>
</ul>
</div>
</div>
<h2>Macros</h2>
<h3>base.twig</h3>

View File

@ -29,11 +29,11 @@
{% block pagination %}
{% if pages|default(0) > 1 %}
<div class="col-md-12 text-center">
<ul class="pagination">
<div class="col-md-12">
<ul class="pagination justify-content-center">
{% for p in range(1, pages) %}
<li{% if p == page %} class="active"{% endif %}>
<a href="{{ url('news', p == 1 ? {} : {'page': p}) }}">{{ p }}</a>
<li class="page-item{% if p == page %} active{% endif %}">
<a class="page-link" href="{{ url('news', p == 1 ? {} : {'page': p}) }}">{{ p }}</a>
</li>
{% endfor %}
</ul>