Display a calendar helper

Before I starting writing a helper to display a calendar I wondered if
anyone was aware of a calendar helper, basically something that is
displayed inline (not a pop-up window) that can replace a date_select.

The way I am thinking of doing it is to have a partial which is passed a
Time class, the month is extracted from the date and a grid displayed
for that month. Which should not be to difficult since there are some
nice constants in Date class which include the number of days in a
month for normal and leap years.

Each date will have a javascript onclick which will pass its value (eg.
3 if you clicked on the 3rd) to a javascript function which would store
the value in a hidden field.

Those hidden fields may translate directly in to a date when parsed by
Rails or they may need to be done manually using Time.parse.

Now the problem comes when the user needs to change the month since only
one month can be displayed at a time. So I have a link for the next and
previous month, when clicked the grid is replaced with the correct
month’s grid.

How best to do this, im thinking ajax would be the wrong choice and I
may be better to do it all client side using javascript, but then I dont
get access to the partical… so ajax it must be??

On Tue, 2006-07-04 at 15:03 +0200, AFM wrote:

Each date will have a javascript onclick which will pass its value (eg.

How best to do this, im thinking ajax would be the wrong choice and I
may be better to do it all client side using javascript, but then I dont
get access to the partical… so ajax it must be??


why reinvent wheel?

http://wiki.rubyonrails.org/rails/pages/DatePicker

Craig

Check out this calendar http://www.dynarch.com/projects/calendar/. It is
very nice and I am using it in a couple applications. I wrote a couple
of my
own helpers when using the dynarch calendar, but you could use
http://rails-engines.org/wiki/pages/DateboxEngine rather that write your
own.

mark

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs