4
0
mirror of https://github.com/AzuraCast/AzuraCast.git synced 2024-06-14 13:16:37 +00:00

#5938 -- Fix Fullcalendar render.

This commit is contained in:
Buster Neece 2022-12-13 01:52:35 -06:00
parent 7044d12377
commit 1faf5c58b3
No known key found for this signature in database
GPG Key ID: F1D2E64A0005E80E

View File

@ -2,67 +2,63 @@
<full-calendar ref="calendar" :options="calendarOptions"></full-calendar> <full-calendar ref="calendar" :options="calendarOptions"></full-calendar>
</template> </template>
<script> <script setup>
import '@fullcalendar/core/vdom'; import '@fullcalendar/core/vdom';
import FullCalendar from '@fullcalendar/vue3'; import FullCalendar from '@fullcalendar/vue3';
import allLocales from '@fullcalendar/core/locales-all'; import allLocales from '@fullcalendar/core/locales-all';
import luxon2Plugin from '@fullcalendar/luxon2'; import luxon2Plugin from '@fullcalendar/luxon2';
import timeGridPlugin from '@fullcalendar/timegrid'; import timeGridPlugin from '@fullcalendar/timegrid';
import {shallowRef} from "vue";
export default { const props = defineProps({
name: 'Schedule', scheduleUrl: String,
components: {FullCalendar}, stationTimeZone: String
props: { });
scheduleUrl: String,
stationTimeZone: String
},
data() {
return {
calendarOptions: {
locale: App.locale_short,
locales: allLocales,
plugins: [luxon2Plugin, timeGridPlugin],
initialView: 'timeGridWeek',
timeZone: this.stationTimeZone,
themeSystem: 'bootstrap',
nowIndicator: true,
defaultTimedEventDuration: '00:20',
headerToolbar: false,
footerToolbar: false,
height: 'auto',
events: this.scheduleUrl,
eventClick: this.onEventClick,
eventDidMount: this.onEventDidMount,
views: {
timeGridWeek: {
slotLabelFormat: {
...App.time_config,
hour: 'numeric',
minute: '2-digit',
omitZeroMinute: true,
meridiem: 'short'
}
}
}
}
};
},
methods: {
refresh() {
}, const emit = defineEmits(['click']);
onEventDidMount(info) {
$(info.el).tooltip({ const onEventDidMount = (info) => {
title: info.event.extendedProps.description, let desc = info?.event?.extendedProps?.description || null;
placement: 'top', if (desc !== null) {
trigger: 'hover', $(info.el).tooltip({
container: 'body', title: desc,
offset: 0 placement: 'top',
}); trigger: 'hover',
}, container: 'body',
onEventClick(arg) { offset: 0
this.$emit('click', arg.event); });
}
} }
}; };
const onEventClick = (arg) => {
emit('click', arg.event);
};
const calendarOptions = shallowRef({
locale: App.locale_short,
locales: allLocales,
plugins: [luxon2Plugin, timeGridPlugin],
initialView: 'timeGridWeek',
timeZone: props.stationTimeZone,
themeSystem: 'bootstrap',
nowIndicator: true,
defaultTimedEventDuration: '00:20',
headerToolbar: false,
footerToolbar: false,
height: 'auto',
events: props.scheduleUrl,
eventClick: onEventClick,
eventDidMount: onEventDidMount,
views: {
timeGridWeek: {
slotLabelFormat: {
...App.time_config,
hour: 'numeric',
minute: '2-digit',
omitZeroMinute: true,
meridiem: 'short'
}
}
}
});
</script> </script>