2018-05-18 03:20:27 +02:00
|
|
|
{% macro navigation(links, current, top, fmt, align) %}
|
2018-03-22 02:56:41 +00:00
|
|
|
{% set top = top|default(false) == true %}
|
2018-05-18 03:20:27 +02:00
|
|
|
{% set align = align|default('centre') %}
|
2018-03-22 02:56:41 +00:00
|
|
|
{% set current = current|default(null) %}
|
2018-03-23 01:01:42 +01:00
|
|
|
{% set fmt = fmt|default('%s') %}
|
2018-03-22 02:56:41 +00:00
|
|
|
|
2018-05-18 03:20:27 +02:00
|
|
|
<ul class="navigation{% if top %} navigation--top{% endif %}{% if align != 'centre' %} navigation--{{ align }}{% endif %}">
|
2018-03-22 02:56:41 +00:00
|
|
|
{% for name, url in links %}
|
2018-04-16 02:33:54 +02:00
|
|
|
<li class="navigation__option{% if url == current or name == current %} navigation__option--selected{% endif %}"><a href="{{ fmt|format(url) }}" class="navigation__link">{{ name }}</a></li>
|
2018-03-22 02:56:41 +00:00
|
|
|
{% endfor %}
|
|
|
|
</ul>
|
|
|
|
{% endmacro %}
|
2018-04-16 02:33:54 +02:00
|
|
|
|
2023-09-08 20:40:48 +00:00
|
|
|
{% macro pagination(info, name, params, range) %}
|
2019-01-03 01:33:02 +01:00
|
|
|
{% if info.page is defined and info.pages > 1 %}
|
2023-09-08 20:40:48 +00:00
|
|
|
{% set params = params is iterable ? params : {} %}
|
|
|
|
{% set range = range|default(3) %}
|
2018-04-16 02:33:54 +02:00
|
|
|
|
2018-10-25 00:48:07 +02:00
|
|
|
<div class="pagination">
|
|
|
|
<div class="pagination__section pagination__section--first">
|
2019-01-03 01:33:02 +01:00
|
|
|
{% if info.page <= 1 %}
|
2018-10-25 00:48:07 +02:00
|
|
|
<div class="pagination__link pagination__link--first pagination__link--disabled">
|
|
|
|
<i class="fas fa-angle-double-left"></i>
|
|
|
|
</div>
|
|
|
|
<div class="pagination__link pagination__link--prev pagination__link--disabled">
|
|
|
|
<i class="fas fa-angle-left"></i>
|
|
|
|
</div>
|
|
|
|
{% else %}
|
2023-09-08 20:40:48 +00:00
|
|
|
<a href="{{ url(name, params) }}" class="pagination__link pagination__link--first" rel="first">
|
2018-10-25 00:48:07 +02:00
|
|
|
<i class="fas fa-angle-double-left"></i>
|
2018-04-16 02:33:54 +02:00
|
|
|
</a>
|
2023-09-08 20:40:48 +00:00
|
|
|
<a href="{{ url(name, params|merge({'page': info.page - 1})) }}" class="pagination__link pagination__link--prev" rel="prev">
|
2018-10-25 00:48:07 +02:00
|
|
|
<i class="fas fa-angle-left"></i>
|
2018-05-16 22:48:33 +02:00
|
|
|
</a>
|
2018-10-25 00:48:07 +02:00
|
|
|
{% endif %}
|
|
|
|
</div>
|
2018-04-16 02:33:54 +02:00
|
|
|
|
2018-10-25 00:48:07 +02:00
|
|
|
<div class="pagination__section pagination__section--pages">
|
2023-09-08 20:40:48 +00:00
|
|
|
{% set p_start = max(info.page - range, 1) %}
|
|
|
|
{% set p_stop = min(info.page + range, info.pages) %}
|
2018-04-16 02:33:54 +02:00
|
|
|
|
2019-01-03 01:33:02 +01:00
|
|
|
{% for i in p_start..p_stop %}
|
2023-09-08 20:40:48 +00:00
|
|
|
<a href="{{ url(name, params|merge({'page': i})) }}" class="pagination__link{{ info.page == i ? ' pagination__link--current' : '' }}">
|
2019-12-06 02:04:10 +01:00
|
|
|
{{ i }}
|
|
|
|
</a>
|
2018-10-25 00:48:07 +02:00
|
|
|
{% endfor %}
|
|
|
|
</div>
|
2018-04-16 02:33:54 +02:00
|
|
|
|
2018-10-25 00:48:07 +02:00
|
|
|
<div class="pagination__section pagination__section--last">
|
2019-01-03 01:33:02 +01:00
|
|
|
{% if info.page >= info.pages %}
|
2018-10-25 00:48:07 +02:00
|
|
|
<div class="pagination__link pagination__link--next pagination__link--disabled">
|
|
|
|
<i class="fas fa-angle-right"></i>
|
|
|
|
</div>
|
|
|
|
<div class="pagination__link pagination__link--last pagination__link--disabled">
|
|
|
|
<i class="fas fa-angle-double-right"></i>
|
|
|
|
</div>
|
|
|
|
{% else %}
|
2023-09-08 20:40:48 +00:00
|
|
|
<a href="{{ url(name, params|merge({'page': info.page + 1})) }}" class="pagination__link pagination__link--next" rel="next">
|
2018-10-25 00:48:07 +02:00
|
|
|
<i class="fas fa-angle-right"></i>
|
2018-05-16 22:48:33 +02:00
|
|
|
</a>
|
2023-09-08 20:40:48 +00:00
|
|
|
<a href="{{ url(name, params|merge({'page': info.pages})) }}" class="pagination__link pagination__link--last" rel="last">
|
2018-10-25 00:48:07 +02:00
|
|
|
<i class="fas fa-angle-double-right"></i>
|
2018-05-16 22:48:33 +02:00
|
|
|
</a>
|
2018-10-25 00:48:07 +02:00
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
</div>
|
2018-04-16 02:33:54 +02:00
|
|
|
{% endif %}
|
|
|
|
{% endmacro %}
|
2018-10-22 21:53:21 +02:00
|
|
|
|
2018-12-27 03:59:57 +01:00
|
|
|
{% macro container_title(title, unsafe, url) %}
|
2018-10-22 21:53:21 +02:00
|
|
|
{% set has_url = url is not null and url|length > 0 %}
|
|
|
|
|
|
|
|
<div class="container__title">
|
|
|
|
<div class="container__title__background"></div>
|
|
|
|
{% if has_url %}<a href="{{ url }}" class="container__title__link">{% endif %}
|
|
|
|
<div class="container__title__text">
|
2018-12-27 03:59:57 +01:00
|
|
|
{% if unsafe %}
|
2018-10-28 00:01:01 +02:00
|
|
|
{{ title }}
|
2018-12-27 03:59:57 +01:00
|
|
|
{% else %}
|
|
|
|
{{ title|raw }}
|
2018-10-28 00:01:01 +02:00
|
|
|
{% endif %}
|
2018-10-22 21:53:21 +02:00
|
|
|
</div>
|
|
|
|
{% if has_url %}</a>{% endif %}
|
|
|
|
</div>
|
|
|
|
{% endmacro %}
|
2019-09-28 18:56:46 +02:00
|
|
|
|
2023-01-03 00:10:28 +00:00
|
|
|
{% macro avatar(user_id, resolution, alt_text, attrs) %}
|
|
|
|
{% apply spaceless %}
|
|
|
|
<img src="{{ url('user-avatar', { 'user': user_id, 'res': resolution * 2 }) }}"
|
|
|
|
alt="{{ alt_text|default('') }}"
|
|
|
|
width="{{ attrs.width|default(resolution) }}"
|
|
|
|
height="{{ attrs.height|default(resolution) }}"
|
|
|
|
class="avatar{% if attrs.class is defined %} {{ attrs.class }}{% endif %}"
|
|
|
|
{% if attrs.id is defined %}
|
|
|
|
id="{{ attrs.id }}"
|
2023-07-15 23:58:17 +00:00
|
|
|
{% endif %}>
|
2023-01-03 00:10:28 +00:00
|
|
|
{% endapply %}
|
2019-09-28 18:56:46 +02:00
|
|
|
{% endmacro %}
|