-
Notifications
You must be signed in to change notification settings - Fork 8
/
calendar-util.js
42 lines (38 loc) · 1.2 KB
/
calendar-util.js
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
{% load i18n %}
{% load l10n %}
function show_message(msg) {
$("#message-modal-body").text(msg);
$('#message-modal').modal({show:true});
}
function events_overlap(event1, event2) {
if(event1.end && event2.end) {
return ((event1.start >= event2.start && event1.start < event2.end) ||
(event1.end > event2.start && event1.end <= event2.end));
} else {
return false;
}
}
function get_trip_url(event) {
commute_mode = event.extendedProps.commute_mode;
cmo = commute_modes[commute_mode];
if(!cmo) return;
return "/view_trip/" + format_date(event.start) + "/" + event.extendedProps.direction
}
function ajax_req_json(url, json, method, success) {
$.ajax(url, {
data : JSON.stringify(json),
contentType : 'application/json',
type : method,
headers: {
'X-CSRFToken': "{{ csrf_token }}"
},
error: function(jqXHR, status, error) {
if (error) {
show_message(error + " " + jqXHR.responseText);
} else if (jqXHR.statusText == 'error') {
show_message("{% trans 'Chyba připojení' %}");
}
},
success: success
});
}