parent
ac1f279cb4
commit
aa7d7b7e6c
67
templates/accommodation.html
Normal file
67
templates/accommodation.html
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
{% block style %}
|
||||||
|
<style>
|
||||||
|
.grid-container {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(6, auto);
|
||||||
|
gap: 10px;
|
||||||
|
justify-content: start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.grid-item {
|
||||||
|
/* Additional styling for grid items can go here */
|
||||||
|
}
|
||||||
|
|
||||||
|
.heading {
|
||||||
|
grid-column: 1 / 7; /* Spans from the 1st line to the 7th line */
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% macro row(item, badge) %}
|
||||||
|
<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">{{ (item.to.date() - item.from.date()).days }}</div>
|
||||||
|
<div class="grid-item">{{ item.name }}</div>
|
||||||
|
<div class="grid-item">{{ item.operator }}</div>
|
||||||
|
<div class="grid-item">{{ item.location }}</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 %}
|
||||||
|
{% endif %}
|
||||||
|
{% endmacro %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<div class="container-fluid mt-2">
|
||||||
|
|
||||||
|
<h1>Accommodation</h1>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<a href="{{ url_for("index") }}">← back to agenda</a>
|
||||||
|
|
|
||||||
|
<a href="{{ url_for("travel_list") }}">travel</a>
|
||||||
|
|
|
||||||
|
<a href="{{ url_for("conference_list") }}">conference</a>
|
||||||
|
|
|
||||||
|
<a href="{{ url_for("gaps_page") }}">gaps</a>
|
||||||
|
|
|
||||||
|
<strong>accommodation</strong>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Total nights away in 2024: {{ total_nights_2024 }}</li>
|
||||||
|
<li>Total nights abroad in 2024: {{ nights_abroad_2024 }}</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div class="grid-container">
|
||||||
|
{{ section("Accommodation", items) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock %}
|
|
@ -61,6 +61,8 @@
|
||||||
<strong>conference</strong>
|
<strong>conference</strong>
|
||||||
|
|
|
|
||||||
<a href="{{ url_for("gaps_page") }}">gaps</a>
|
<a href="{{ url_for("gaps_page") }}">gaps</a>
|
||||||
|
|
|
||||||
|
<a href="{{ url_for("accommodation_list") }}">accommodation</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="grid-container">
|
<div class="grid-container">
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
<a href="{{ url_for("conference_list") }}">conference</a>
|
<a href="{{ url_for("conference_list") }}">conference</a>
|
||||||
|
|
|
|
||||||
<strong>gaps</strong>
|
<strong>gaps</strong>
|
||||||
|
|
|
||||||
|
<a href="{{ url_for("accommodation_list") }}">accommodation</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -115,6 +115,8 @@
|
||||||
<a href="{{ url_for("conference_list") }}">conference</a>
|
<a href="{{ url_for("conference_list") }}">conference</a>
|
||||||
|
|
|
|
||||||
<a href="{{ url_for("gaps_page") }}">gaps</a>
|
<a href="{{ url_for("gaps_page") }}">gaps</a>
|
||||||
|
|
|
||||||
|
<a href="{{ url_for("accommodation_list") }}">accommodation</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
|
|
|
@ -44,6 +44,8 @@
|
||||||
<a href="{{ url_for("conference_list") }}">conference</a>
|
<a href="{{ url_for("conference_list") }}">conference</a>
|
||||||
|
|
|
|
||||||
<a href="{{ url_for("gaps_page") }}">gaps</a>
|
<a href="{{ url_for("gaps_page") }}">gaps</a>
|
||||||
|
|
|
||||||
|
<a href="{{ url_for("accommodation_list") }}">accommodation</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h3>flights</h3>
|
<h3>flights</h3>
|
||||||
|
|
25
web_view.py
25
web_view.py
|
@ -111,5 +111,30 @@ def conference_list() -> str:
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/accommodation")
|
||||||
|
def accommodation_list() -> str:
|
||||||
|
"""Page showing a list of past, present and future accommodation."""
|
||||||
|
data_dir = app.config["PERSONAL_DATA"]
|
||||||
|
items = agenda.travel.parse_yaml("accommodation", data_dir)
|
||||||
|
|
||||||
|
stays_in_2024 = [item for item in items if item["from"].year == 2024]
|
||||||
|
total_nights_2024 = sum(
|
||||||
|
(stay["to"].date() - stay["from"].date()).days for stay in stays_in_2024
|
||||||
|
)
|
||||||
|
|
||||||
|
nights_abroad_2024 = sum(
|
||||||
|
(stay["to"].date() - stay["from"].date()).days
|
||||||
|
for stay in stays_in_2024
|
||||||
|
if stay["country"] != "gb"
|
||||||
|
)
|
||||||
|
|
||||||
|
return flask.render_template(
|
||||||
|
"accommodation.html",
|
||||||
|
items=items,
|
||||||
|
total_nights_2024=total_nights_2024,
|
||||||
|
nights_abroad_2024=nights_abroad_2024,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app.run(host="0.0.0.0")
|
app.run(host="0.0.0.0")
|
||||||
|
|
Loading…
Reference in a new issue