ActiveScaffold :: Wiki
Calendar Date Select Bridge

Calendar Date Select Bridge

Overview

Do you hate drop down selectors for dates? Me too! This plugin, when installed, will convert all of your dreaded drop down date selectors into a nice, friendly, and flashy pop-up calendar that’s also capable of picking times. It does all of this magic by integrating the awesome power of Active Scaffold tightly with the new emerging calendar_date_select plugin for rails.

Installation

To harness this goodness, you’ll need the latest trunk version of Active Scaffold.

svn export http://activescaffold.googlecode.com/svn/trunk/ vendor/plugins/active_scaffold

Then, you’ll need calendar_date_select

script/plugin install http://calendardateselect.googlecode.com/svn/tags/calendar_date_select

Active Scaffold will automatically recognize that calendar date select is installed, and connect with it.

Usage

Step 1

Create a model with a date column:

# app/models/entry.rb

# id           integer
# title        string(255)
# birthday     date
# next_appointment_at     datetime

class Entry < ActiveRecord::Base
end

Step 2

Create your scaffold controller

# app/controllers/entries_controller.rb

class EntryController < ApplicationController
  active_scaffold :entries
end

and layout

# app/views/layouts/application.rhtml
<html>
<head>
  <title>active scaffold demo application</title>
  <%= javascript_include_tag :defaults %>
  <%= active_scaffold_includes %>
</head>
<body>
  <%= yield %>
</body>
</html>

( notice, Calendar Date Select Bridge automatically includes calendar_date_select’s javascript and CSS dependencies! )

Step 3

Start you’re server! Birthday will be set to a date picker, and next_appointment_at will be automatically set to a datetime picker! Excellent! You’re all set to write that far out and groovy birthday application you’ve always dreamed about, so you can be rich and famous and retire to a life of doing good deeds!

Enjoy!

Notice:

If you wish to change the css theme of calendar date select, you can modify your layout to the following:

# app/views/layouts/application.rhtml
...
  <title>active scaffold demo application</title>
  <%= javascript_include_tag :defaults %>
  <%= calendar_date_select_includes :blue %>
  <%= active_scaffold_includes %>
...

calendar_date_select is smart and won’t include it’s css/js files twice.

Support

If you have issues installing the plugin, post to the Active Scaffold list. If you are having troubles with the calendar date picker itself, go to the calendar_date_select website.

Author

Contact me:

  Tim Harper - irb(main):001:0> ( 'tim_see_harperATgmail._see_om'.gsub('_see_', 'c').gsub('AT', '@') )