Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

enhanced_date_select

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

enhanced_date_select

  • 1.5.2
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

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 (c) 2012 bogdanRada. See LICENSE.txt for further details.

FAQs

Package last updated on 17 Dec 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc