prototypejs-calendar

A drastic hack and slash of the calendarview plugin for Prototype

h1. A calendar for use with prototype

  • It pops up!
  • It embeds!
  • It can be delegated!
  • It is kinda friendly!

h4. Why a calendar date picker for a framework waning in popularity?

There are projects in the wild that are deep into prototypeland and still need functionality added.

h2. Usage

Demonstration of the plugin can be seen in @examples/[email protected] which shows a few different calendar types in action.

h5. ↓ HTML


h5. ↓ JAVASCRIPT

$('calendarview_input').calendarviewable();

h3. Details

Currently the identifier for the editable field needs to be on the DOM object containing the input element that a calendar should be attached to.

This is not ideal but it works for the moment. If the DOM object the calendar is being attached to isn’t an input field but a DIV or the like the ‘dateField’ id needs to be passed in for the calendar to be added:

h5. ↓ HTML

01/01/2010

h5. ↓ JAVASCRIPT

$('calendarview_input').calendarviewable({
  'dateField' : 'date_display'
  'dateFormat' : '%d/%m/%Y%'
});

p=. NOTE The date format has to be added to the options for the date parsing to work correctly.

|<. Date Formatting |. |_<. dateFormat | | 01/01/2010 | &rarr; | @‘%d/%m/%Y’@ | | Friday Jan 1st, 2010 | &rarr; | @‘%A %b %O, %Y’@ | | Jan 1, 2010 | &rarr; | @‘%b %e, %Y’@ | | 2010-01-01 | &rarr; | @‘%Y-%m-%d’@ |

If the calendar is being added when an event happens (like a mouse click on a input/DOM Object) @‘activated’: [email protected] needs to added to the options or the calendar will not display on the first click.

h2. Acknowledgment

“Calendarview”:http://github.com/jsmecham/calendarview/ is the original plugin that was the foundation for this hack and slash version. CalendarView is developed and maintained by “Justin Mecham”:mailto:[email protected] “calendarview.org”:http://calendarview.org/

The design and constructor pattern were heavily informed by the “better-edit-in-place”:http://github.com/nakajima/better-edit-in-place plugin.

h2. TODO

  • Better README
  • Do some Object instantiation options voodoo because the current way is ugly and brittle.
  • Probe date_patches.js to assess what’s what - if it does things that are already handled by default etc…
  • Testing!?
  • Rake install task or Gemify?

Related Repositories

prototypejs-calendar

prototypejs-calendar

A drastic hack and slash of the calendarview plugin for Prototype ...