2022-09-13 13:14:49 +00:00
|
|
|
{% macro navigation(links, current, top, fmt, align) %}
|
|
|
|
{% set top = top|default(false) == true %}
|
|
|
|
{% set align = align|default('centre') %}
|
|
|
|
{% set current = current|default(null) %}
|
|
|
|
{% set fmt = fmt|default('%s') %}
|
|
|
|
|
|
|
|
<ul class="navigation{% if top %} navigation--top{% endif %}{% if align != 'centre' %} navigation--{{ align }}{% endif %}">
|
|
|
|
{% for name, url in links %}
|
|
|
|
<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>
|
|
|
|
{% endfor %}
|
|
|
|
</ul>
|
|
|
|
{% endmacro %}
|
|
|
|
|
2023-09-08 20:40:48 +00:00
|
|
|
{% macro pagination(info, name, params, range) %}
|
2022-09-13 13:14:49 +00: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) %}
|
2022-09-13 13:14:49 +00:00
|
|
|
|
|
|
|
<div class="pagination">
|
|
|
|
<div class="pagination__section pagination__section--first">
|
|
|
|
{% if info.page <= 1 %}
|
|
|
|
<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">
|
2022-09-13 13:14:49 +00:00
|
|
|
<i class="fas fa-angle-double-left"></i>
|
|
|
|
</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">
|
2022-09-13 13:14:49 +00:00
|
|
|
<i class="fas fa-angle-left"></i>
|
|
|
|
</a>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<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) %}
|
2022-09-13 13:14:49 +00: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' : '' }}">
|
2022-09-13 13:14:49 +00:00
|
|
|
{{ i }}
|
|
|
|
</a>
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="pagination__section pagination__section--last">
|
|
|
|
{% if info.page >= info.pages %}
|
|
|
|
<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">
|
2022-09-13 13:14:49 +00:00
|
|
|
<i class="fas fa-angle-right"></i>
|
|
|
|
</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">
|
2022-09-13 13:14:49 +00:00
|
|
|
<i class="fas fa-angle-double-right"></i>
|
|
|
|
</a>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
{% endmacro %}
|
|
|
|
|
|
|
|
{% macro container_title(title, unsafe, url) %}
|
|
|
|
{% 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">
|
|
|
|
{% if unsafe %}
|
|
|
|
{{ title }}
|
|
|
|
{% else %}
|
|
|
|
{{ title|raw }}
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
{% if has_url %}</a>{% endif %}
|
|
|
|
</div>
|
|
|
|
{% endmacro %}
|
|
|
|
|
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-17 14:37:39 +00:00
|
|
|
{% endif %}>
|
2023-01-03 00:10:28 +00:00
|
|
|
{% endapply %}
|
2022-09-13 13:14:49 +00:00
|
|
|
{% endmacro %}
|