No commit activity in last 3 years
No release in over 3 years
"Enhances ActionView with a customizable date select form helper where any valid HTML attribute can be applied."
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 2.2, ~> 2.2
>= 0.8, ~> 0.8
~> 0, >= 0.2
~> 1.10, >= 1.10.1
>= 1.9
~> 13.0, >= 13.0.1
>= 3.9.0, ~> 3.9
>= 3.9, ~> 3.9
>= 3.6.0, ~> 3.6
>= 0.9.1
 Project Readme

enhanced_date_select

Gem Version Build Status Coverage Status Code Climate Repo Size Gem Downloads Analytics

Overview

An enhanced date select form helper that allows you to use the full HTML specification for date_select helper methods from rails. This is more than what you get with the default Rails date select helper because it can allow values to persist in dropdowns even if you submit a invalid value.

Features

  • Fully customizable HTML5 attributes for date_select .

Requirements

  1. Ruby 1.9.x or Ruby 2.x.x
  2. Ruby On Rails

Compatibility

  • Rails >= 4.0 only. MRI >= 2.2.0

  • JRuby is not offically supported.

We will accept further compatibilty pull-requests but no upcoming versions will be tested against it.

Rubinius support temporarily dropped due to Rails 4 incompatibility.

Setup

Type the following from the command line to install:

  gem install enhanced_date_select

Add the following to your Gemfile:

gem "enhanced_date_select"

Usage

Use the enhanced_date_select instead of date_select helper methods in your views. Example:

form.enhanced_date_select :birthday,
{
  :prompt =>
  {
    :day => "please select one",
    :month => "please select one",
    :year => "please select one"
  },
  :value =>
  {
    :year => @year,
    :month => @month,
    :day => @day
  },
  :order => [:day, :month, :year],
  :start_year => Time.now.year,
  :end_year => 1940
},
{
 :class => "input_3cols"
}

...or alternatively:

form.enhanced_date_select :birthday,
{
  :prompt =>
  {
    :day => "please select one",
    :month => "please select one",
    :year => "please select one"
  },
  :value => Date.new(2011,02,01),
  :order => [:day, :month, :year],
  :start_year => Time.now.year,
  :end_year => 1940
},
{
 :class => "input_3cols"
}

The enhanced_date_select takes all the standard options as the default Rails date_select method. The only difference is that it expects an hash with values for year, month and day instead of an date object.

Testing

To test, do the following:

  1. cd to the gem root.
  2. bundle install
  3. bundle exec rake

Contributions


Please log all feedback/issues via Github Issues. Thanks.

Contributing to enhanced_date_select

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
  • Fork the project.
  • Start a feature/bugfix branch.
  • Commit and push until you are happy with your contribution.
  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright

Copyright (c) 2012 bogdanRada. See LICENSE.txt for further details.