Skip to content

rafaelp/simple_datepicker_helper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#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

About

Ruby on Rails helper for Eulerian Javascript Datepicker

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages