From c223959ffbe5a8e9b0b2e241192394a751054c38 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Fri, 30 Apr 2021 17:58:52 +0800 Subject: [PATCH] [feat]Read fullcalendar license key from ENV --- app/assets/javascripts/fullcalendar.js | 1 + app/controllers/schedules_controller.rb | 1 + app/views/schedules/vertical_schedule.haml | 3 ++- config/application.rb | 4 ++++ 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/fullcalendar.js b/app/assets/javascripts/fullcalendar.js index 1e3b20b3..1bcfc688 100644 --- a/app/assets/javascripts/fullcalendar.js +++ b/app/assets/javascripts/fullcalendar.js @@ -4,6 +4,7 @@ $( document ).ready(function() { let fullcalData = $('#fullcalendar'); var calendar = new FullCalendar.Calendar(calendarEl, { + schedulerLicenseKey: fullcalData.data('schedulerLicenseKey'), expandRows: true, allDaySlot: false, slotMinTime: fullcalData.data('startHour') + ':00:00', diff --git a/app/controllers/schedules_controller.rb b/app/controllers/schedules_controller.rb index a22ded39..757ac9ad 100644 --- a/app/controllers/schedules_controller.rb +++ b/app/controllers/schedules_controller.rb @@ -94,6 +94,7 @@ class SchedulesController < ApplicationController @rooms = FullCalendarFormatter.rooms_to_resources(@conference.venue.rooms) if @conference.venue @event_schedules = FullCalendarFormatter.event_schedules_to_resources(event_schedules) + @scheduler_license_key = Rails.configuration.fullcalendar[:license_key] end def app diff --git a/app/views/schedules/vertical_schedule.haml b/app/views/schedules/vertical_schedule.haml index 23747f35..11003f85 100644 --- a/app/views/schedules/vertical_schedule.haml +++ b/app/views/schedules/vertical_schedule.haml @@ -7,4 +7,5 @@ #vert-schedule-full-calendar #fullcalendar{ data: { rooms: @rooms, events: @event_schedules, day: @day, | - 'start-hour': @conference.start_hour, 'end-hour': @conference.end_hour } } + 'start-hour': @conference.start_hour, 'end-hour': @conference.end_hour, | + 'scheduler-license-key': @scheduler_license_key } } diff --git a/config/application.rb b/config/application.rb index 4d52dc2c..320e4fd3 100644 --- a/config/application.rb +++ b/config/application.rb @@ -82,5 +82,9 @@ module Osem end config.assets.paths << Rails.root.join('node_modules') + + config.fullcalendar = { + license_key: ENV['FULL_CALENDAR_LICENSE_KEY'] + } end end