misuzu/templates/changelog/macros.twig
flash 383e2ed0e0 Rewrote the user information class.
This one took multiple days and it pretty invasive into the core of Misuzu so issue might (will) arise, there's also some features that have gone temporarily missing in the mean time and some inefficiencies introduced that will be fixed again at a later time.
The old class isn't gone entirely because I still have to figure out what I'm gonna do about validation, but for the most part this knocks out one of the "layers of backwards compatibility", as I've been referring to it, and is moving us closer to a future where Flashii actually gets real updates.
If you run into anything that's broken and you're inhibited from reporting it through the forum, do it through chat or mail me at flashii-issues@flash.moe.
2023-08-02 22:12:47 +00:00

87 lines
3.6 KiB
Twig

{% macro changelog_listing(changes, hide_dates, is_small, is_manage) %}
{% from _self import changelog_entry %}
<div class="changelog__listing">
{% if changes|length > 0 %}
{% for change in changes %}
{% set change_date = change.change is defined ? change.change.date : change.date %}
{% if not hide_dates and (last_date is not defined or last_date != change_date) %}
{% set last_date = change_date %}
<a href="{{ is_manage ? '#cd' ~ last_date : url('changelog-index', {'date': last_date}) }}" class="changelog__listing__date" id="cd{{ last_date }}">
{{ last_date }}
</a>
{% endif %}
{{ changelog_entry(change, is_small, is_manage) }}
{% endfor %}
{% else %}
<div class="changelog__listing__none">
There are no changes to display here.
</div>
{% endif %}
</div>
{% endmacro %}
{% macro changelog_entry(change, is_small, is_manage) %}
{% set user = change.user|default(null) %}
{% set user_colour = change.user_colour|default(null) %}
{% if change.change is defined %}
{% set change = change.change %}
{% endif %}
{% set change_url = url(is_manage ? 'manage-changelog-change' : 'changelog-change', {'change': change.id}) %}
<div class="changelog__entry" id="cl{{ change.id }}">
<div class="changelog__entry__info">
{% if is_manage %}
<a href="{{ change_url }}" class="changelog__entry__datetime">
<time class="changelog__datetime__text"
datetime="{{ change.createdTime|date('c') }}"
title="{{ change.createdTime|date('r') }}">
{{ change.createdTime|time_format }}
</time>
</a>
{% endif %}
<a class="changelog__entry__action changelog__action--{{ change.action }}"
href="{{ change_url }}"
{% if is_small %}title="{{ change.actionText }}"{% endif %}>
{% if not is_small %}
<div class="changelog__entry__action__text">
{{ change.actionText }}
</div>
{% endif %}
</a>
{% if not is_small %}
<a class="changelog__entry__user"
href="{{ url(is_manage ? 'manage-user' : 'user-profile', {'user': user.id|default(0)}) }}"
{% if user_colour is not null %}style="--user-colour: {{ user_colour }}"{% endif %}>
<div class="changelog__entry__user__text">
{{ user.name|default('Anonymous') }}
</div>
</a>
{% endif %}
</div>
<div class="changelog__entry__text">
<a class="changelog__entry__log{% if change.hasBody %} changelog__entry__log--link{% endif %}"
{% if change.hasBody %}href="{{ change_url }}"{% endif %}>
{{ change.summary }}
</a>
{% if is_manage %}
<div class="changelog__entry__tags">
{% for tag in change.tags %}
<a href="{{ is_manage ? url('manage-changelog-tag', {'tag': tag.id}) : url('changelog-index', {'tags': tag.id}) }}" class="changelog__entry__tag">
{{ tag.name }}
</a>
{% endfor %}
</div>
{% endif %}
</div>
</div>
{% endmacro %}