About ruby on rails, hackintosh, iphone3g and etc.

Thursday, April 30, 2009

Calendar Date Select for Ruby on Rails

CalendarDateSelect is semi-light-weight (about ~20k of javascript/css) and easy to use (but gets even lighter with bundle-fu)! It takes full advantage of the prototype.js library, resulting in less code, but maintaining a great deal of functionality.

Some of it's capabilities:

can pick a date, or a date-time, or a date with an optional time, as a popup selector or an embedded calendar!
speaks several different formats
is easy to localize
is extensible. Calendar Date Select doesn't do everything under the sun (which is a good thing), but you can build on top of it.
Installation / Usage

Install the calendar_date_select gem
sudo gem install calendar_date_select
Add a gem dependency to your rails project (in environment.rb)
config.gem "calendar_date_select"
Then, restart/start your rails project. All necessary files will be copied to your public folder.
Now include this at the top of your layout: (you'll also need to include prototype, if you haven't already!)
<%= calendar_date_select_includes "red" # or "blue", or "silver", or nil for the default! %>
# (if you want more control, you can get a list of stylesheets / javascripts via calendar_date_select_javascripts and calendar_date_select_stylesheets)
See the Demo for various uses of CalendarDateSelect.

No comments: