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 longitude: float | None = None
cfp_end: date | None = None cfp_end: date | None = None
cfp_url: str | None = None cfp_url: str | None = None
free: bool | None = None
hackathon: bool | None = None
@property @property
def display_name(self) -> str: def display_name(self) -> str:

View file

@ -44,7 +44,7 @@
} }
#map { #map {
height: 80vh; height: 90vh;
} }
</style> </style>
@ -53,38 +53,100 @@
{% set end = trip.end %} {% set end = trip.end %}
{% block content %} {% block content %}
<div class="p-2"> <div class="row">
<h1>{{ trip.title }}<small class="text-muted">({{ display_date(trip.start) }})</small></h1> <div class="col m-3">
<div>Countries: {{ trip.countries_str }}</div> <h1>{{ trip.title }}</h1>
<p class="lead">
{% if end %} {% if end %}
<div> {{ display_date_no_year(trip.start) }} to {{ display_date_no_year(end) }}
Dates: {{ display_date_no_year(trip.start) }} to {{ display_date_no_year(end) }}
({{ (end - trip.start).days }} nights) ({{ (end - trip.start).days }} nights)
</div>
{% else %} {% else %}
<div>Start: {{ display_date_no_year(trip.start) }} (end date missing)</div> {{ display_date_no_year(trip.start) }} (end date missing)
{% endif %} {% endif %}
</p>
<div class="mb-3">
<div>Countries: {{ trip.countries_str }}</div>
{% set delta = human_readable_delta(trip.start) %} {% set delta = human_readable_delta(trip.start) %}
{% if delta %} {% if delta %}
<div>{{ delta }} time</div> <div>How long until trip: {{ delta }}</div>
{% endif %} {% endif %}
<div class="conferences">
{% for conf in trip.conferences %} {{ conference_row(conf, "going") }} {% endfor %}
</div> </div>
<div class="accommodation"> {% for item in trip.conferences %}
{% for conf in trip.accommodation %} {{ accommodation_row(conf, "going") }} {% endfor %} {% 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>
</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"> <div class="travel">
{% for item in trip.travel %} {{ row[item.type](item) }} {% endfor %} {% for item in trip.travel %} {{ row[item.type](item) }} {% endfor %}
</div> </div>
{% if holidays %}
<div class="mt-3"> <div class="mt-3">
<h4>Holidays</h4> <h4>Holidays</h4>
{% if holidays %}
<table class="table table-hover w-auto"> <table class="table table-hover w-auto">
{% for item in holidays %} {% for item in holidays %}
@ -100,8 +162,10 @@
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
</div> {% else %}
<p>No public holidays during trip.</p>
{% endif %} {% endif %}
</div>
<p> <p>
{% if prev_trip %} {% if prev_trip %}
@ -112,16 +176,15 @@
{% endif %} {% endif %}
</p> </p>
{% if coordinates %} </div>
<div class="col">
<div id="map"></div> <div id="map"></div>
{% endif %} </div>
</div> </div>
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}
{% if coordinates %}
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js" <script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"
integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="
crossorigin=""></script> crossorigin=""></script>
@ -137,5 +200,4 @@ var routes = {{ routes | tojson }};
build_map("map", coordinates, routes); build_map("map", coordinates, routes);
</script> </script>
{% endif %}
{% endblock %} {% endblock %}