Improve trip template layout

This commit is contained in:
Edward Betts 2024-01-06 15:39:46 +00:00
parent 50127417f0
commit 7a5319aa83
2 changed files with 7 additions and 5 deletions

View file

@ -1,7 +1,7 @@
{% macro display_datetime(dt) %}{{ dt.strftime("%a, %d, %b %Y %H:%M %z") }}{% endmacro %}
{% macro display_time(dt) %}{{ dt.strftime("%H:%M %z") }}{% endmacro %}
{% macro display_date(dt) %}{{ dt.strftime("%a, %d, %b %Y") }}{% endmacro %}
{% macro display_date_no_year(dt) %}{{ dt.strftime("%a, %d, %b") }}{% endmacro %}
{% macro display_date(dt) %}{{ dt.strftime("%a %-d %b %Y") }}{% endmacro %}
{% macro display_date_no_year(dt) %}{{ dt.strftime("%a %-d %b") }}{% endmacro %}
{% macro conference_row(item, badge) %}
{% set country = get_country(item.country) if item.country else None %}

View file

@ -1,6 +1,6 @@
{% extends "base.html" %}
{% from "macros.html" import display_date_no_year, conference_row, accommodation_row, flight_row, train_row with context %}
{% from "macros.html" import display_date_no_year, display_date, conference_row, accommodation_row, flight_row, train_row with context %}
{% set row = { "flight": flight_row, "train": train_row } %}
@ -38,11 +38,13 @@
{% macro section(heading, item_list, badge) %}
{% if item_list %}
{% set items = item_list | list %}
<div class="heading"><h2>{{ heading }}</h2></div>
{% for trip in item_list %}
<p>{{ items | count }} trips</p>
{% for trip in items %}
{% set end = trip.end %}
<div class="border border-2 rounded mb-2 p-2">
<h3>{{ trip.title }} <small class="text-muted">({{ trip.start.strftime("%b %Y") }})</small></h3>
<h3>{{ trip.title }} <small class="text-muted">({{ display_date(trip.start) }})</small></h3>
<div>Countries: {{ trip.countries_str }}</div>
{% if end %}
<div>Dates: {{ display_date_no_year(trip.start) }} to {{ display_date_no_year(end) }}</div>