From 5b06b4d8bb4fe354891a516a3a412d82add60ac8 Mon Sep 17 00:00:00 2001 From: CactusPuppy Date: Fri, 30 Apr 2021 09:56:15 -0700 Subject: [PATCH] [feat] Prevent license key from being embedded in view --- .../javascripts/{fullcalendar.js => fullcalendar.js.erb} | 4 +++- app/views/schedules/vertical_schedule.haml | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) rename app/assets/javascripts/{fullcalendar.js => fullcalendar.js.erb} (88%) diff --git a/app/assets/javascripts/fullcalendar.js b/app/assets/javascripts/fullcalendar.js.erb similarity index 88% rename from app/assets/javascripts/fullcalendar.js rename to app/assets/javascripts/fullcalendar.js.erb index ad054c3f..8c3af528 100644 --- a/app/assets/javascripts/fullcalendar.js +++ b/app/assets/javascripts/fullcalendar.js.erb @@ -3,8 +3,10 @@ $( document ).ready(function() { if (!calendarEl) return; //check that we need a vertical schedule let fullcalData = $('#fullcalendar'); + let license_key = "<%= Rails.configuration.fullcalendar[:license_key] %>"; + var calendar = new FullCalendar.Calendar(calendarEl, { - schedulerLicenseKey: fullcalData.data('schedulerLicenseKey'), + schedulerLicenseKey: license_key, nowIndicator: true, expandRows: true, allDaySlot: false, diff --git a/app/views/schedules/vertical_schedule.haml b/app/views/schedules/vertical_schedule.haml index b238b1a6..e2ccb27a 100644 --- a/app/views/schedules/vertical_schedule.haml +++ b/app/views/schedules/vertical_schedule.haml @@ -9,5 +9,4 @@ #fullcalendar{ data: { rooms: @rooms, events: @event_schedules, day: @day, 'start-hour': @conference.start_hour, 'end-hour': @conference.end_hour, 'start-date': @conference.start_date, - 'end-date': @conference.end_date + 1.day, - 'scheduler-license-key': @scheduler_license_key } } + 'end-date': @conference.end_date + 1.day } }