simple_form 3.0.3 → 3.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of simple_form might be problematic. Click here for more details.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffed0afbf1694b8176a255206fc6d658e4a539af
|
4
|
+
data.tar.gz: 7af2a7a0199551b2b17491d9510c2477aa125265
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bbf22389176622fe689c4d401526d5c973124245cb3b587b3ff2428053377930a358c31eaf8088ffb2b030cef016d0b59ee790984fdedd1219c4d3daab76ff23
|
7
|
+
data.tar.gz: a3e826bd625da954e73d5df1cfe546117024c5b7eb08a1ea9eb37e187e25b3479d9549a13b6e853520e68e8eb3d54ed1ead89e2f0de7318df3478d624654c611
|
data/CHANGELOG.md
CHANGED
@@ -136,11 +136,13 @@ module SimpleForm
|
|
136
136
|
# name="user[name]" type="text" value="Carlos" />
|
137
137
|
#
|
138
138
|
def input_field(attribute_name, options={})
|
139
|
+
components = (wrapper.components & ATTRIBUTE_COMPONENTS)
|
140
|
+
|
139
141
|
options = options.dup
|
140
|
-
options[:input_html] = options.except(:as, :collection, :label_method, :value_method, *
|
142
|
+
options[:input_html] = options.except(:as, :collection, :label_method, :value_method, *components)
|
141
143
|
options = @defaults.deep_dup.deep_merge(options) if @defaults
|
142
144
|
|
143
|
-
SimpleForm::Wrappers::Root.new(
|
145
|
+
SimpleForm::Wrappers::Root.new(components + [:input], wrapper: false).render find_input(attribute_name, options)
|
144
146
|
end
|
145
147
|
|
146
148
|
# Helper for dealing with association selects/radios, generating the
|
@@ -35,7 +35,7 @@ module SimpleForm
|
|
35
35
|
# reuse the method for nested boolean style, but with no unchecked value,
|
36
36
|
# which won't generate the hidden checkbox. This is the default functionality
|
37
37
|
# in Rails > 3.2.1, and is backported in SimpleForm AV helpers.
|
38
|
-
def build_check_box(unchecked_value = unchecked_value)
|
38
|
+
def build_check_box(unchecked_value = unchecked_value())
|
39
39
|
@builder.check_box(attribute_name, input_html_options, checked_value, unchecked_value)
|
40
40
|
end
|
41
41
|
|
data/lib/simple_form/version.rb
CHANGED
@@ -122,4 +122,44 @@ class InputFieldTest < ActionView::TestCase
|
|
122
122
|
assert_no_select 'select.status[label_method]'
|
123
123
|
assert_no_select 'select.status[value_method]'
|
124
124
|
end
|
125
|
+
|
126
|
+
test 'build input_field without pattern component use the pattern string' do
|
127
|
+
swap_wrapper :default, self.custom_wrapper_with_html5_components do
|
128
|
+
with_concat_form_for(@user) do |f|
|
129
|
+
f.input_field :name, pattern: '\w+'
|
130
|
+
end
|
131
|
+
|
132
|
+
assert_select 'input[pattern="\w+"]'
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
test 'build input_field without placeholder component use the placeholder string' do
|
137
|
+
swap_wrapper :default, self.custom_wrapper_with_html5_components do
|
138
|
+
with_concat_form_for(@user) do |f|
|
139
|
+
f.input_field :name, placeholder: 'Placeholder'
|
140
|
+
end
|
141
|
+
|
142
|
+
assert_select 'input[placeholder="Placeholder"]'
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
test 'build input_field without maxlength component use the maxlength string' do
|
147
|
+
swap_wrapper :default, self.custom_wrapper_with_html5_components do
|
148
|
+
with_concat_form_for(@user) do |f|
|
149
|
+
f.input_field :name, maxlength: 5
|
150
|
+
end
|
151
|
+
|
152
|
+
assert_select 'input[maxlength="5"]'
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
test 'build input_field without readonly component use the readonly string' do
|
157
|
+
swap_wrapper :default, self.custom_wrapper_with_html5_components do
|
158
|
+
with_concat_form_for(@user) do |f|
|
159
|
+
f.input_field :name, readonly: true
|
160
|
+
end
|
161
|
+
|
162
|
+
assert_select 'input[readonly="readonly"]'
|
163
|
+
end
|
164
|
+
end
|
125
165
|
end
|
@@ -112,6 +112,12 @@ module MiscHelpers
|
|
112
112
|
end
|
113
113
|
end
|
114
114
|
|
115
|
+
def custom_wrapper_with_html5_components
|
116
|
+
SimpleForm.build tag: :span, class: 'custom_wrapper' do |b|
|
117
|
+
b.use :label_text
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
115
121
|
def custom_form_for(object, *args, &block)
|
116
122
|
simple_form_for(object, *args, { builder: CustomFormBuilder }, &block)
|
117
123
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_form
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- José Valim
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2015-07-30 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activemodel
|
@@ -165,7 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
165
165
|
version: '0'
|
166
166
|
requirements: []
|
167
167
|
rubyforge_project: simple_form
|
168
|
-
rubygems_version: 2.
|
168
|
+
rubygems_version: 2.4.8
|
169
169
|
signing_key:
|
170
170
|
specification_version: 4
|
171
171
|
summary: Forms made easy!
|
@@ -206,3 +206,4 @@ test_files:
|
|
206
206
|
- test/support/mock_controller.rb
|
207
207
|
- test/support/models.rb
|
208
208
|
- test/test_helper.rb
|
209
|
+
has_rdoc:
|