simple_form 5.0.0 → 5.3.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +49 -8
- data/MIT-LICENSE +2 -1
- data/README.md +96 -51
- data/lib/generators/simple_form/install_generator.rb +2 -2
- data/lib/generators/simple_form/templates/README +2 -3
- data/lib/generators/simple_form/templates/config/initializers/simple_form.rb +2 -2
- data/lib/generators/simple_form/templates/config/initializers/simple_form_bootstrap.rb +127 -195
- data/lib/generators/simple_form/templates/config/initializers/simple_form_foundation.rb +1 -1
- data/lib/simple_form/components/label_input.rb +1 -1
- data/lib/simple_form/components/labels.rb +3 -5
- data/lib/simple_form/components/maxlength.rb +0 -4
- data/lib/simple_form/components/minlength.rb +0 -4
- data/lib/simple_form/form_builder.rb +7 -10
- data/lib/simple_form/inputs/base.rb +0 -3
- data/lib/simple_form/inputs/boolean_input.rb +6 -2
- data/lib/simple_form/inputs/collection_check_boxes_input.rb +1 -1
- data/lib/simple_form/inputs/collection_input.rb +3 -5
- data/lib/simple_form/inputs/grouped_collection_select_input.rb +1 -1
- data/lib/simple_form/inputs/priority_input.rb +16 -2
- data/lib/simple_form/inputs/rich_text_area_input.rb +12 -0
- data/lib/simple_form/inputs.rb +1 -0
- data/lib/simple_form/railtie.rb +4 -0
- data/lib/simple_form/version.rb +1 -1
- data/lib/simple_form/wrappers/leaf.rb +1 -1
- data/lib/simple_form/wrappers/root.rb +8 -3
- data/lib/simple_form.rb +10 -6
- metadata +22 -93
- data/lib/simple_form/i18n_cache.rb +0 -23
- data/test/action_view_extensions/builder_test.rb +0 -634
- data/test/action_view_extensions/form_helper_test.rb +0 -172
- data/test/components/custom_components_test.rb +0 -62
- data/test/components/label_test.rb +0 -356
- data/test/form_builder/association_test.rb +0 -252
- data/test/form_builder/button_test.rb +0 -48
- data/test/form_builder/error_notification_test.rb +0 -80
- data/test/form_builder/error_test.rb +0 -281
- data/test/form_builder/general_test.rb +0 -534
- data/test/form_builder/hint_test.rb +0 -150
- data/test/form_builder/input_field_test.rb +0 -195
- data/test/form_builder/label_test.rb +0 -136
- data/test/form_builder/wrapper_test.rb +0 -371
- data/test/generators/simple_form_generator_test.rb +0 -43
- data/test/inputs/boolean_input_test.rb +0 -243
- data/test/inputs/collection_check_boxes_input_test.rb +0 -327
- data/test/inputs/collection_radio_buttons_input_test.rb +0 -450
- data/test/inputs/collection_select_input_test.rb +0 -378
- data/test/inputs/color_input_test.rb +0 -10
- data/test/inputs/datetime_input_test.rb +0 -176
- data/test/inputs/disabled_test.rb +0 -92
- data/test/inputs/discovery_test.rb +0 -142
- data/test/inputs/file_input_test.rb +0 -17
- data/test/inputs/general_test.rb +0 -133
- data/test/inputs/grouped_collection_select_input_test.rb +0 -183
- data/test/inputs/hidden_input_test.rb +0 -32
- data/test/inputs/numeric_input_test.rb +0 -177
- data/test/inputs/priority_input_test.rb +0 -50
- data/test/inputs/readonly_test.rb +0 -102
- data/test/inputs/required_test.rb +0 -158
- data/test/inputs/string_input_test.rb +0 -158
- data/test/inputs/text_input_test.rb +0 -37
- data/test/simple_form_test.rb +0 -18
- data/test/support/discovery_inputs.rb +0 -65
- data/test/support/misc_helpers.rb +0 -274
- data/test/support/mock_controller.rb +0 -30
- data/test/support/models.rb +0 -353
- data/test/test_helper.rb +0 -95
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
require 'simple_form/i18n_cache'
|
|
3
2
|
require 'active_support/core_ext/string/output_safety'
|
|
4
3
|
require 'action_view/helpers'
|
|
5
4
|
|
|
@@ -9,8 +8,6 @@ module SimpleForm
|
|
|
9
8
|
include ERB::Util
|
|
10
9
|
include ActionView::Helpers::TranslationHelper
|
|
11
10
|
|
|
12
|
-
extend I18nCache
|
|
13
|
-
|
|
14
11
|
include SimpleForm::Helpers::Autofocus
|
|
15
12
|
include SimpleForm::Helpers::Disabled
|
|
16
13
|
include SimpleForm::Helpers::Readonly
|
|
@@ -12,7 +12,11 @@ module SimpleForm
|
|
|
12
12
|
inline_label
|
|
13
13
|
}
|
|
14
14
|
else
|
|
15
|
-
|
|
15
|
+
if include_hidden?
|
|
16
|
+
build_check_box(unchecked_value, merged_input_options)
|
|
17
|
+
else
|
|
18
|
+
build_check_box_without_hidden_field(merged_input_options)
|
|
19
|
+
end
|
|
16
20
|
end
|
|
17
21
|
end
|
|
18
22
|
|
|
@@ -60,7 +64,7 @@ module SimpleForm
|
|
|
60
64
|
# we need the hidden field to be *outside* the label (otherwise it
|
|
61
65
|
# generates invalid html - html5 only).
|
|
62
66
|
def build_hidden_field_for_checkbox
|
|
63
|
-
return "" if !include_hidden? || !unchecked_value
|
|
67
|
+
return "".html_safe if !include_hidden? || !unchecked_value
|
|
64
68
|
options = { value: unchecked_value, id: nil, disabled: input_html_options[:disabled] }
|
|
65
69
|
options[:name] = input_html_options[:name] if input_html_options.key?(:name)
|
|
66
70
|
options[:form] = input_html_options[:form] if input_html_options.key?(:form)
|
|
@@ -5,7 +5,7 @@ module SimpleForm
|
|
|
5
5
|
protected
|
|
6
6
|
|
|
7
7
|
# Checkbox components do not use the required html tag.
|
|
8
|
-
# More info: https://github.com/
|
|
8
|
+
# More info: https://github.com/heartcombo/simple_form/issues/340#issuecomment-2871956
|
|
9
9
|
def has_required?
|
|
10
10
|
false
|
|
11
11
|
end
|
|
@@ -10,10 +10,8 @@ module SimpleForm
|
|
|
10
10
|
# Texts can be translated using i18n in "simple_form.yes" and
|
|
11
11
|
# "simple_form.no" keys. See the example locale file.
|
|
12
12
|
def self.boolean_collection
|
|
13
|
-
|
|
14
|
-
[
|
|
15
|
-
[I18n.t(:"simple_form.no", default: 'No'), false] ]
|
|
16
|
-
end
|
|
13
|
+
[ [I18n.t(:"simple_form.yes", default: 'Yes'), true],
|
|
14
|
+
[I18n.t(:"simple_form.no", default: 'No'), false] ]
|
|
17
15
|
end
|
|
18
16
|
|
|
19
17
|
def input(wrapper_options = nil)
|
|
@@ -41,7 +39,7 @@ module SimpleForm
|
|
|
41
39
|
end
|
|
42
40
|
|
|
43
41
|
def has_required?
|
|
44
|
-
super && (input_options[:include_blank] || input_options[:prompt] || multiple?)
|
|
42
|
+
super && (input_options[:include_blank] || input_options[:prompt].present? || multiple?)
|
|
45
43
|
end
|
|
46
44
|
|
|
47
45
|
# Check if :include_blank must be included by default.
|
|
@@ -23,7 +23,7 @@ module SimpleForm
|
|
|
23
23
|
|
|
24
24
|
# Sample collection
|
|
25
25
|
def collection
|
|
26
|
-
@collection ||= grouped_collection.map { |collection| collection.try(:send, group_method) }.detect(&:present?) || []
|
|
26
|
+
@collection ||= grouped_collection.map { |collection| group_method.respond_to?(:call) ? group_method.call(collection) : collection.try(:send, group_method) }.detect(&:present?) || []
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def group_method
|
|
@@ -5,8 +5,7 @@ module SimpleForm
|
|
|
5
5
|
def input(wrapper_options = nil)
|
|
6
6
|
merged_input_options = merge_wrapper_options(input_html_options, wrapper_options)
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
input_options, merged_input_options)
|
|
8
|
+
send(:"#{input_type}_input", merged_input_options)
|
|
10
9
|
end
|
|
11
10
|
|
|
12
11
|
def input_priority
|
|
@@ -15,6 +14,21 @@ module SimpleForm
|
|
|
15
14
|
|
|
16
15
|
protected
|
|
17
16
|
|
|
17
|
+
def country_input(merged_input_options)
|
|
18
|
+
@builder.send(:country_select,
|
|
19
|
+
attribute_name,
|
|
20
|
+
input_options.merge(priority_countries: input_priority),
|
|
21
|
+
merged_input_options)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def time_zone_input(merged_input_options)
|
|
25
|
+
@builder.send(:time_zone_select,
|
|
26
|
+
attribute_name,
|
|
27
|
+
input_priority,
|
|
28
|
+
input_options,
|
|
29
|
+
merged_input_options)
|
|
30
|
+
end
|
|
31
|
+
|
|
18
32
|
def skip_include_blank?
|
|
19
33
|
super || input_priority.present?
|
|
20
34
|
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
module SimpleForm
|
|
3
|
+
module Inputs
|
|
4
|
+
class RichTextAreaInput < Base
|
|
5
|
+
def input(wrapper_options = nil)
|
|
6
|
+
merged_input_options = merge_wrapper_options(input_html_options, wrapper_options)
|
|
7
|
+
|
|
8
|
+
@builder.rich_text_area(attribute_name, merged_input_options)
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
data/lib/simple_form/inputs.rb
CHANGED
data/lib/simple_form/railtie.rb
CHANGED
|
@@ -11,5 +11,9 @@ module SimpleForm
|
|
|
11
11
|
' Use `rails generate simple_form:install` to generate the Simple Form configuration.'
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
|
+
|
|
15
|
+
initializer "simple_form.deprecator" do |app|
|
|
16
|
+
app.deprecators[:simple_form] = SimpleForm.deprecator if app.respond_to?(:deprecators)
|
|
17
|
+
end
|
|
14
18
|
end
|
|
15
19
|
end
|
data/lib/simple_form/version.rb
CHANGED
|
@@ -13,7 +13,7 @@ module SimpleForm
|
|
|
13
13
|
method = input.method(@namespace)
|
|
14
14
|
|
|
15
15
|
if method.arity.zero?
|
|
16
|
-
|
|
16
|
+
SimpleForm.deprecator.warn(SimpleForm::CUSTOM_INPUT_DEPRECATION_WARN % { name: @namespace })
|
|
17
17
|
|
|
18
18
|
method.call
|
|
19
19
|
else
|
|
@@ -28,11 +28,16 @@ module SimpleForm
|
|
|
28
28
|
css += SimpleForm.additional_classes_for(:wrapper) do
|
|
29
29
|
input.additional_classes + [input.input_class]
|
|
30
30
|
end
|
|
31
|
-
css << (
|
|
32
|
-
css << (
|
|
33
|
-
css << (
|
|
31
|
+
css << html_class(:error_class, options) { input.has_errors? }
|
|
32
|
+
css << html_class(:hint_class, options) { input.has_hint? }
|
|
33
|
+
css << html_class(:valid_class, options) { input.valid? }
|
|
34
34
|
css.compact
|
|
35
35
|
end
|
|
36
|
+
|
|
37
|
+
def html_class(key, options)
|
|
38
|
+
css = (options[:"wrapper_#{key}"] || @defaults[key])
|
|
39
|
+
css if css && yield
|
|
40
|
+
end
|
|
36
41
|
end
|
|
37
42
|
end
|
|
38
43
|
end
|
data/lib/simple_form.rb
CHANGED
|
@@ -35,7 +35,7 @@ to
|
|
|
35
35
|
|
|
36
36
|
def %{name}(wrapper_options)
|
|
37
37
|
|
|
38
|
-
See https://github.com/
|
|
38
|
+
See https://github.com/heartcombo/simple_form/pull/997 for more information.
|
|
39
39
|
WARN
|
|
40
40
|
|
|
41
41
|
FILE_METHODS_DEPRECATION_WARN = <<-WARN
|
|
@@ -55,6 +55,10 @@ See http://blog.plataformatec.com.br/2019/09/incorrect-access-control-in-simple-
|
|
|
55
55
|
@@configured
|
|
56
56
|
end
|
|
57
57
|
|
|
58
|
+
def self.deprecator
|
|
59
|
+
@deprecator ||= ActiveSupport::Deprecation.new("5.3", "SimpleForm")
|
|
60
|
+
end
|
|
61
|
+
|
|
58
62
|
## CONFIGURATION OPTIONS
|
|
59
63
|
|
|
60
64
|
# Method used to tidy up errors.
|
|
@@ -114,7 +118,7 @@ See http://blog.plataformatec.com.br/2019/09/incorrect-access-control-in-simple-
|
|
|
114
118
|
mattr_reader :form_class
|
|
115
119
|
@@form_class = :simple_form
|
|
116
120
|
|
|
117
|
-
# You can define the default class to be used on all forms. Can be
|
|
121
|
+
# You can define the default class to be used on all forms. Can be overridden
|
|
118
122
|
# with `html: { :class }`. Defaults to none.
|
|
119
123
|
mattr_accessor :default_form_class
|
|
120
124
|
@@default_form_class = nil
|
|
@@ -264,21 +268,21 @@ See http://blog.plataformatec.com.br/2019/09/incorrect-access-control-in-simple-
|
|
|
264
268
|
## SETUP
|
|
265
269
|
|
|
266
270
|
def self.default_input_size=(*)
|
|
267
|
-
|
|
271
|
+
SimpleForm.deprecator.warn "[SIMPLE_FORM] SimpleForm.default_input_size= is deprecated and has no effect", caller
|
|
268
272
|
end
|
|
269
273
|
|
|
270
274
|
def self.form_class=(value)
|
|
271
|
-
|
|
275
|
+
SimpleForm.deprecator.warn "[SIMPLE_FORM] SimpleForm.form_class= is deprecated and will be removed in 4.x. Use SimpleForm.default_form_class= instead", caller
|
|
272
276
|
@@form_class = value
|
|
273
277
|
end
|
|
274
278
|
|
|
275
279
|
def self.file_methods=(file_methods)
|
|
276
|
-
|
|
280
|
+
SimpleForm.deprecator.warn(FILE_METHODS_DEPRECATION_WARN, caller)
|
|
277
281
|
@@file_methods = file_methods
|
|
278
282
|
end
|
|
279
283
|
|
|
280
284
|
def self.file_methods
|
|
281
|
-
|
|
285
|
+
SimpleForm.deprecator.warn(FILE_METHODS_DEPRECATION_WARN, caller)
|
|
282
286
|
@@file_methods
|
|
283
287
|
end
|
|
284
288
|
|
metadata
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: simple_form
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.
|
|
4
|
+
version: 5.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- José Valim
|
|
8
8
|
- Carlos Antônio
|
|
9
9
|
- Rafael França
|
|
10
|
-
autorequire:
|
|
10
|
+
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date:
|
|
13
|
+
date: 2023-10-11 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: activemodel
|
|
@@ -18,30 +18,30 @@ dependencies:
|
|
|
18
18
|
requirements:
|
|
19
19
|
- - ">="
|
|
20
20
|
- !ruby/object:Gem::Version
|
|
21
|
-
version: '5.
|
|
21
|
+
version: '5.2'
|
|
22
22
|
type: :runtime
|
|
23
23
|
prerelease: false
|
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
25
25
|
requirements:
|
|
26
26
|
- - ">="
|
|
27
27
|
- !ruby/object:Gem::Version
|
|
28
|
-
version: '5.
|
|
28
|
+
version: '5.2'
|
|
29
29
|
- !ruby/object:Gem::Dependency
|
|
30
30
|
name: actionpack
|
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
|
32
32
|
requirements:
|
|
33
33
|
- - ">="
|
|
34
34
|
- !ruby/object:Gem::Version
|
|
35
|
-
version: '5.
|
|
35
|
+
version: '5.2'
|
|
36
36
|
type: :runtime
|
|
37
37
|
prerelease: false
|
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
|
39
39
|
requirements:
|
|
40
40
|
- - ">="
|
|
41
41
|
- !ruby/object:Gem::Version
|
|
42
|
-
version: '5.
|
|
42
|
+
version: '5.2'
|
|
43
43
|
description: Forms made easy!
|
|
44
|
-
email:
|
|
44
|
+
email: heartcombo@googlegroups.com
|
|
45
45
|
executables: []
|
|
46
46
|
extensions: []
|
|
47
47
|
extra_rdoc_files: []
|
|
@@ -82,7 +82,6 @@ files:
|
|
|
82
82
|
- lib/simple_form/helpers/readonly.rb
|
|
83
83
|
- lib/simple_form/helpers/required.rb
|
|
84
84
|
- lib/simple_form/helpers/validators.rb
|
|
85
|
-
- lib/simple_form/i18n_cache.rb
|
|
86
85
|
- lib/simple_form/inputs.rb
|
|
87
86
|
- lib/simple_form/inputs/base.rb
|
|
88
87
|
- lib/simple_form/inputs/block_input.rb
|
|
@@ -100,6 +99,7 @@ files:
|
|
|
100
99
|
- lib/simple_form/inputs/password_input.rb
|
|
101
100
|
- lib/simple_form/inputs/priority_input.rb
|
|
102
101
|
- lib/simple_form/inputs/range_input.rb
|
|
102
|
+
- lib/simple_form/inputs/rich_text_area_input.rb
|
|
103
103
|
- lib/simple_form/inputs/string_input.rb
|
|
104
104
|
- lib/simple_form/inputs/text_input.rb
|
|
105
105
|
- lib/simple_form/map_type.rb
|
|
@@ -112,49 +112,17 @@ files:
|
|
|
112
112
|
- lib/simple_form/wrappers/many.rb
|
|
113
113
|
- lib/simple_form/wrappers/root.rb
|
|
114
114
|
- lib/simple_form/wrappers/single.rb
|
|
115
|
-
|
|
116
|
-
- test/action_view_extensions/form_helper_test.rb
|
|
117
|
-
- test/components/custom_components_test.rb
|
|
118
|
-
- test/components/label_test.rb
|
|
119
|
-
- test/form_builder/association_test.rb
|
|
120
|
-
- test/form_builder/button_test.rb
|
|
121
|
-
- test/form_builder/error_notification_test.rb
|
|
122
|
-
- test/form_builder/error_test.rb
|
|
123
|
-
- test/form_builder/general_test.rb
|
|
124
|
-
- test/form_builder/hint_test.rb
|
|
125
|
-
- test/form_builder/input_field_test.rb
|
|
126
|
-
- test/form_builder/label_test.rb
|
|
127
|
-
- test/form_builder/wrapper_test.rb
|
|
128
|
-
- test/generators/simple_form_generator_test.rb
|
|
129
|
-
- test/inputs/boolean_input_test.rb
|
|
130
|
-
- test/inputs/collection_check_boxes_input_test.rb
|
|
131
|
-
- test/inputs/collection_radio_buttons_input_test.rb
|
|
132
|
-
- test/inputs/collection_select_input_test.rb
|
|
133
|
-
- test/inputs/color_input_test.rb
|
|
134
|
-
- test/inputs/datetime_input_test.rb
|
|
135
|
-
- test/inputs/disabled_test.rb
|
|
136
|
-
- test/inputs/discovery_test.rb
|
|
137
|
-
- test/inputs/file_input_test.rb
|
|
138
|
-
- test/inputs/general_test.rb
|
|
139
|
-
- test/inputs/grouped_collection_select_input_test.rb
|
|
140
|
-
- test/inputs/hidden_input_test.rb
|
|
141
|
-
- test/inputs/numeric_input_test.rb
|
|
142
|
-
- test/inputs/priority_input_test.rb
|
|
143
|
-
- test/inputs/readonly_test.rb
|
|
144
|
-
- test/inputs/required_test.rb
|
|
145
|
-
- test/inputs/string_input_test.rb
|
|
146
|
-
- test/inputs/text_input_test.rb
|
|
147
|
-
- test/simple_form_test.rb
|
|
148
|
-
- test/support/discovery_inputs.rb
|
|
149
|
-
- test/support/misc_helpers.rb
|
|
150
|
-
- test/support/mock_controller.rb
|
|
151
|
-
- test/support/models.rb
|
|
152
|
-
- test/test_helper.rb
|
|
153
|
-
homepage: https://github.com/plataformatec/simple_form
|
|
115
|
+
homepage: https://github.com/heartcombo/simple_form
|
|
154
116
|
licenses:
|
|
155
117
|
- MIT
|
|
156
|
-
metadata:
|
|
157
|
-
|
|
118
|
+
metadata:
|
|
119
|
+
homepage_uri: https://github.com/heartcombo/simple_form
|
|
120
|
+
documentation_uri: https://rubydoc.info/github/heartcombo/simple_form
|
|
121
|
+
changelog_uri: https://github.com/heartcombo/simple_form/blob/main/CHANGELOG.md
|
|
122
|
+
source_code_uri: https://github.com/heartcombo/simple_form
|
|
123
|
+
bug_tracker_uri: https://github.com/heartcombo/simple_form/issues
|
|
124
|
+
wiki_uri: https://github.com/heartcombo/simple_form/wiki
|
|
125
|
+
post_install_message:
|
|
158
126
|
rdoc_options: []
|
|
159
127
|
require_paths:
|
|
160
128
|
- lib
|
|
@@ -162,54 +130,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
162
130
|
requirements:
|
|
163
131
|
- - ">="
|
|
164
132
|
- !ruby/object:Gem::Version
|
|
165
|
-
version:
|
|
133
|
+
version: 2.5.0
|
|
166
134
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
135
|
requirements:
|
|
168
136
|
- - ">="
|
|
169
137
|
- !ruby/object:Gem::Version
|
|
170
138
|
version: '0'
|
|
171
139
|
requirements: []
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
signing_key:
|
|
140
|
+
rubygems_version: 3.4.10
|
|
141
|
+
signing_key:
|
|
175
142
|
specification_version: 4
|
|
176
143
|
summary: Forms made easy!
|
|
177
|
-
test_files:
|
|
178
|
-
- test/components/label_test.rb
|
|
179
|
-
- test/components/custom_components_test.rb
|
|
180
|
-
- test/support/discovery_inputs.rb
|
|
181
|
-
- test/support/misc_helpers.rb
|
|
182
|
-
- test/support/mock_controller.rb
|
|
183
|
-
- test/support/models.rb
|
|
184
|
-
- test/test_helper.rb
|
|
185
|
-
- test/form_builder/error_test.rb
|
|
186
|
-
- test/form_builder/hint_test.rb
|
|
187
|
-
- test/form_builder/error_notification_test.rb
|
|
188
|
-
- test/form_builder/general_test.rb
|
|
189
|
-
- test/form_builder/button_test.rb
|
|
190
|
-
- test/form_builder/input_field_test.rb
|
|
191
|
-
- test/form_builder/label_test.rb
|
|
192
|
-
- test/form_builder/wrapper_test.rb
|
|
193
|
-
- test/form_builder/association_test.rb
|
|
194
|
-
- test/generators/simple_form_generator_test.rb
|
|
195
|
-
- test/action_view_extensions/builder_test.rb
|
|
196
|
-
- test/action_view_extensions/form_helper_test.rb
|
|
197
|
-
- test/simple_form_test.rb
|
|
198
|
-
- test/inputs/string_input_test.rb
|
|
199
|
-
- test/inputs/numeric_input_test.rb
|
|
200
|
-
- test/inputs/readonly_test.rb
|
|
201
|
-
- test/inputs/grouped_collection_select_input_test.rb
|
|
202
|
-
- test/inputs/text_input_test.rb
|
|
203
|
-
- test/inputs/collection_check_boxes_input_test.rb
|
|
204
|
-
- test/inputs/boolean_input_test.rb
|
|
205
|
-
- test/inputs/disabled_test.rb
|
|
206
|
-
- test/inputs/discovery_test.rb
|
|
207
|
-
- test/inputs/collection_select_input_test.rb
|
|
208
|
-
- test/inputs/general_test.rb
|
|
209
|
-
- test/inputs/color_input_test.rb
|
|
210
|
-
- test/inputs/required_test.rb
|
|
211
|
-
- test/inputs/collection_radio_buttons_input_test.rb
|
|
212
|
-
- test/inputs/priority_input_test.rb
|
|
213
|
-
- test/inputs/hidden_input_test.rb
|
|
214
|
-
- test/inputs/file_input_test.rb
|
|
215
|
-
- test/inputs/datetime_input_test.rb
|
|
144
|
+
test_files: []
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
module SimpleForm
|
|
3
|
-
# A lot of configuration values are retrived from I18n,
|
|
4
|
-
# like boolean collection, required string. This module provides
|
|
5
|
-
# caching facility to speed up form construction.
|
|
6
|
-
module I18nCache
|
|
7
|
-
def i18n_cache(key)
|
|
8
|
-
get_i18n_cache(key)[I18n.locale] ||= yield.freeze
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
def get_i18n_cache(key)
|
|
12
|
-
if class_variable_defined?(:"@@#{key}")
|
|
13
|
-
class_variable_get(:"@@#{key}")
|
|
14
|
-
else
|
|
15
|
-
reset_i18n_cache(key)
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def reset_i18n_cache(key)
|
|
20
|
-
class_variable_set(:"@@#{key}", {})
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|