Add trips page
Creating a new entity called a trip. This will group together any travel accommodation and conferences that happen together on one trip. A trip is assumed to start when leaving home and finish when returning home. The start date of a trip in is the trip ID. The date is written in ISO format. This assumes there cannot be multiple trips one one day. This assumption might be wrong, for example a morning day trip by rail, then another trip starts in the afternoon. I can change my choice of using dates as trip IDs if that happens. Sometimes during the planning of a trip the start date is unknown. For now we make up a start date, we can always change it later. If we use the start date in URLs then the URLs will change. Might need to keep a file of redirects, or could think of a different style of identifier. Trip ID have been added to accommodation, conferences, trains and flights. Later there will be a trips.yaml with notes about each trip.
This commit is contained in:
parent
5786e3d575
commit
ce9faa654f
10 changed files with 234 additions and 120 deletions
|
|
@ -1,4 +1,5 @@
|
|||
{% extends "base.html" %}
|
||||
{% from "macros.html" import accommodation_row with context %}
|
||||
{% block style %}
|
||||
{% set column_count = 7 %}
|
||||
<style>
|
||||
|
|
@ -19,36 +20,10 @@
|
|||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% macro row(item, badge) %}
|
||||
{% set country = get_country(item.country) %}
|
||||
{% set nights = (item.to.date() - item.from.date()).days %}
|
||||
<div class="grid-item text-end">{{ item.from.strftime("%a, %d %b %Y") }}</div>
|
||||
<div class="grid-item text-end">{{ item.to.strftime("%a, %d %b") }}</div>
|
||||
<div class="grid-item text-end">{% if nights == 1 %}1 night{% else %}{{ nights }} nights{% endif %}</div>
|
||||
<div class="grid-item">{{ item.operator }}</div>
|
||||
<div class="grid-item">{{ item.location }}</div>
|
||||
<div class="grid-item">
|
||||
{% if country %}
|
||||
{{ country.flag }} {{ country.name }}
|
||||
{% else %}
|
||||
<span class="text-bg-danger p-2">
|
||||
country code <strong>{{ item.country }}</strong> not found
|
||||
</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="grid-item">
|
||||
{% if item.url %}
|
||||
<a href="{{ item.url }}">{{ item.name }}</a>
|
||||
{% else %}
|
||||
{{ item.name }}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro section(heading, item_list, badge) %}
|
||||
{% if item_list %}
|
||||
<div class="heading"><h2>{{heading}}</h2></div>
|
||||
{% for item in item_list %}{{ row(item, badge) }}{% endfor %}
|
||||
{% for item in item_list %}{{ accommodation_row(item, badge) }}{% endfor %}
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue