misuzu/templates/changelog/index.twig

43 lines
1.6 KiB
Twig

{% extends 'changelog/master.twig' %}
{% from 'macros.twig' import pagination, container_title %}
{% from 'changelog/macros.twig' import changelog_listing %}
{% from '_layout/comments.twig' import comments_section %}
{% set is_valid = changes|length > 0 %}
{% set is_date = changelog_date|length > 0 %}
{% set title = 'Changelog' %}
{% if is_valid %}
{%
set canonical_url = url_construct(url('changelog-index'), {
'd': changelog_date,
'u': changelog_user|default(0),
'p': changelog_pagination.page|default(0) > 1 ? changelog_pagination.page : 0,
})
%}
{% if is_date or changelog_user %}
{% set title = title ~ ' »' ~ (changelog_date ? ' ' ~ changes[0].change_date : '') ~ (changelog_user ? ' by ' ~ changes[0].username : '') %}
{% endif %}
{% endif %}
{% block content %}
<div class="container changelog__container">
{{ container_title('<i class="fas fa-wrench fa-fw"></i> ' ~ title) }}
{{ changelog_listing(changes, is_date) }}
{% if not is_date %}
<div class="changelog__pagination">
{{ pagination(changelog_pagination, url('changelog-index'), null, {'d':changelog_date, 'u':changelog_user|default(0)})}}
</div>
{% endif %}
</div>
{% if comments is defined %}
<div class="container">
{{ container_title('<i class="fas fa-comments fa-fw"></i> Comments') }}
{{ comments_section(comments, comments_category, current_user|default(null), comments_perms) }}
</div>
{% endif %}
{% endblock %}