formulate 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/formulate.gemspec +1 -0
- data/lib/formulate/form_builder.rb +18 -0
- data/lib/formulate/version.rb +1 -1
- metadata +18 -2
data/README.md
CHANGED
data/formulate.gemspec
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'carmen'
|
2
|
+
|
1
3
|
module Formulate
|
2
4
|
class FormBuilder < ActionView::Helpers::FormBuilder
|
3
5
|
def errors
|
@@ -72,6 +74,14 @@ module Formulate
|
|
72
74
|
when :time_zone_select
|
73
75
|
priority_zones = options.delete(:priority_zones)
|
74
76
|
send(type, method, priority_zones, options)
|
77
|
+
when :state_select
|
78
|
+
country = options.delete(:country) || Carmen.default_country
|
79
|
+
html_options = options.delete(:html) || {}
|
80
|
+
send(type, method, country, options, html_options)
|
81
|
+
when :country_select
|
82
|
+
priority_countries = options.delete(:priority_countries)
|
83
|
+
html_options = options.delete(:html) || {}
|
84
|
+
send(type, method, priority_countries, options, html_options)
|
75
85
|
else
|
76
86
|
send(type, method, options)
|
77
87
|
end
|
@@ -149,6 +159,14 @@ module Formulate
|
|
149
159
|
input(method, options.merge(type: :datetime_select), &block)
|
150
160
|
end
|
151
161
|
|
162
|
+
def state(method, options={}, &block)
|
163
|
+
input(method, options.merge(type: :state_select), &block)
|
164
|
+
end
|
165
|
+
|
166
|
+
def country(method, options={}, &block)
|
167
|
+
input(method, options.merge(type: :country_select), &block)
|
168
|
+
end
|
169
|
+
|
152
170
|
def expiration(method, options={}, &block)
|
153
171
|
options.reverse_merge!(add_month_numbers: true, discard_day: true, order: [:month, :year], start_year: Date.today.year, prompt: '')
|
154
172
|
input(method, options.merge(type: :date_select), &block)
|
data/lib/formulate/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: formulate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04-
|
12
|
+
date: 2012-04-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionpack
|
@@ -43,6 +43,22 @@ dependencies:
|
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '3.0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: carmen
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 0.2.0
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.2.0
|
46
62
|
- !ruby/object:Gem::Dependency
|
47
63
|
name: haml
|
48
64
|
requirement: !ruby/object:Gem::Requirement
|