Mojolicious and FullCalendar.js
You've been pulled into an impromptu meeting where the client now wants a web calendar tacked onto their application. Grimace. Walk out worried. But most important ...
Don't re-invent the wheel.
FullCalendar.js has most of what's required by default, is extensible and will take a json web feed. Given a list of hash refs, Mojolicious will spit out json. I'll show you a short template for displaying the calendar. Creating all your calendar appointments in json is left as an exercise for the reader.
Put the following routes in the startup method of your application to a new template called fullcalendar.html.ep in the templates/application directory. You're responsible for creating the json_events method in your Controller.
and some post-amble
You can get just the defaults with
$('#calendar').fullCalendar();or add in more attributes in the fullCalendar body to change locale and date formats and style the calendar to fit your page and site branding. Tell people you're still working on the latest unreasonable demand for the rest of the week while you're really adding tests to your application so that your time off really is time off.
Any improvements? Found an error? Re-invented a better wheel? Let us know in the comments.