Move JS out of view and have calendar start on same day as horizontal schedule
This commit is contained in:
parent
409fd09514
commit
468e170a2e
4 changed files with 22 additions and 15 deletions
|
|
@ -56,6 +56,7 @@
|
|||
//= require osem-survey
|
||||
//= require pagy
|
||||
//= require fullcalendar-scheduler/main.js
|
||||
//= require fullcalendar
|
||||
|
||||
$(document).ready(function() {
|
||||
$('a[disabled=disabled]').click(function(event){
|
||||
|
|
|
|||
15
app/assets/javascripts/fullcalendar.js
Normal file
15
app/assets/javascripts/fullcalendar.js
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
$( document ).ready(function() {
|
||||
let calendarEl = document.getElementById('vert-schedule-full-calendar');
|
||||
if (!calendarEl) return; //check that we need a vertical schedule
|
||||
let fullcalData = $('#fullcalendar');
|
||||
|
||||
var calendar = new FullCalendar.Calendar(calendarEl, {
|
||||
timeZone: 'UTC',
|
||||
initialDate: fullcalData.data('day'),
|
||||
initialView: 'resourceTimeGridDay',
|
||||
resources: fullcalData.data('rooms'),
|
||||
events: fullcalData.data('events')
|
||||
});
|
||||
|
||||
calendar.render();
|
||||
});
|
||||
|
|
@ -79,6 +79,10 @@ class SchedulesController < ApplicationController
|
|||
end
|
||||
|
||||
def vertical_schedule
|
||||
dates = @conference.start_date..@conference.end_date
|
||||
# the schedule takes you to today if it is a date of the schedule
|
||||
current_day = @conference.current_conference_day
|
||||
@day = current_day.present? ? current_day : dates.first
|
||||
event_schedules = @program.selected_event_schedules(
|
||||
includes: [{ event: %i[event_type speakers submitter] }]
|
||||
)
|
||||
|
|
|
|||
|
|
@ -5,18 +5,5 @@
|
|||
Vertical Schedule for
|
||||
= @conference.title
|
||||
|
||||
#calendar
|
||||
|
||||
:javascript
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
var calendarEl = document.getElementById('calendar');
|
||||
|
||||
var calendar = new FullCalendar.Calendar(calendarEl, {
|
||||
timeZone: 'UTC',
|
||||
initialView: 'resourceTimeGridDay',
|
||||
resources: #{@rooms.html_safe},
|
||||
events: #{@event_schedules.html_safe}
|
||||
});
|
||||
|
||||
calendar.render();
|
||||
});
|
||||
#vert-schedule-full-calendar
|
||||
#fullcalendar{ data: { rooms: @rooms, events: @event_schedules, day: @day } }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue