Improve trip list template

This commit is contained in:
Edward Betts 2024-05-20 18:32:49 +02:00
parent 5758d3f1d0
commit a96aefe22b

View file

@ -116,6 +116,35 @@
{% endfor %}
{% endif %}
{{ conference_list(trip) }}
{% for day, elements in trip.elements_grouped_by_day() %}
<h4>{{ display_date_no_year(day) }}</h4>
{% set accommodation_label = {"check-in": "check-in from", "check-out": "check-out by"} %}
{% for e in elements %}
{% if e.element_type in accommodation_label %}
{% set c = get_country(e.detail.country) %}
<div>
{{ e.get_emoji() }} {{ e.title }} {{ c.flag }}
({{ accommodation_label[e.element_type] }} {{ display_time(e.when) }})
</div>
{% else %}
<div>
{{ e.get_emoji() }}
{{ display_time(e.when) }}
&ndash;
{{ e.title }}
</div>
{% endif %}
{% endfor %}
{% endfor %}
</div>
{% endfor %}
{% endif %}
{% endmacro %}
{% macro conference_list(trip) %}
{% for item in trip.conferences %}
{% set country = get_country(item.country) if item.country else None %}
<div class="card my-1">
@ -149,31 +178,7 @@
</div>
{% endfor %}
{% set date_heading = None %}
{% for day, elements in trip.elements_grouped_by_day() %}
<h4>{{ display_date_no_year(day) }}</h4>
{% set accommodation_label = {"check-in": "check-in from", "check-out": "check-out by"} %}
{% for e in elements %}
{% if e.element_type in accommodation_label %}
{% set c = get_country(e.detail.country) %}
<div>
{{ e.get_emoji() }} {{ e.title }} {{ c.flag }}
({{ accommodation_label[e.element_type] }} {{ display_time(e.when) }})
</div>
{% else %}
<div>
{{ e.get_emoji() }}
{{ display_time(e.when) }}
&ndash;
{{ e.title }}
</div>
{% endif %}
{% endfor %}
{% endfor %}
</div>
{% endfor %}
{% endif %}
{% endmacro %}