wip: renders calendar with demo data
This commit is contained in:
38
assets/controllers/upcoming_episodes_controller.js
Normal file
38
assets/controllers/upcoming_episodes_controller.js
Normal file
@@ -0,0 +1,38 @@
|
||||
import { Controller } from '@hotwired/stimulus';
|
||||
import { Calendar } from '@fullcalendar/core';
|
||||
import dayGridPlugin from '@fullcalendar/daygrid';
|
||||
import timeGridPlugin from '@fullcalendar/timegrid';
|
||||
import listPlugin from '@fullcalendar/list';
|
||||
|
||||
/* stimulusFetch: 'lazy' */
|
||||
export default class extends Controller {
|
||||
|
||||
initialize() {
|
||||
|
||||
}
|
||||
|
||||
connect() {
|
||||
let calendar = new Calendar(this.element, {
|
||||
plugins: [ dayGridPlugin, timeGridPlugin, listPlugin ],
|
||||
initialView: 'dayGridMonth',
|
||||
headerToolbar: {
|
||||
left: 'prev,next today',
|
||||
center: 'title',
|
||||
right: 'dayGridMonth,timeGridWeek,listWeek'
|
||||
}
|
||||
});
|
||||
calendar.render();
|
||||
// calendar.render();
|
||||
}
|
||||
|
||||
// Add custom controller actions here
|
||||
// fooBar() { this.fooTarget.classList.toggle(this.bazClass) }
|
||||
|
||||
disconnect() {
|
||||
// Called anytime its element is disconnected from the DOM
|
||||
// (on page change, when it's removed from or moved in the DOM, etc.)
|
||||
|
||||
// Here you should remove all event listeners added in "connect()"
|
||||
// this.fooTarget.removeEventListener('click', this._fooBar)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user