-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcalendar.js
More file actions
68 lines (63 loc) · 2.32 KB
/
Copy pathcalendar.js
File metadata and controls
68 lines (63 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/**
* This file is part of Galette Events plugin (https://galette.eu).
* SPDX-FileCopyrightText: Copyright © 2018-2026 The Galette Team
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import $ from 'jquery';
import { Calendar } from 'fullcalendar';
import dayGridPlugin from 'fullcalendar/daygrid';
import interactionPlugin from 'fullcalendar/interaction';
import listPlugin from 'fullcalendar/list';
import themePlugin from 'fullcalendar/themes/classic';
import allLocales from 'fullcalendar/locales-all';
import 'fullcalendar/skeleton.css';
import 'fullcalendar/themes/classic/theme.css';
import 'fullcalendar/themes/classic/palette.css';
$(function() {
var calendarEl = document.getElementById('calendar');
var calendar = new Calendar(calendarEl, {
plugins: [ themePlugin, interactionPlugin, dayGridPlugin, listPlugin ],
views: _fullcalendar_views,
headerToolbar: {
left: 'title',
right: 'dayGridMonth,listDay,listWeek,listMonth prevYear,prev,today,next,nextYear'
},
height: 'auto',
locales: allLocales,
locale: _fullcalendar_locale,
weekNumbers: true,
events: _calendar_dataurl,
selectable: true,
eventClick: function(info) {
var _infos = JSON.parse(JSON.stringify(info.event.extendedProps));
_infos.url = _calendar_event_url.replace('PLACEBO', _infos.id_event);
_infos.booking = _calendar_booking_url.replace('PLACEBO', _infos.id_event);
_booking_action = function() {
window.location.href = _infos.booking;
};
if (_modal_actions.length == 2) {
_modal_actions[0].click = _booking_action;
} else {
_modal_actions[1].click = _booking_action;
}
var _elt = $('<div class="ui tiny modal"><div class="header">' + _infos.name + ' (' + _infos.begin_date_fmt + ' - ' + _infos.end_date_fmt + ')</div><div class="content">' + _infos.description + '</div></div>');
_elt.appendTo('body');
_elt.modal({
onApprove: function() {
window.location.href = _infos.url;
},
actions: _modal_actions
}).modal('show');
},
eventMouseEnter: function(info) {
var _el = $(info.el);
_el.popup({
exclusive: true,
hoverable: true,
variation: 'basic',
html: info.event.extendedProps.description
}).popup('show');
}
});
calendar.render();
});