Created
February 27, 2012 19:01
-
-
Save mvilrokx/1926279 to your computer and use it in GitHub Desktop.
Adding jquery-ui datepicker to rails view
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# in your application layout (using HAML) | |
= javascript_include_tag '//ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js' | |
= stylesheet_link_tag "//ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/smoothness/jquery-ui.css" | |
# in your view (HAML + simple_form, simplified for easier reading) | |
= simple_form_for @bp_reading do |f| | |
= f.input :recorded_at, :as => :string, :input_html => { :class => 'jquery-ui-date'} | |
= f.button :submit, :disable_with => "Saving...", :value => "Save" | |
# in your javascript (coffeescript) | |
$ -> | |
$(".jquery-ui-date").datepicker() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment