Change layout of trip page

This commit is contained in:
Edward Betts 2024-01-23 15:55:28 +00:00
parent fc36647d49
commit 72e7945fbe
2 changed files with 121 additions and 57 deletions

View file

@ -35,6 +35,8 @@ class Conference:
longitude: float | None = None
cfp_end: date | None = None
cfp_url: str | None = None
free: bool | None = None
hackathon: bool | None = None
@property
def display_name(self) -> str:

View file

@ -44,7 +44,7 @@
}
#map {
height: 80vh;
height: 90vh;
}
</style>
@ -53,38 +53,100 @@
{% set end = trip.end %}
{% block content %}
<div class="p-2">
<h1>{{ trip.title }}<small class="text-muted">({{ display_date(trip.start) }})</small></h1>
<div>Countries: {{ trip.countries_str }}</div>
<div class="row">
<div class="col m-3">
<h1>{{ trip.title }}</h1>
<p class="lead">
{% if end %}
<div>
Dates: {{ display_date_no_year(trip.start) }} to {{ display_date_no_year(end) }}
{{ display_date_no_year(trip.start) }} to {{ display_date_no_year(end) }}
({{ (end - trip.start).days }} nights)
</div>
{% else %}
<div>Start: {{ display_date_no_year(trip.start) }} (end date missing)</div>
{{ display_date_no_year(trip.start) }} (end date missing)
{% endif %}
</p>
<div class="mb-3">
<div>Countries: {{ trip.countries_str }}</div>
{% set delta = human_readable_delta(trip.start) %}
{% if delta %}
<div>{{ delta }} time</div>
<div>How long until trip: {{ delta }}</div>
{% endif %}
<div class="conferences">
{% for conf in trip.conferences %} {{ conference_row(conf, "going") }} {% endfor %}
</div>
<div class="accommodation">
{% for conf in trip.accommodation %} {{ accommodation_row(conf, "going") }} {% endfor %}
{% for item in trip.conferences %}
{% set country = get_country(item.country) if item.country else None %}
<div class="card my-1">
<div class="card-body">
<h5 class="card-title">
<a href="{{ item.url }}">{{ item.name }}</a>
<small class="text-muted">
{{ display_date_no_year(item.start) }} to {{ display_date_no_year(item.end) }}
</small>
</h5>
<p class="card-text">
Topic: {{ item.topic }}
| Venue: {{ item.venue }}
| Location: {{ item.location }}
{% if country %}
{{ country.flag }}
{% elif item.online %}
💻 Online
{% else %}
<span class="text-bg-danger p-2">
country code <strong>{{ item.country }}</strong> not found
</span>
{% endif %}
{% if item.free %}
| <span class="badge bg-success text-nowrap">free to attend</span>
{% elif item.price and item.currency %}
| <span class="badge bg-info text-nowrap">price: {{ item.price }} {{ item.currency }}</span>
{% endif %}
</p>
</div>
</div>
{% endfor %}
{% for item in trip.accommodation %}
{% set country = get_country(item.country) if item.country else None %}
{% set nights = (item.to.date() - item.from.date()).days %}
<div class="card my-1">
<div class="card-body">
<h5 class="card-title">
{% if item.operator %}{{ item.operator }}: {% endif %}
<a href="{{ item.url }}">{{ item.name }}</a>
<small class="text-muted">
{{ display_date_no_year(item.from) }} to {{ display_date_no_year(item.to) }}
({% if nights == 1 %}1 night{% else %}{{ nights }} nights{% endif %})
</small>
</h5>
<p class="card-text">
Address: {{ item.address }}
| Location: {{ item.location }}
{% if country %}
{{ country.flag }}
{% elif item.online %}
💻 Online
{% else %}
<span class="text-bg-danger p-2">
country code <strong>{{ item.country }}</strong> not found
</span>
{% endif %}
{% if item.price and item.currency %}
| <span class="badge bg-info text-nowrap">price: {{ item.price }} {{ item.currency }}</span>
{% endif %}
</p>
</div>
</div>
{% endfor %}
<div class="travel">
{% for item in trip.travel %} {{ row[item.type](item) }} {% endfor %}
</div>
{% if holidays %}
<div class="mt-3">
<h4>Holidays</h4>
{% if holidays %}
<table class="table table-hover w-auto">
{% for item in holidays %}
@ -100,8 +162,10 @@
</tr>
{% endfor %}
</table>
</div>
{% else %}
<p>No public holidays during trip.</p>
{% endif %}
</div>
<p>
{% if prev_trip %}
@ -112,16 +176,15 @@
{% endif %}
</p>
{% if coordinates %}
</div>
<div class="col">
<div id="map"></div>
{% endif %}
</div>
</div>
{% endblock %}
{% block scripts %}
{% if coordinates %}
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"
integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="
crossorigin=""></script>
@ -137,5 +200,4 @@ var routes = {{ routes | tojson }};
build_map("map", coordinates, routes);
</script>
{% endif %}
{% endblock %}