simple_datepicker_helper

Created: 2008-08-08 03:14
Updated: 2017-06-28 19:12
License: mit

README.mkdn

#Simple Datepicker Helper

This plugin is a Ruby on Rails helper for Eulerian Javascript Datepicker.

DEPENDENCIES

INSTALLATION

$ 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

USAGE

simple_datepicker_for(field_id, options = {})

You can set $DATEPICKER_OPTIONS with default options in your initializers (or environment.rb)

EXAMPLE

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

License

Simple Datepicker Helper is released under the MIT License.

AUTHOR

Rafael Lima

Working at BielSystems

Blog: http://rafael.adm.br

Podcast: http://rafael.adm.br/voltandopracasa

Github: http://github.com/rafaelp

Twitter: http://twitter.com/rafaelp

Did you like?

Recommend me at Working With Rails

Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more