Removed references to Fullcalendar

This commit is contained in:
Antoine Nguyen
2026-01-12 12:07:40 +01:00
parent d79aa41df4
commit 65864d75f4
5 changed files with 70 additions and 119 deletions
+2
View File
@@ -153,6 +153,8 @@ type = none
level = debug
request_content_on_debug = true
[headers]
# Additional HTTP headers
-5
View File
@@ -15,11 +15,6 @@
"gettext:compile": "vue-gettext-compile"
},
"dependencies": {
"@fullcalendar/core": "^6.1.15",
"@fullcalendar/daygrid": "^6.1.15",
"@fullcalendar/interaction": "^6.1.15",
"@fullcalendar/timegrid": "^6.1.15",
"@fullcalendar/vue3": "^6.1.15",
"@mdi/font": "^7.3.67",
"@tiptap/extension-highlight": "^3.11.0",
"@tiptap/extension-text-align": "^3.11.0",
+59 -77
View File
@@ -68,11 +68,13 @@
:event-ripple="false"
@mousedown:event="startDrag"
@mousedown:time="startTime"
@click:event="eventClickCallback"
@mousedown:day="startDay"
@click:day="dayClickCallback"
@mouseleave="cancelDrag"
@mousemove:time="mouseMove"
@mousemove:day="mouseMoveDay"
@mouseup:time="endDrag"
@mouseup:day="endDragDay"
@change="fetchUserEvents"
>
<template #event="{ event, timed, eventSummary }">
@@ -159,6 +161,7 @@ const ctype = ref('week')
const focus = ref('')
const dragEvent = ref(null)
const dragTime = ref(null)
const dragDay = ref(null)
const createEvent = ref(null)
const createStart = ref(null)
const extendOriginal = ref(null)
@@ -295,21 +298,14 @@ async function fetchUserCalendars() {
userCalendars.value = resp.data
}
function refreshCalendarEvents(calendarPk) {
function refreshCalendarEvents() {
fetchUserEvents({
start: calendarRef.value.renderProps.start,
end: calendarRef.value.renderProps.end,
})
}
async function eventClickCallback(nativeEvent, { event }) {
if (!updating.value && !moving.value) {
selectedEvent.value = event
showEventForm.value = true
}
}
const dayClickCallback = (nativeEvent, { date, time }) => {
const dayClickCallback = (nativeEvent, { date }) => {
if (!selectedEvent.value) {
const startDate = new Date(date)
const endDate = new Date(date)
@@ -331,10 +327,8 @@ async function updateEventDates(calEvent) {
}
const evtCalendar = calEvent.calendar
if (!calEvent.timed) {
const end = DateTime.fromJSDate(data.start)
end.plus({ days: 1 })
data.start.setHours(0, 0, 0)
data.end = end
data.start_date = data.start.toISOString().split('T')[0]
data.end_date = data.end.toISOString().split('T')[0]
data.allDay = calEvent.allDay
} else if (!calEvent.end) {
const end = DateTime.fromJSDate(data.start)
@@ -348,12 +342,6 @@ async function updateEventDates(calEvent) {
updating.value = false
}
}
function eventDropCallback(info) {
updateEventDates(info.event)
}
function eventResizeCallback(info) {
updateEventDates(info.event)
}
const roundTime = (time, down = true) => {
const roundTo = 15 // minutes
@@ -387,16 +375,18 @@ const getEventColor = (event) => {
}
const startDrag = (nativeEvent, { event, timed }) => {
console.log('startDrag')
if (event && timed) {
if (event) {
dragEvent.value = event
dragTime.value = null
extendOriginal.value = null
if (timed) {
dragTime.value = null
extendOriginal.value = null
} else {
dragDay.value = null
}
}
}
const startTime = (nativeEvent, tms) => {
console.log('startTime')
const mouse = toTime(tms)
if (dragEvent.value && dragTime.value === null) {
@@ -417,6 +407,14 @@ const startTime = (nativeEvent, tms) => {
}
}
const startDay = (nativeEvent, tms) => {
const mouse = toTime(tms)
if (dragEvent.value && dragDay.value === null) {
dragDay.value = mouse - dragEvent.value.start
}
}
const mouseMove = (nativeEvent, tms) => {
const mouse = toTime(tms)
@@ -442,14 +440,29 @@ const mouseMove = (nativeEvent, tms) => {
}
}
const mouseMoveDay = (nativeEvent, tms) => {
const mouse = toTime(tms)
if (dragEvent.value && dragDay.value !== null) {
moving.value = true
const start = dragEvent.value.start
const end = dragEvent.value.end
const duration = end - start
const newStartTime = mouse - dragDay.value
const newStart = roundTime(newStartTime)
const newEnd = newStart + duration
dragEvent.value.start = newStart
dragEvent.value.end = newEnd
}
}
const extendBottom = (event) => {
createEvent.value = event
createStart.value = event.start
extendOriginal.value = event.end
}
const endDrag = (nativeEvent, params) => {
console.log('endDrag')
const endDrag = () => {
if (createEvent.value && !extendOriginal.value) {
selectInfo.value = createEvent.value
showEventForm.value = true
@@ -460,6 +473,9 @@ const endDrag = (nativeEvent, params) => {
} else if (createEvent.value) {
updateEventDates(createEvent.value)
}
} else {
selectedEvent.value = dragEvent.value
showEventForm.value = true
}
dragTime.value = null
@@ -471,8 +487,21 @@ const endDrag = (nativeEvent, params) => {
}
}
const endDragDay = () => {
if (dragEvent.value) {
if (moving.value) {
updateEventDates(dragEvent.value)
} else {
selectedEvent.value = dragEvent.value
showEventForm.value = true
}
}
dragEvent.value = null
dragDay.value = null
moving.value = false
}
const cancelDrag = () => {
console.log('cancelDrag')
if (createEvent.value) {
if (extendOriginal.value) {
createEvent.value.end = extendOriginal.value
@@ -511,41 +540,12 @@ async function deleteCalendar(calendarPk) {
return
}
await api.deleteUserCalendar(calendarPk)
const fullc = calendarRef.value.getApi()
const evtSource = fullc.getEventSourceById(`user-${calendarPk}`)
evtSource.remove()
await fetchUserCalendars()
events.value = []
calendarRef.value.checkChange()
busStore.displayNotification({ msg: $gettext('Calendar deleted') })
}
/* const calendarOptions = {
* plugins: [timeGridPlugin, dayGridPlugin, interactionPlugin],
* headerToolbar: {
* left: 'prev,next today',
* center: 'title',
* right: 'dayGridMonth,timeGridWeek,timeGridDay',
* },
* scrollTime: '09:00:00',
* height: '100%',
* firstDay: 1,
* initialView: 'timeGridWeek',
* locale: current,
* selectable: true,
* selectMirror: true,
* editable: true,
* dayMaxEventRows: true,
* businessHours: {
* daysOfWeek: [1, 2, 3, 4, 5],
* startTime: '09:00',
* endTime: '18:00',
* },
* select: selectCallback,
* eventClick: eventClickCallback,
* eventDrop: eventDropCallback,
* eventResize: eventResizeCallback,
* }
* */
watch(
leftMenuItems,
(value) => {
@@ -554,24 +554,6 @@ watch(
{ immediate: true }
)
/* watch(userCalendars, (value) => {
* const fullc = calendarRef.value.getApi()
* if (!fullc) {
* return
* }
* for (const calendar of value) {
* fetchUserCalendars(
* const evtSource = fullc.getEventSourceById(`user-${calendar.pk}`)
* if (!evtSource) {
* fullc.addEventSource({
* id: `user-${calendar.pk}`,
* events: fetchUserCalendarEvents.bind(this, calendar.pk),
* })
* }
* }
* })
* */
onMounted(() => {
calendarRef.value.scrollToTime('07:00')
calendarRef.value.checkChange()
-34
View File
@@ -245,35 +245,6 @@
resolved "https://registry.yarnpkg.com/@floating-ui/utils/-/utils-0.2.10.tgz#a2a1e3812d14525f725d011a73eceb41fef5bc1c"
integrity sha512-aGTxbpbg8/b5JfU1HXSrbH3wXZuLPJcNEcZQFMxLs3oSzgtVu6nFPkbbGGUvBcUjKV2YyB9Wxxabo+HEH9tcRQ==
"@fullcalendar/core@^6.1.15":
version "6.1.19"
resolved "https://registry.yarnpkg.com/@fullcalendar/core/-/core-6.1.19.tgz#60379111ba0cfb9fd9bc6594fee47cf855fc77b2"
integrity sha512-z0aVlO5e4Wah6p6mouM0UEqtRf1MZZPt4mwzEyU6kusaNL+dlWQgAasF2cK23hwT4cmxkEmr4inULXgpyeExdQ==
dependencies:
preact "~10.12.1"
"@fullcalendar/daygrid@^6.1.15", "@fullcalendar/daygrid@~6.1.19":
version "6.1.19"
resolved "https://registry.yarnpkg.com/@fullcalendar/daygrid/-/daygrid-6.1.19.tgz#1d70a7f3f4cc13d3f27f55ed6880aae09a1a367b"
integrity sha512-IAAfnMICnVWPjpT4zi87i3FEw0xxSza0avqY/HedKEz+l5MTBYvCDPOWDATpzXoLut3aACsjktIyw9thvIcRYQ==
"@fullcalendar/interaction@^6.1.15":
version "6.1.19"
resolved "https://registry.yarnpkg.com/@fullcalendar/interaction/-/interaction-6.1.19.tgz#48d85601a4203ede7cb400323fe5a9c163e28804"
integrity sha512-GOciy79xe8JMVp+1evAU3ytdwN/7tv35t5i1vFkifiuWcQMLC/JnLg/RA2s4sYmQwoYhTw/p4GLcP0gO5B3X5w==
"@fullcalendar/timegrid@^6.1.15":
version "6.1.19"
resolved "https://registry.yarnpkg.com/@fullcalendar/timegrid/-/timegrid-6.1.19.tgz#bb4b2e3039c995b61284ee5b76ad9dcc696b71ce"
integrity sha512-OuzpUueyO9wB5OZ8rs7TWIoqvu4v3yEqdDxZ2VcsMldCpYJRiOe7yHWKr4ap5Tb0fs7Rjbserc/b6Nt7ol6BRg==
dependencies:
"@fullcalendar/daygrid" "~6.1.19"
"@fullcalendar/vue3@^6.1.15":
version "6.1.19"
resolved "https://registry.yarnpkg.com/@fullcalendar/vue3/-/vue3-6.1.19.tgz#43cecccfaca27679823b98c73ba2e042c60e98cb"
integrity sha512-j5eUSxx0xIy3ADljo0f5B9PhjqXnCQ+7nUMPfsslc2eGVjp4F74YvY3dyd6OBbg13IvpsjowkjncGipYMQWmTA==
"@humanfs/core@^0.19.1":
version "0.19.1"
resolved "https://registry.yarnpkg.com/@humanfs/core/-/core-0.19.1.tgz#17c55ca7d426733fe3c561906b8173c336b40a77"
@@ -1936,11 +1907,6 @@ postcss@^8.5.3, postcss@^8.5.6:
picocolors "^1.1.1"
source-map-js "^1.2.1"
preact@~10.12.1:
version "10.12.1"
resolved "https://registry.yarnpkg.com/preact/-/preact-10.12.1.tgz#8f9cb5442f560e532729b7d23d42fd1161354a21"
integrity sha512-l8386ixSsBdbreOAkqtrwqHwdvR35ID8c3rKPa8lCWuO86dBi32QWHV4vfsZK1utLLFMvw+Z5Ad4XLkZzchscg==
prelude-ls@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396"
+9 -3
View File
@@ -6,6 +6,7 @@ import uuid
import caldav
from caldav.elements import dav, ical
from caldav import Calendar
from dateutil.relativedelta import relativedelta
import vobject
from django.utils import timezone
@@ -53,8 +54,10 @@ class Caldav_Backend(CalendarBackend):
start = datetime.datetime.combine(
vevent.dtstart.value, datetime.time.min
).replace(tzinfo=tz)
# Small back to make vuetify calendar happy. 'All day' events are generally
# created from one day to the day after (even for a 1 day duration...)
end = datetime.datetime.combine(
vevent.dtend.value, datetime.time.min
vevent.dtend.value - relativedelta(days=1), datetime.time.min
).replace(tzinfo=tz)
result.update({"allDay": all_day, "start": start, "end": end})
if "attendee" in vevent.contents:
@@ -85,7 +88,8 @@ class Caldav_Backend(CalendarBackend):
dtend = data["end"]
else:
dtstart = data["start_date"]
dtend = data["end_date"]
# Ensure consistent behavior with other calendar clients (like TB.)
dtend = data["end_date"] + relativedelta(days=1)
self.remote_cal.save_event(
uid=uid, dtstart=dtstart, dtend=dtend, summary=data["title"]
)
@@ -139,7 +143,9 @@ class Caldav_Backend(CalendarBackend):
def get_events(self, start, end):
"""Retrieve a list of events."""
orig_events = self.remote_cal.search(server_expand=True, start=start, end=end)
orig_events = self.remote_cal.search(
server_expand=False, start=start, end=end, event=True
)
events = []
for event in orig_events:
events.append(self._serialize_event(event))