8000 GitHub - muthhus/jquery_datepicker: Rails 3 plugin that allows you to select dates from a calendar
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

muthhus/jquery_datepicker

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jQuery Datepicker Rails plugin

This simple gem allows you to add a date picker field into your views.

Getting Started

  1. Add into your Gemfile:

    gem 'jquery-rails'
    
  2. Execute this command to install the needed js files:

    rails generate jquery:install --ui

    In Rails 3.1 when using the asset pipeline, this generator is deprecated, so you’ll need to add at line to your app/assets/javascripts/application.js:

    //= require jquery-ui

    And then install the jquery-ui CSS. You can get a bundle to match your site from ThemeRoller. From your theme bundle, extract the CSS directory and place it somewhere under app/assets/stylesheets/.

  3. Insert into your Gemfile:

    gem 'jquery_datepicker'
    

Usage

Add this to your view.

<%= datepicker_input "user","birthday" %>

Where “user” is your model name and “birthday” the name of the datefield.

You can also use it with the form helper like:

<% form_for(@user) do |f| %>
  <%= f.datepicker 'birthday' %>
  <%= f.submit 'Create' %>
<% end %>

Nested attributes are permitted as well:

<% form_for(@user) do |f| %>
  <% f.fields_for(@nested) do |f2| %>
    <%= f2.datepicker 'birthday' %>
  <% end %>
  <%= f.submit 'Create' %>
<% end %>

You can pass options as it would be a normal text_field, plus all the datepicker options available (jqueryui.com/demos/datepicker/#options)

<%= datepicker_input(:foo, :att1, :minDate => -20, :maxDate => "+1M +10D", :tabindex => 70) %>

Support

Open an issue in github.com/albertopq/jquery_datepicker if you need further support or want to report a bug

About

Rails 3 plugin that allows you to select dates from a calendar

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0