33 lines
1.5 KiB
Twig
33 lines
1.5 KiB
Twig
{% 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 %}
|
|
|
|
{% 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 %}
|
|
|
|
{% macro avatar(user_id, resolution, alt_text, attributes) %}
|
|
<img src="{{ url('user-avatar', {'user': user_id|default(0), 'res': resolution|default(0) * 2}) }}" alt="{{ alt_text|default('') }}" class="{{ ('avatar ' ~ attributes.class|default(''))|trim }}"{% if resolution > 0 %} width="{{ resolution }}" height="{{ resolution }}"{% endif %}/>
|
|
{% endmacro %}
|