test:#13 added tests and added licence

This commit is contained in:
Elmar Kresse
2024-06-10 10:36:48 +02:00
parent f68d4ae445
commit ee0894d048
5 changed files with 246 additions and 49 deletions

View File

@@ -1,3 +1,21 @@
<!--
Calendar implementation for the HTWK Leipzig timetable. Evaluation and display of the individual dates in iCal format.
Copyright (C) 2024 HTWKalender support@htwkalender.de
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
<script setup lang="ts">
import FullCalendar from "@fullcalendar/vue3";
@@ -9,7 +27,7 @@ import interactionPlugin from "@fullcalendar/interaction";
import timeGridPlugin from "@fullcalendar/timegrid";
import iCalenderPlugin from "@fullcalendar/icalendar";
import router from "@/router";
import { formatYearMonthDay } from "@/helpers/dates.ts";
import { formatYearMonthDay, removeTZ } from "@/helpers/dates.ts";
import { useI18n } from "vue-i18n";
import { useQuery } from "@tanstack/vue-query";
import tokenStore from "@/store/tokenStore.ts";
@@ -29,42 +47,26 @@ const op = ref();
const clickedEvent = ref();
const toggle = (info: EventClickArg) => {
const start = !info.event.start ? "" : removeTZ(info.event.start);
const end = !info.event.end ? "" : removeTZ(info.event.end);
if (op.value.visible) {
clickedEvent.value = null;
op.value.hide();
return;
} else {
clickedEvent.value = {
title: info.event._def.title,
start: start,
end: end,
notes: info.event._def.extendedProps.notes,
allDay: info.event._def.allDay,
location: info.event._def.extendedProps.location,
};
op.value.show(info.jsEvent);
op.value.target = info.el;
const start = info.event.start
const end = info.event.end
if (!start || !end) {
clickedEvent.value = {
title: info.event._def.title,
start: "",
end: "",
notes: info.event._def.extendedProps.notes,
allDay: info.event._def.allDay,
location: info.event._def.extendedProps.location,
};
op.value.show(info.jsEvent);
op.value.target = info.el;
} else {
const timeZoneOffsetStart = start.getTimezoneOffset() * 60000;
const timeZoneOffsetEnd = end.getTimezoneOffset() * 60000;
clickedEvent.value = {
title: info.event._def.title,
start: new Date(start.getTime() + timeZoneOffsetStart),
end: new Date(end.getTime() + timeZoneOffsetEnd),
notes: info.event._def.extendedProps.notes,
allDay: info.event._def.allDay,
location: info.event._def.extendedProps.location,
};
op.value.show(info.jsEvent);
op.value.target = info.el;
}
}