parent
fcf935271c
commit
d91eab02ad
3 changed files with 54 additions and 65 deletions
|
|
@ -9,67 +9,6 @@
|
|||
|
||||
<script async src="{{ url_for("static", filename="es-module-shims/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>
|
||||
|
||||
</head>
|
||||
|
||||
{% set event_labels = {
|
||||
|
|
@ -140,8 +79,6 @@
|
|||
<p>{{ market }}</p>
|
||||
{% endfor %}
|
||||
|
||||
<div class="mb-3" id="calendar"></div>
|
||||
|
||||
<h3>Agenda</h3>
|
||||
|
||||
<div>
|
||||
|
|
@ -151,7 +88,7 @@
|
|||
| <a href="{{ url_for(request.endpoint, markets="hide") }}">Hide all</a>
|
||||
</div>
|
||||
|
||||
{% for event in events if event.as_date >= two_weeks_ago %}
|
||||
{% for event in events if start_event_list <= event.as_date <= end_event_list %}
|
||||
{% if loop.first or event.date.year != loop.previtem.date.year or event.date.month != loop.previtem.date.month %}
|
||||
<div class="row mt-2">
|
||||
<div class="col">
|
||||
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
{% set pages = [
|
||||
{"endpoint": "index", "label": "Home" },
|
||||
{"endpoint": "recent", "label": "Recent" },
|
||||
{"endpoint": "calendar_page", "label": "Calendar" },
|
||||
{"endpoint": "trip_future_list", "label": "Future trips" },
|
||||
{"endpoint": "trip_past_list", "label": "Past trips" },
|
||||
{"endpoint": "conference_list", "label": "Conferences" },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue