I recently made several asset gems out of the FullCalendar and the jquery.rest plugins. This is a simple example to see them in action. Take a look at the GemFile and the application.js and application.css files to see those in action.
Fullcalendar is an awesome jquery calendar. You can see it in action at this url:
This is an example of how to use it with Rails.
Here’s the gist… You can follow along commit-by-commit with the checkin comments; they explain everything pretty well.
-
started with a stock Rails 3.2 app
-
added my asset gems to add full calendar and jquery.rest into the mix
-
created an event model and controller as stock scaffolding, then modified the controller slightly to accept the query parameters for ranges that FullCalendar will throw at it.
-
created a controller/view for the calendar, but its pretty much just an empty div that FullCalendar enhances.
-
glued it all together with the javascript in app/assets/javascripts/calendar.js.coffee
Yes, the UI for the events is just scaffolding. I might pretty it up in the future, but the whole point of this exercise is a minimal example of using those two gems.
I had previously done this with Rails 3 at the rails3_fullcalendar repo of mine; that has now been OBE by this repo.
Have fun.
–Running this on your own machine.
-
check it out.
-
bundle
-
migrate
-
start the app
-
look at it in a browser