enhanced_date_select 1.2.3 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +0 -2
- data/Appraisals +8 -0
- data/README.md +131 -0
- data/Rakefile +2 -2
- data/enhanced_date_select.gemspec +6 -13
- data/lib/version.rb +1 -1
- metadata +25 -108
- data/Guardfile +0 -12
- data/README.rdoc +0 -97
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 899f96e0abe2e7b207bc0d18682e9e26ddf9a772
|
4
|
+
data.tar.gz: 220b7d0389f0e03facbc331b0162ee9e656cd129
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5aef8b7ed23445a489459d788bb22a9e3906132b7b6e895af3eff57072381df4317e8f6174e37daab5d3d60ddeeb43e3a132f42607bc080b805ad50d1ae0946d
|
7
|
+
data.tar.gz: c43ce1d70f83d6f3ef8096b0280f29dda868707594e4d5b71e79a1aac524cc7e031e1193df21969703232aeec222ed83d5c94b49d8205c76abfeb6cbbb1dd3e8
|
data/.rubocop.yml
CHANGED
data/Appraisals
CHANGED
data/README.md
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
enhanced_date_select
|
2
|
+
====================
|
3
|
+
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/enhanced_date_select.svg)](http://badge.fury.io/rb/enhanced_date_select) [![Build Status](https://travis-ci.org/bogdanRada/enhanced_date_select.png?branch=master,develop)](https://travis-ci.org/bogdanRada/enhanced_date_select) [![Coverage Status](https://coveralls.io/repos/bogdanRada/enhanced_date_select/badge.svg?branch=master)](https://coveralls.io/r/bogdanRada/enhanced_date_select?branch=master) [![Code Climate](https://codeclimate.com/github/bogdanRada/enhanced_date_select/badges/gpa.svg)](https://codeclimate.com/github/bogdanRada/enhanced_date_select) [![Repo Size](https://reposs.herokuapp.com/?path=bogdanRada/enhanced_date_select)](https://github.com/bogdanRada/enhanced_date_select) [![Gem Downloads](https://ruby-gem-downloads-badge.herokuapp.com/enhanced_date_select?type=total)](https://github.com/bogdanRada/enhanced_date_select) [![Analytics](https://ga-beacon.appspot.com/UA-72570203-1/bogdanRada/enhanced_date_select)](https://github.com/bogdanRada/enhanced_date_select)
|
5
|
+
|
6
|
+
Overview
|
7
|
+
--------
|
8
|
+
|
9
|
+
An enhanced date select form helper that allows you to use the full [HTML specification](http://www.w3.org/TR/html5) 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.
|
10
|
+
|
11
|
+
Features
|
12
|
+
--------
|
13
|
+
|
14
|
+
- Fully customizable HTML5 attributes for date_select .
|
15
|
+
|
16
|
+
Requirements
|
17
|
+
------------
|
18
|
+
|
19
|
+
1. [Ruby 1.9.x or Ruby 2.x.x](http://www.ruby-lang.org)
|
20
|
+
2. [Ruby On Rails](http://rubyonrails.org)
|
21
|
+
|
22
|
+
Compatibility
|
23
|
+
-------------
|
24
|
+
|
25
|
+
- Rails >3.0 only. MRI 1.9, 2.x.
|
26
|
+
|
27
|
+
- JRuby is not offically supported.
|
28
|
+
|
29
|
+
- Ruby 1.8 is not officially supported.
|
30
|
+
|
31
|
+
We will accept further compatibilty pull-requests but no upcoming versions will be tested against it.
|
32
|
+
|
33
|
+
Rubinius support temporarily dropped due to Rails 4 incompatibility.
|
34
|
+
|
35
|
+
Setup
|
36
|
+
-----
|
37
|
+
|
38
|
+
Type the following from the command line to install:
|
39
|
+
|
40
|
+
```ruby
|
41
|
+
gem install enhanced_date_select
|
42
|
+
```
|
43
|
+
|
44
|
+
Add the following to your Gemfile:
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
gem "enhanced_date_select"
|
48
|
+
```
|
49
|
+
|
50
|
+
Usage
|
51
|
+
-----
|
52
|
+
|
53
|
+
Use the **enhanced_date_select** instead of **date_select** helper methods in your views. Example:
|
54
|
+
|
55
|
+
```ruby
|
56
|
+
form.enhanced_date_select :birthday,
|
57
|
+
{
|
58
|
+
:prompt =>
|
59
|
+
{
|
60
|
+
:day => "please select one",
|
61
|
+
:month => "please select one",
|
62
|
+
:year => "please select one"
|
63
|
+
},
|
64
|
+
:value =>
|
65
|
+
{
|
66
|
+
:year => @year,
|
67
|
+
:month => @month,
|
68
|
+
:day => @day
|
69
|
+
},
|
70
|
+
:order => [:day, :month, :year],
|
71
|
+
:start_year => Time.now.year,
|
72
|
+
:end_year => 1940
|
73
|
+
},
|
74
|
+
{
|
75
|
+
:class => "input_3cols"
|
76
|
+
}
|
77
|
+
```
|
78
|
+
|
79
|
+
...or alternatively:
|
80
|
+
|
81
|
+
```ruby
|
82
|
+
form.enhanced_date_select :birthday,
|
83
|
+
{
|
84
|
+
:prompt =>
|
85
|
+
{
|
86
|
+
:day => "please select one",
|
87
|
+
:month => "please select one",
|
88
|
+
:year => "please select one"
|
89
|
+
},
|
90
|
+
:value => Date.new(2011,02,01),
|
91
|
+
:order => [:day, :month, :year],
|
92
|
+
:start_year => Time.now.year,
|
93
|
+
:end_year => 1940
|
94
|
+
},
|
95
|
+
{
|
96
|
+
:class => "input_3cols"
|
97
|
+
}
|
98
|
+
```
|
99
|
+
|
100
|
+
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.
|
101
|
+
|
102
|
+
Testing
|
103
|
+
-------
|
104
|
+
|
105
|
+
To test, do the following:
|
106
|
+
|
107
|
+
1. cd to the gem root.
|
108
|
+
2. bundle install
|
109
|
+
3. bundle exec rake
|
110
|
+
|
111
|
+
Contributions
|
112
|
+
|
113
|
+
---
|
114
|
+
|
115
|
+
Please log all feedback/issues via [Github Issues](http://github.com/bogdanRada/enhanced_date_select/issues). Thanks.
|
116
|
+
|
117
|
+
Contributing to enhanced_date_select
|
118
|
+
------------------------------------
|
119
|
+
|
120
|
+
- Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
121
|
+
- Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
122
|
+
- Fork the project.
|
123
|
+
- Start a feature/bugfix branch.
|
124
|
+
- Commit and push until you are happy with your contribution.
|
125
|
+
- Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
126
|
+
- 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.
|
127
|
+
|
128
|
+
Copyright
|
129
|
+
---------
|
130
|
+
|
131
|
+
Copyright (c) 2012 bogdanRada. See LICENSE.txt for further details.
|
data/Rakefile
CHANGED
@@ -27,9 +27,9 @@ task default: [:all]
|
|
27
27
|
desc 'Test the plugin under all supported Rails versions.'
|
28
28
|
task :all do
|
29
29
|
if ENV['TRAVIS']
|
30
|
-
exec('bundle exec
|
30
|
+
exec('bundle exec appraisal install && bundle exec rake appraisal spec && bundle exec rake coveralls:push')
|
31
31
|
else
|
32
|
-
exec('bundle exec
|
32
|
+
exec('bundle exec appraisal install && bundle exec rake appraisal spec')
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
@@ -12,30 +12,23 @@ Gem::Specification.new do |s|
|
|
12
12
|
|
13
13
|
s.date = Date.today
|
14
14
|
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE.txt",
|
17
|
-
"README.rdoc"
|
18
|
-
]
|
19
15
|
s.licenses = ["MIT"]
|
20
16
|
s.files = `git ls-files`.split("\n")
|
21
17
|
s.test_files = s.files.grep(/^(spec)/)
|
22
18
|
s.require_paths = ["lib"]
|
23
19
|
s.required_ruby_version = '>= 1.9'
|
24
20
|
|
25
|
-
s.add_development_dependency 'appraisal', '~> 2.
|
21
|
+
s.add_development_dependency 'appraisal', '~> 2.1', '>= 2.1'
|
26
22
|
s.add_development_dependency 'coveralls','~> 0.8', '>= 0.8'
|
27
|
-
s.add_development_dependency 'guard', '~> 2.13', '>= 2.13'
|
28
|
-
s.add_development_dependency 'guard-rspec', '~> 4.6', '>= 4.6'
|
29
23
|
s.add_development_dependency 'lorax', '~> 0', '>= 0.2'
|
30
24
|
s.add_development_dependency 'mocha','~> 1.1', '>= 1.1.0'
|
31
25
|
s.add_development_dependency 'nokogiri', '~> 1.6', '>= 1.6'
|
32
|
-
s.add_development_dependency '
|
33
|
-
s.add_development_dependency '
|
34
|
-
s.add_development_dependency 'rspec-
|
35
|
-
|
36
|
-
s.add_development_dependency 'rubocop', '~>0.33' , '>= 0.33'
|
26
|
+
s.add_development_dependency 'rake', '~> 10.5', '>= 10.5'
|
27
|
+
s.add_development_dependency 'rspec-mocks', '~>3.4', '>= 3.4'
|
28
|
+
s.add_development_dependency 'rspec-rails', '~> 3.4', '>= 3.4'
|
29
|
+
|
37
30
|
s.add_development_dependency 'shoulda', '~> 3.5', '>= 3.5.0'
|
38
|
-
s.add_development_dependency 'simplecov', '~> 0.
|
31
|
+
s.add_development_dependency 'simplecov', '~> 0.11', '>= 0.11'
|
39
32
|
s.add_development_dependency 'simplecov-summary', '~> 0.0', '>= 0.0.4'
|
40
33
|
|
41
34
|
end
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enhanced_date_select
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bogdanRada
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: appraisal
|
@@ -16,20 +16,20 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '2.
|
19
|
+
version: '2.1'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '2.
|
22
|
+
version: '2.1'
|
23
23
|
type: :development
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - "~>"
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '2.
|
29
|
+
version: '2.1'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '2.
|
32
|
+
version: '2.1'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: coveralls
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -50,46 +50,6 @@ dependencies:
|
|
50
50
|
- - ">="
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: '0.8'
|
53
|
-
- !ruby/object:Gem::Dependency
|
54
|
-
name: guard
|
55
|
-
requirement: !ruby/object:Gem::Requirement
|
56
|
-
requirements:
|
57
|
-
- - "~>"
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
version: '2.13'
|
60
|
-
- - ">="
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: '2.13'
|
63
|
-
type: :development
|
64
|
-
prerelease: false
|
65
|
-
version_requirements: !ruby/object:Gem::Requirement
|
66
|
-
requirements:
|
67
|
-
- - "~>"
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: '2.13'
|
70
|
-
- - ">="
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
version: '2.13'
|
73
|
-
- !ruby/object:Gem::Dependency
|
74
|
-
name: guard-rspec
|
75
|
-
requirement: !ruby/object:Gem::Requirement
|
76
|
-
requirements:
|
77
|
-
- - "~>"
|
78
|
-
- !ruby/object:Gem::Version
|
79
|
-
version: '4.6'
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '4.6'
|
83
|
-
type: :development
|
84
|
-
prerelease: false
|
85
|
-
version_requirements: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '4.6'
|
90
|
-
- - ">="
|
91
|
-
- !ruby/object:Gem::Version
|
92
|
-
version: '4.6'
|
93
53
|
- !ruby/object:Gem::Dependency
|
94
54
|
name: lorax
|
95
55
|
requirement: !ruby/object:Gem::Requirement
|
@@ -150,106 +110,66 @@ dependencies:
|
|
150
110
|
- - ">="
|
151
111
|
- !ruby/object:Gem::Version
|
152
112
|
version: '1.6'
|
153
|
-
- !ruby/object:Gem::Dependency
|
154
|
-
name: phare
|
155
|
-
requirement: !ruby/object:Gem::Requirement
|
156
|
-
requirements:
|
157
|
-
- - "~>"
|
158
|
-
- !ruby/object:Gem::Version
|
159
|
-
version: '0.7'
|
160
|
-
- - ">="
|
161
|
-
- !ruby/object:Gem::Version
|
162
|
-
version: '0.7'
|
163
|
-
type: :development
|
164
|
-
prerelease: false
|
165
|
-
version_requirements: !ruby/object:Gem::Requirement
|
166
|
-
requirements:
|
167
|
-
- - "~>"
|
168
|
-
- !ruby/object:Gem::Version
|
169
|
-
version: '0.7'
|
170
|
-
- - ">="
|
171
|
-
- !ruby/object:Gem::Version
|
172
|
-
version: '0.7'
|
173
113
|
- !ruby/object:Gem::Dependency
|
174
114
|
name: rake
|
175
115
|
requirement: !ruby/object:Gem::Requirement
|
176
116
|
requirements:
|
177
117
|
- - "~>"
|
178
118
|
- !ruby/object:Gem::Version
|
179
|
-
version: '10.
|
119
|
+
version: '10.5'
|
180
120
|
- - ">="
|
181
121
|
- !ruby/object:Gem::Version
|
182
|
-
version: '10.
|
122
|
+
version: '10.5'
|
183
123
|
type: :development
|
184
124
|
prerelease: false
|
185
125
|
version_requirements: !ruby/object:Gem::Requirement
|
186
126
|
requirements:
|
187
127
|
- - "~>"
|
188
128
|
- !ruby/object:Gem::Version
|
189
|
-
version: '10.
|
129
|
+
version: '10.5'
|
190
130
|
- - ">="
|
191
131
|
- !ruby/object:Gem::Version
|
192
|
-
version: '10.
|
132
|
+
version: '10.5'
|
193
133
|
- !ruby/object:Gem::Dependency
|
194
134
|
name: rspec-mocks
|
195
135
|
requirement: !ruby/object:Gem::Requirement
|
196
136
|
requirements:
|
197
137
|
- - "~>"
|
198
138
|
- !ruby/object:Gem::Version
|
199
|
-
version: '3.
|
139
|
+
version: '3.4'
|
200
140
|
- - ">="
|
201
141
|
- !ruby/object:Gem::Version
|
202
|
-
version: '3.
|
142
|
+
version: '3.4'
|
203
143
|
type: :development
|
204
144
|
prerelease: false
|
205
145
|
version_requirements: !ruby/object:Gem::Requirement
|
206
146
|
requirements:
|
207
147
|
- - "~>"
|
208
148
|
- !ruby/object:Gem::Version
|
209
|
-
version: '3.
|
149
|
+
version: '3.4'
|
210
150
|
- - ">="
|
211
151
|
- !ruby/object:Gem::Version
|
212
|
-
version: '3.
|
152
|
+
version: '3.4'
|
213
153
|
- !ruby/object:Gem::Dependency
|
214
154
|
name: rspec-rails
|
215
155
|
requirement: !ruby/object:Gem::Requirement
|
216
156
|
requirements:
|
217
157
|
- - "~>"
|
218
158
|
- !ruby/object:Gem::Version
|
219
|
-
version: '3.
|
220
|
-
- - ">="
|
221
|
-
- !ruby/object:Gem::Version
|
222
|
-
version: '3.3'
|
223
|
-
type: :development
|
224
|
-
prerelease: false
|
225
|
-
version_requirements: !ruby/object:Gem::Requirement
|
226
|
-
requirements:
|
227
|
-
- - "~>"
|
228
|
-
- !ruby/object:Gem::Version
|
229
|
-
version: '3.3'
|
230
|
-
- - ">="
|
231
|
-
- !ruby/object:Gem::Version
|
232
|
-
version: '3.3'
|
233
|
-
- !ruby/object:Gem::Dependency
|
234
|
-
name: rubocop
|
235
|
-
requirement: !ruby/object:Gem::Requirement
|
236
|
-
requirements:
|
237
|
-
- - "~>"
|
238
|
-
- !ruby/object:Gem::Version
|
239
|
-
version: '0.33'
|
159
|
+
version: '3.4'
|
240
160
|
- - ">="
|
241
161
|
- !ruby/object:Gem::Version
|
242
|
-
version: '
|
162
|
+
version: '3.4'
|
243
163
|
type: :development
|
244
164
|
prerelease: false
|
245
165
|
version_requirements: !ruby/object:Gem::Requirement
|
246
166
|
requirements:
|
247
167
|
- - "~>"
|
248
168
|
- !ruby/object:Gem::Version
|
249
|
-
version: '
|
169
|
+
version: '3.4'
|
250
170
|
- - ">="
|
251
171
|
- !ruby/object:Gem::Version
|
252
|
-
version: '
|
172
|
+
version: '3.4'
|
253
173
|
- !ruby/object:Gem::Dependency
|
254
174
|
name: shoulda
|
255
175
|
requirement: !ruby/object:Gem::Requirement
|
@@ -276,20 +196,20 @@ dependencies:
|
|
276
196
|
requirements:
|
277
197
|
- - "~>"
|
278
198
|
- !ruby/object:Gem::Version
|
279
|
-
version: '0.
|
199
|
+
version: '0.11'
|
280
200
|
- - ">="
|
281
201
|
- !ruby/object:Gem::Version
|
282
|
-
version: '0.
|
202
|
+
version: '0.11'
|
283
203
|
type: :development
|
284
204
|
prerelease: false
|
285
205
|
version_requirements: !ruby/object:Gem::Requirement
|
286
206
|
requirements:
|
287
207
|
- - "~>"
|
288
208
|
- !ruby/object:Gem::Version
|
289
|
-
version: '0.
|
209
|
+
version: '0.11'
|
290
210
|
- - ">="
|
291
211
|
- !ruby/object:Gem::Version
|
292
|
-
version: '0.
|
212
|
+
version: '0.11'
|
293
213
|
- !ruby/object:Gem::Dependency
|
294
214
|
name: simplecov-summary
|
295
215
|
requirement: !ruby/object:Gem::Requirement
|
@@ -315,9 +235,7 @@ description: '"Enhances ActionView with a customizable date select form helper w
|
|
315
235
|
email: raoul_ice@yahoo.com
|
316
236
|
executables: []
|
317
237
|
extensions: []
|
318
|
-
extra_rdoc_files:
|
319
|
-
- LICENSE.txt
|
320
|
-
- README.rdoc
|
238
|
+
extra_rdoc_files: []
|
321
239
|
files:
|
322
240
|
- ".coveralls.yml"
|
323
241
|
- ".gitignore"
|
@@ -326,9 +244,8 @@ files:
|
|
326
244
|
- ".travis.yml"
|
327
245
|
- Appraisals
|
328
246
|
- Gemfile
|
329
|
-
- Guardfile
|
330
247
|
- LICENSE.txt
|
331
|
-
- README.
|
248
|
+
- README.md
|
332
249
|
- Rakefile
|
333
250
|
- enhanced_date_select.gemspec
|
334
251
|
- lib/enhanced_date_select.rb
|
@@ -355,7 +272,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
355
272
|
version: '0'
|
356
273
|
requirements: []
|
357
274
|
rubyforge_project:
|
358
|
-
rubygems_version: 2.
|
275
|
+
rubygems_version: 2.5.1
|
359
276
|
signing_key:
|
360
277
|
specification_version: 4
|
361
278
|
summary: '"enhanced date select"'
|
data/Guardfile
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
# More info at https://github.com/guard/guard#readme
|
2
|
-
|
3
|
-
# Could be changed to whatever you want.
|
4
|
-
# See: https://github.com/guard/guard#notification
|
5
|
-
notification :off
|
6
|
-
|
7
|
-
guard 'rspec' do
|
8
|
-
watch %r{^spec/.+_spec\.rb$}
|
9
|
-
watch %r{lib/} do 'spec' end
|
10
|
-
end
|
11
|
-
|
12
|
-
# vim:ft=ruby
|
data/README.rdoc
DELETED
@@ -1,97 +0,0 @@
|
|
1
|
-
= enhanced_date_select {<img src="https://badge.fury.io/rb/enhanced_date_select.png" alt="Gem Version" />}[http://badge.fury.io/rb/enhanced_date_select]
|
2
|
-
{<img src="https://travis-ci.org/bogdanRada/enhanced_date_select.png" />}[https://travis-ci.org/bogdanRada/enhanced_date_select]
|
3
|
-
{<img src="https://coveralls.io/repos/bogdanRada/enhanced_date_select/badge.png" alt="Coverage Status" />}[https://coveralls.io/r/bogdanRada/enhanced_date_select]
|
4
|
-
{<img src="https://codeclimate.com/github/bogdanRada/enhanced_date_select.png" />}[https://codeclimate.com/github/bogdanRada/enhanced_date_select]
|
5
|
-
{<img src="https://reposs.herokuapp.com/?path=bogdanRada/enhanced_date_select" alt="Repo Size"/>}[https://github.com/bogdanRada/enhanced_date_select]
|
6
|
-
{<img src="https://ruby-gem-downloads-badge.herokuapp.com/enhanced_date_select?type=total&style=dynamic" alt="Version Downloads"/>}[https://rubygems.org/gems/enhanced_date_select]
|
7
|
-
{<img src="http://stillmaintained.com/bogdanRada/enhanced_date_select.png" alt=""/>}[https://rubygems.org/gems/enhanced_date_select]
|
8
|
-
|
9
|
-
= Overview
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
An enhanced date select form helper that allows you to use the full {HTML spec}[http://www.w3.org/TR/html5] for date_select helper methods from rails. This is more than what you get with the
|
14
|
-
default Rails date select helper because it can allow values to persist in dropdowns even if you submit a invalid value.
|
15
|
-
|
16
|
-
= Features
|
17
|
-
|
18
|
-
* Fully customizable HTML5 attributes for date_select .
|
19
|
-
|
20
|
-
= Requirements
|
21
|
-
|
22
|
-
1. {Ruby 1.9.x}[http://www.ruby-lang.org]
|
23
|
-
2. {Ruby on Rails}[http://rubyonrails.org].
|
24
|
-
|
25
|
-
= Setup
|
26
|
-
|
27
|
-
Type the following from the command line to install:
|
28
|
-
|
29
|
-
gem install enhanced_date_select
|
30
|
-
|
31
|
-
Add the following to your Gemfile:
|
32
|
-
|
33
|
-
gem "enhanced_date_select"
|
34
|
-
|
35
|
-
= Usage
|
36
|
-
|
37
|
-
Use the +enhanced_date_select+ instead of +date_select+ helper
|
38
|
-
methods in your views. Example:
|
39
|
-
|
40
|
-
<%= form_for @post do |form| %>
|
41
|
-
<div >
|
42
|
-
<%= form.enhanced_date_select :birthday, { :prompt => {
|
43
|
-
:day => "please select one",
|
44
|
-
:month => "please select one",
|
45
|
-
:year => "please select one" },
|
46
|
-
:value => {:year => @year, :month => @month, :day => @day},
|
47
|
-
:order => [:day, :month, :year],
|
48
|
-
:start_year => Time.now.year,
|
49
|
-
:end_year => 1940 }, { :class => "input_3cols" } %>
|
50
|
-
</div>
|
51
|
-
<% end %>
|
52
|
-
|
53
|
-
...or alternatively:
|
54
|
-
|
55
|
-
<%= form_for @post do |form| %>
|
56
|
-
<div >
|
57
|
-
<%= form.date_select :birthday, { :prompt => {
|
58
|
-
:day => "please select one",
|
59
|
-
:month => "please select one",
|
60
|
-
:year => "please select one" },
|
61
|
-
:value => Date.new(2011,02,01),
|
62
|
-
:order => [:day, :month, :year],
|
63
|
-
:start_year => Time.now.year,
|
64
|
-
:end_year => 1940 }, { :class => "input_3cols" } %>
|
65
|
-
</div>
|
66
|
-
<% end %>
|
67
|
-
|
68
|
-
The +enhanced_date_select+ takes all the standard options as the default Rails date_select
|
69
|
-
method. The only difference is that it expects an hash with values for year, month and day instead of an date object.
|
70
|
-
|
71
|
-
= Testing
|
72
|
-
|
73
|
-
To test, do the following:
|
74
|
-
|
75
|
-
1. cd to the gem root.
|
76
|
-
2. bundle install
|
77
|
-
3. bundle exec rake
|
78
|
-
|
79
|
-
= Contributions
|
80
|
-
|
81
|
-
Please log all feedback/issues via {GitHub Issues}[http://github.com/bogdanRada/enhanced_date_select/issues]. Thanks.
|
82
|
-
|
83
|
-
|
84
|
-
== Contributing to enhanced_date_select
|
85
|
-
|
86
|
-
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
87
|
-
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
88
|
-
* Fork the project.
|
89
|
-
* Start a feature/bugfix branch.
|
90
|
-
* Commit and push until you are happy with your contribution.
|
91
|
-
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
92
|
-
* 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.
|
93
|
-
|
94
|
-
== Copyright
|
95
|
-
|
96
|
-
Copyright (c) 2012 bogdanRada. See LICENSE.txt for
|
97
|
-
further details.
|