agenda/templates/index.html

195 lines
6.4 KiB
HTML
Raw Permalink Normal View History

2023-10-02 20:35:30 +01:00
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Agenda</title>
2023-10-05 11:06:46 +01:00
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
2023-11-13 12:08:55 +00:00
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>📅</text></svg>">
<script async src="https://unpkg.com/es-module-shims@1.8.2/dist/es-module-shims.js"></script>
<script type='importmap'>
{
"imports": {
"@fullcalendar/core": "https://cdn.skypack.dev/@fullcalendar/core@6.1.9",
"@fullcalendar/daygrid": "https://cdn.skypack.dev/@fullcalendar/daygrid@6.1.9",
"@fullcalendar/timegrid": "https://cdn.skypack.dev/@fullcalendar/timegrid@6.1.9",
"@fullcalendar/list": "https://cdn.skypack.dev/@fullcalendar/list@6.1.9",
"@fullcalendar/core/locales/en-gb": "https://cdn.skypack.dev/@fullcalendar/core@6.1.9/locales/en-gb"
}
}
</script>
<script type='module'>
import { Calendar } from '@fullcalendar/core'
import dayGridPlugin from '@fullcalendar/daygrid'
import timeGridPlugin from '@fullcalendar/timegrid'
import listPlugin from '@fullcalendar/list'
import gbLocale from '@fullcalendar/core/locales/en-gb';
// Function to save the current view to local storage
function saveView(view) {
localStorage.setItem('fullCalendarDefaultView', view);
}
// Function to get the saved view from local storage
function getSavedView() {
return localStorage.getItem('fullCalendarDefaultView') || 'dayGridMonth';
}
document.addEventListener('DOMContentLoaded', function() {
const calendarEl = document.getElementById('calendar')
const calendar = new Calendar(calendarEl, {
locale: gbLocale,
plugins: [dayGridPlugin, timeGridPlugin, listPlugin ],
themeSystem: 'bootstrap5',
firstDay: 1,
initialView: getSavedView(),
viewDidMount: function(info) {
saveView(info.view.type);
},
headerToolbar: {
left: 'prev,next today',
center: 'title',
right: 'dayGridMonth,timeGridWeek,timeGridDay,listWeek'
},
nowIndicator: true,
weekNumbers: true,
eventTimeFormat: {
hour: '2-digit',
minute: '2-digit',
hour12: false,
},
events: {{ fullcalendar_events | tojson(indent=2) }},
eventDidMount: function(info) {
info.el.title = info.event.title;
},
})
calendar.render()
})
</script>
2023-10-02 20:35:30 +01:00
</head>
2023-10-05 11:07:01 +01:00
{% set event_labels = {
2023-11-23 22:09:11 +00:00
"economist": "📰 The Economist",
2023-10-05 11:07:01 +01:00
"mothers_day": "Mothers' day",
"fathers_day": "Fathers' day",
"uk_financial_year_end": "End of financial year",
"bank_holiday": "UK bank holiday",
"us_holiday": "US holiday",
"uk_clock_change": "UK clock change",
"us_clock_change": "US clock change",
2023-11-10 10:49:27 +00:00
"us_presidential_election": "US pres. election",
2023-10-05 11:07:01 +01:00
"xmas_last_second": "Christmas last posting 2nd class",
"xmas_last_first": "Christmas last posting 1st class",
2023-11-08 14:40:07 +00:00
"up_series": "Up documentary",
"waste_schedule": "Waste schedule",
"gwr_advance_tickets": "GWR advance tickets",
"critical_mass": "Critical Mass",
2023-10-05 11:07:01 +01:00
}
%}
2023-10-11 17:31:16 +01:00
{%set class_map = {
"bank_holiday": "bg-success-subtle",
"conference": "bg-primary-subtle",
"us_holiday": "bg-secondary-subtle",
"birthday": "bg-info-subtle",
"waste_schedule": "bg-danger-subtle",
} %}
2024-01-02 16:08:22 +00:00
{% from "navbar.html" import navbar with context %}
2023-10-02 20:35:30 +01:00
<body>
2024-01-02 16:08:22 +00:00
{{ navbar() }}
2023-10-02 20:35:30 +01:00
2023-11-05 12:15:20 +00:00
<div class="container-fluid mt-2">
2023-10-02 20:35:30 +01:00
<h1>Agenda</h1>
<p>
2023-11-20 19:48:42 +00:00
<a href="/tools">&larr; personal tools</a>
</p>
2023-10-02 20:35:30 +01:00
<ul>
<li>Today is {{now.strftime("%A, %-d %b %Y")}}</li>
{% if gbpusd %}
<li>GBPUSD: {{"{:,.3f}".format(gbpusd)}}</li>
{% endif %}
<li>GWR advance ticket furthest date:
{% if gwr_advance_tickets %}
{{ gwr_advance_tickets.strftime("%A, %-d %b %Y") }}
{% else %}
unknown
{% endif %}
</li>
2023-10-30 05:49:21 +00:00
<li>Bristol Sunrise: {{ sunrise.strftime("%H:%M:%S") }} /
2023-10-29 21:36:57 +00:00
Sunset: {{ sunset.strftime("%H:%M:%S") }}</li>
2023-10-02 20:35:30 +01:00
</ul>
2023-10-30 05:49:21 +00:00
<h3>Stock markets</h3>
{% for market in stock_markets %}
<p>{{ market }}</p>
{% endfor %}
<div class="mb-3" id="calendar"></div>
<h3>Agenda</h3>
2023-11-05 22:04:23 +00:00
{% for event in events if event.as_date >= two_weeks_ago %}
{% if loop.first or event.date.year != loop.previtem.date.year or event.date.month != loop.previtem.date.month %}
2023-11-05 13:01:35 +00:00
<div class="row mt-2">
<div class="col">
<h4>{{ event.date.strftime("%B %Y") }}</h4>
2023-11-05 13:01:35 +00:00
</div>
</div>
{% endif %}
{% set delta = event.delta_days(today) %}
{% if event.name == "today" %}
<div class="row">
<div class="col bg-warning-subtle">
<h3>today</h3>
</div>
</div>
{% else %}
{% set cell_bg = " bg-warning-subtle" if delta == "today" else "" %}
<div class="row border border-1 {% if event.name in class_map %} {{ class_map[event.name]}}{% else %}{{ cell_bg }}{% endif %}">
<div class="col-md-2{{ cell_bg }}">
{{event.as_date.strftime("%a, %d, %b")}}
&nbsp;
&nbsp;
{{event.display_time or ""}}
&nbsp;
&nbsp;
{{event.display_timezone or ""}}
</div>
<div class="col-md-2{{ cell_bg }}">
2024-01-01 00:43:24 +00:00
{% if event.end_date %}
{% if event.end_as_date == event.as_date and event.has_time %}
end: {{event.end_date.strftime("%H:%M") }}
(duration: {{event.end_date - event.date}})
{% elif event.end_date != event.date %}
{{event.end_date}}
{% endif %}
{% endif %}
</div>
<div class="col-md-7 text-start">
{% if event.url %}<a href="{{ event.url }}">{% endif %}
{{ event_labels.get(event.name) or event.name }}
{%- if event.title -%}: {{ event.title }}{% endif %}
{% if event.url %}</a>{% endif %}
</div>
<div class="col-md-1{{ cell_bg }}">
{{ delta }}
</div>
</div>
{% endif %}
2023-10-05 11:07:01 +01:00
{% endfor %}
2023-10-03 14:16:25 +01:00
</div>
2024-01-02 18:56:13 +00:00
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
2023-10-02 20:35:30 +01:00
</body>
</html>