aboutsummaryrefslogtreecommitdiffstats
path: root/src/static/js/booking-calendar.js
diff options
context:
space:
mode:
authorJeremy Plsek <jplsek@iol.unh.edu>2019-12-20 10:50:41 -0500
committerJeremy Plsek <jplsek@iol.unh.edu>2020-02-17 16:01:03 -0500
commitd63a08e56716358ea4daa30d3050fa01df65a837 (patch)
tree10873a809c29492efcc1988cc65ccf8cf054f7e7 /src/static/js/booking-calendar.js
parent80f9bb0bb514133363bd0a40edb8b10ddb8d3a51 (diff)
js: use npm instead of bower
Bower is considered deprecated, so switch to npm. - Update all dependencies - Use npm's version of mxgraph - Use npm's version of jquery - Use npm's version of plotly - Fix mxgraph to use styles and images from the correct location - Removed random csrf token input in nav bar and use js to get csrf token - Remove all calendar and some resource files since they were not used Change-Id: I30d6bd91cded9547caa4c0a5247cd9f214fe9798 Signed-off-by: Jeremy Plsek <jplsek@iol.unh.edu>
Diffstat (limited to 'src/static/js/booking-calendar.js')
-rw-r--r--src/static/js/booking-calendar.js73
1 files changed, 0 insertions, 73 deletions
diff --git a/src/static/js/booking-calendar.js b/src/static/js/booking-calendar.js
deleted file mode 100644
index 303a6b2..0000000
--- a/src/static/js/booking-calendar.js
+++ /dev/null
@@ -1,73 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2016 Max Breitenfeldt and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution, and is available at
- * http://www.apache.org/licenses/LICENSE-2.0
- *****************************************************************************/
-
-
-function parseCalendarEvents(bookings) {
- var events = [];
- for (var i = 0; i < bookings.length; i++) {
- // convert ISO 8601 timestring to moment, needed for timezone handling
- start = moment(bookings[i]['start']);
- end = moment(bookings[i]['end']);
-
- installer = bookings[i]['installer__name'];
- if (installer === null) {
- installer = '';
- }
-
- scenario = bookings[i]['scenario__name'];
- if (scenario === null) {
- scenario = '';
- }
- title = bookings[i]['purpose'] + ' ' + installer + ' ' + scenario;
-
- event = {
- id: bookings[i]['id'],
- title: title,
- start: start,
- end: end,
- };
- events.push(event);
- }
- return events;
-}
-
-function loadEvents(url) {
- $.ajax({
- url: url,
- type: 'get',
- success: function (data) {
- $('#calendar').fullCalendar('addEventSource', parseCalendarEvents(data['bookings']));
- },
- failure: function (data) {
- alert('Error loading booking data');
- }
- });
-}
-
-$(document).ready(function () {
- createEditViewSwitch();
- $('#calendar').fullCalendar(calendarOptions);
- loadEvents(bookings_url);
- $('#starttimepicker').datetimepicker(timepickerOptions);
- $('#endtimepicker').datetimepicker(timepickerOptions);
- $('#starttimeeditpicker').datetimepicker(timepickerOptions);
- $('#endtimeeditpicker').datetimepicker(timepickerOptions);
-});
-
-function createEditViewSwitch() {
- var url = window.location.href;
- var isEdit = url.substr(url.lastIndexOf('/'));
-
- if ( url.indexOf('edit') !== -1 ) {
- document.getElementById('booking_form_div').style.display = 'none';
- calendarOptions.selectable = false;
- } else {
- document.getElementById('booking_edit_form_div').style.display = 'none';
- }
-}