2024-01-04 22:57:05 +00:00
|
|
|
{% extends "base.html" %}
|
|
|
|
|
2024-01-06 15:39:46 +00:00
|
|
|
{% from "macros.html" import display_date_no_year, display_date, conference_row, accommodation_row, flight_row, train_row with context %}
|
2024-01-04 22:57:05 +00:00
|
|
|
|
2024-01-06 09:17:34 +00:00
|
|
|
{% set row = { "flight": flight_row, "train": train_row } %}
|
|
|
|
|
2024-01-04 22:57:05 +00:00
|
|
|
{% block style %}
|
2024-01-14 10:31:51 +00:00
|
|
|
|
|
|
|
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"
|
|
|
|
integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY="
|
|
|
|
crossorigin=""/>
|
|
|
|
|
2024-01-04 22:57:05 +00:00
|
|
|
{% set conference_column_count = 6 %}
|
|
|
|
{% set accommodation_column_count = 7 %}
|
|
|
|
{% set travel_column_count = 7 %}
|
|
|
|
<style>
|
|
|
|
.conferences {
|
|
|
|
display: grid;
|
|
|
|
grid-template-columns: repeat({{ conference_column_count }}, auto); /* 7 columns for each piece of information */
|
|
|
|
gap: 10px;
|
|
|
|
justify-content: start;
|
|
|
|
}
|
|
|
|
|
|
|
|
.accommodation {
|
|
|
|
display: grid;
|
|
|
|
grid-template-columns: repeat({{ accommodation_column_count }}, auto);
|
|
|
|
gap: 10px;
|
|
|
|
justify-content: start;
|
|
|
|
}
|
|
|
|
|
|
|
|
.travel {
|
|
|
|
display: grid;
|
|
|
|
grid-template-columns: repeat({{ travel_column_count }}, auto);
|
|
|
|
gap: 10px;
|
|
|
|
justify-content: start;
|
|
|
|
}
|
|
|
|
|
|
|
|
.grid-item {
|
|
|
|
/* Additional styling for grid items can go here */
|
|
|
|
}
|
2024-01-14 10:31:51 +00:00
|
|
|
|
|
|
|
#map {
|
|
|
|
height: 80vh;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-04 22:57:05 +00:00
|
|
|
</style>
|
|
|
|
{% endblock %}
|
|
|
|
|
2024-01-06 09:17:34 +00:00
|
|
|
{% macro section(heading, item_list, badge) %}
|
|
|
|
{% if item_list %}
|
2024-01-06 15:39:46 +00:00
|
|
|
{% set items = item_list | list %}
|
2024-01-06 09:17:34 +00:00
|
|
|
<div class="heading"><h2>{{ heading }}</h2></div>
|
2024-01-06 15:39:46 +00:00
|
|
|
<p>{{ items | count }} trips</p>
|
|
|
|
{% for trip in items %}
|
2024-01-06 09:17:34 +00:00
|
|
|
{% set end = trip.end %}
|
|
|
|
<div class="border border-2 rounded mb-2 p-2">
|
2024-01-12 14:04:06 +00:00
|
|
|
<h3>
|
|
|
|
<a href="{{ url_for("trip_page", start=trip.start.isoformat()) }}">{{ trip.title }}</a>
|
|
|
|
<small class="text-muted">({{ display_date(trip.start) }})</small></h3>
|
2024-01-06 09:17:34 +00:00
|
|
|
<div>Countries: {{ trip.countries_str }}</div>
|
|
|
|
{% if end %}
|
|
|
|
<div>Dates: {{ display_date_no_year(trip.start) }} to {{ display_date_no_year(end) }}</div>
|
|
|
|
{% else %}
|
|
|
|
<div>Start: {{ display_date_no_year(trip.start) }} (end date missing)</div>
|
|
|
|
{% endif %}
|
|
|
|
<div class="conferences">
|
|
|
|
{% for conf in trip.conferences %}
|
|
|
|
{{ conference_row(conf, "going") }}
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
2024-01-04 22:57:05 +00:00
|
|
|
|
2024-01-06 09:17:34 +00:00
|
|
|
<div class="accommodation">
|
|
|
|
{% for conf in trip.accommodation %}
|
|
|
|
{{ accommodation_row(conf, "going") }}
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
2024-01-04 22:57:05 +00:00
|
|
|
|
2024-01-06 09:17:34 +00:00
|
|
|
<div class="travel">
|
|
|
|
{% for item in trip.travel %}
|
|
|
|
{{ row[item.type](item) }}
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
2024-01-04 22:57:05 +00:00
|
|
|
</div>
|
2024-01-06 09:17:34 +00:00
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
|
|
|
{% endmacro %}
|
2024-01-04 22:57:05 +00:00
|
|
|
|
|
|
|
|
2024-01-06 09:17:34 +00:00
|
|
|
{% block content %}
|
|
|
|
<div class="p-2">
|
|
|
|
|
2024-01-14 10:31:51 +00:00
|
|
|
<div id="map"></div>
|
2024-01-06 09:17:34 +00:00
|
|
|
|
|
|
|
<h1>Trips</h1>
|
|
|
|
{{ section("Current", current, "attending") }}
|
|
|
|
{{ section("Future", future, "going") }}
|
|
|
|
{{ section("Past", past|reverse, "went") }}
|
2024-01-04 22:57:05 +00:00
|
|
|
</div>
|
2024-01-14 10:31:51 +00:00
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block scripts %}
|
|
|
|
|
|
|
|
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"
|
|
|
|
integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="
|
|
|
|
crossorigin=""></script>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
var future_coordinates = {{ future_coordinates | tojson }};
|
|
|
|
var future_routes = {{ future_routes | tojson }};
|
|
|
|
|
|
|
|
// Initialize the map
|
|
|
|
var map = L.map('map').fitBounds(future_coordinates.map(function(station) {
|
|
|
|
return [station.latitude, station.longitude];
|
|
|
|
}));
|
|
|
|
|
|
|
|
// Set up the tile layer
|
|
|
|
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
|
|
|
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
|
|
|
}).addTo(map);
|
|
|
|
|
|
|
|
var stationIcon = L.divIcon({
|
|
|
|
className: 'custom-div-icon',
|
|
|
|
html: "<div style='font-size: 24px;'>🚉</div>",
|
|
|
|
iconSize: [30, 42],
|
|
|
|
});
|
|
|
|
|
|
|
|
var airportIcon = L.divIcon({
|
|
|
|
className: 'custom-div-icon',
|
|
|
|
html: "<div style='font-size: 24px;'>✈️</div>",
|
|
|
|
iconSize: [30, 42],
|
|
|
|
});
|
|
|
|
|
|
|
|
// Add markers with appropriate icons to the map
|
|
|
|
future_coordinates.forEach(function(item) {
|
|
|
|
var icon = item.type === "station" ? stationIcon : airportIcon;
|
|
|
|
var marker = L.marker([item.latitude, item.longitude], { icon: icon }).addTo(map);
|
|
|
|
marker.bindPopup(item.name);
|
|
|
|
});
|
|
|
|
|
|
|
|
// Draw routes
|
|
|
|
future_routes.forEach(function(route) {
|
|
|
|
if (route.geojson) {
|
|
|
|
// If route is defined as GeoJSON
|
|
|
|
L.geoJSON(JSON.parse(route.geojson), {
|
|
|
|
style: function(feature) {
|
|
|
|
return {color: route.type === "train" ? "blue" : "blue"}; // Green for trains, blue for flights
|
|
|
|
}
|
|
|
|
}).addTo(map);
|
|
|
|
} else {
|
|
|
|
// If route is defined by 'from' and 'to' coordinates
|
|
|
|
var color = route.type === "train" ? "blue" : "red"; // Green for trains, red for flights
|
|
|
|
L.polyline([route.from, route.to], {color: color}).addTo(map);
|
|
|
|
}
|
|
|
|
});
|
2024-01-04 22:57:05 +00:00
|
|
|
|
2024-01-14 10:31:51 +00:00
|
|
|
</script>
|
2024-01-04 22:57:05 +00:00
|
|
|
{% endblock %}
|