{% set current_page='feed' %} {% extends 'federation/master.html' %} {# SPDX-FileCopyrightText: 2020-2021 zPlus SPDX-License-Identifier: GPL-2.0-only #} {% block page_content %} {% if feeds|length == 0 %} Your feed is empty. {% endif %}
{# This variable is used to keep track of a feed creation date while looping. # When the date of a feed changes, we display the day of the post. The end # result is that we group feeds by month/day on the UI. # HACK: We need to use a dictionary here instead of a scalar value, because # jinja2's block scope won't allow changing of a global scalar variable # from inside the for loop. #} {% set current_day = { 'value': None } %} {% for feed in feeds %} {% set feed_day = feed.created.strftime('%Y-%m-%d') %} {# Display the day #} {% if feed_day != current_day.value %}
— {{ feed.created.strftime('%b, %-d %Y') }}
{% if current_day.update({'value': feed_day}) %}{% endif %} {% endif %} {# Display the feed line #}
{% with feed=feed.content %}
{% include 'federation/feed.html' %}
{% endwith %}
{{ feed.created.strftime('%H:%M') }}
{% endfor %}
{% endblock %}