Ruby on Rails helper for Eulerian Javascript Datepicker
Ruby
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 7 commits ahead of rafaelp:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
assets
lib
test
MIT-LICENSE
README
README.mkdn
Rakefile
TODO
init.rb
install.rb
uninstall.rb

README.mkdn

#Simple Datepicker Helper

Example with formtastic: = f.input :bathing_season_end, :as => :string, :input_html => {:class => "datepicker"}

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