Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
An input plugin for Formtastic to render date fields using the Rails Date Kit.
branch: master

Updated version to work with formtastic 0.9.2 and above.

WARNING - Breaks backwards compatibility with 0.9.1 and lower
latest commit 8566209138
Paul Smith authored
Failed to load latest commit information.
generators/formtastic_calendar Fixed calendar.css
lib Updated version to work with formtastic 0.9.2 and above.
tasks First Commit
test First Commit
MIT-LICENSE First Commit
README.textile Tweaks to README
Rakefile First Commit
init.rb First Commit

README.textile

FormtasticCalendar

An extension for Formtastic1 to generate lightweight javascript calendar date inputs using the Rails Date Kit2

Example

Where Task#due_date is a :date field

<% semantic_form_for @task do |form| %>
  <% form.inputs do %>
    <%= form.input :due_date, :as => :calendar, :format => '%d %b %Y' %>
  <% end %>
<% end %>

:format is optional as it will default to the local default date format as defined in ActiveSupport::CoreExtensions::Date::Conversions::DATE_FORMATS.

Dependencies

You must have the formtastic gem/plugin added to your application.

Required images, javascript and stylesheet can be installed using the generator:

./script/generate formtastic_calendar

Don’t forget to add them to your application layout

<%= stylesheet_link_tag 'calendar' %>
<%= javascript_include_tag 'calendar' %>

Todo

Test, test, test…

Attempt to port this to unobtrusive javascript, and provide graceful degradation if possible.

References

1 Formtastic @ GitHub

2 Rails Date Kit

Copyright © 2009 Paul Smith, released under the MIT license

Something went wrong with that request. Please try again.