Skip to content

Instantly share code, notes, and snippets.

View mvilrokx's full-sized avatar

Mark Vilrokx mvilrokx

View GitHub Profile
@mvilrokx
mvilrokx / jquery-ui-datepicker-rails-part3.html.haml
Created February 27, 2012 19:37
Adding jquery-ui datepicker to rails view with Alternate Field and format
# 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', :value => @bp_reading.try(:recorded_at).try(:strftime,'%m/%d/%Y')}
= f.input :recorded_at, :as => :hidden, :input_html => { :id => 'recorded-at-alt'}
= f.button :submit, :disable_with => "Saving...", :value => "Save"
# in your javascript (coffeescript)
$ ->
$(".jquery-ui-date").datepicker(
altField: "#recorded-at-alt",
@mvilrokx
mvilrokx / jquery-ui-datepicker-rails-part2.html.haml
Created February 27, 2012 19:16
Adding jquery-ui datepicker to rails view with Alternate Field and format
# 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.input :recorded_at, :as => :hidden, :input_html => { :id => 'recorded-at-alt'}
= f.button :submit, :disable_with => "Saving...", :value => "Save"
# in your javascript (coffeescript)
$ ->
$(".jquery-ui-date").datepicker(
altField: "#recorded-at-alt",
@mvilrokx
mvilrokx / jquery-ui-datepicker-rails-part1.html.haml
Created February 27, 2012 19:01
Adding jquery-ui datepicker to rails view
# 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)
@mvilrokx
mvilrokx / test.rb
Created July 26, 2011 22:05
test tumblr integration
puts "hello world"