#Simple Datepicker Helper
This plugin is a Ruby on Rails helper for Eulerian Javascript Datepicker.
$ ruby script/plugin install git://github.com/rafaelp/simple_datepicker_helper.git
To be able to use the simple_datepicker methods below you need to include the javascript library file and CSS stylesheet in the of your layout template.
You can do this either by manually including the files via a javascript_include_tag
and a stylesheet_link_tag
(the files are both named "simple_datepicker"), OR by using the included simple_datepicker_includes
helper method, which will do this for you.
Attention: simple_datepicker.js must be called after prototype.js and scriptaculous.js
simple_datepicker_for(field_id, options = {})
You can set $DATEPICKER_OPTIONS with default options in your initializers (or environment.rb)
Put default language in initializers/simple_datepicker_helper.rb
$SIMPLE_DATEPICKER_OPTIONS = {:language => 'pt'}
Put this code in your view:
<p>
<label for="person_birthday">Birthday</label><br/>
<%= text_field "person" , "birthday" %>
</p>
<%= simple_datepicker_for "person_birthday", {:keepFieldEmpty => true} %>
The following line will be generated:
<script type="text/javascript">
//<![CDATA[
var simple_datepicker_person_birthday = new DatePicker({"language": "pt", "relative": "person_birthday", "keepFieldEmpty": true});
//]]>
</script>
All options are available at:
http://www.eulerian.com/en/opensource/datepicker-prototype-scriptaculous
Simple Datepicker Helper is released under the MIT License.
Working at BielSystems
Blog: http://rafael.adm.br
Podcast: http://rafael.adm.br/voltandopracasa
Github: http://github.com/rafaelp
Twitter: http://twitter.com/rafaelp