simple_form 3.4.0 → 5.1.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.
Files changed (106) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +118 -8
  3. data/MIT-LICENSE +2 -1
  4. data/README.md +235 -67
  5. data/lib/generators/simple_form/install_generator.rb +1 -0
  6. data/lib/generators/simple_form/templates/README +2 -3
  7. data/lib/generators/simple_form/templates/_form.html.erb +2 -0
  8. data/lib/generators/simple_form/templates/_form.html.haml +2 -0
  9. data/lib/generators/simple_form/templates/_form.html.slim +1 -0
  10. data/lib/generators/simple_form/templates/config/initializers/simple_form.rb +14 -7
  11. data/lib/generators/simple_form/templates/config/initializers/simple_form_bootstrap.rb +360 -74
  12. data/lib/generators/simple_form/templates/config/initializers/simple_form_foundation.rb +20 -8
  13. data/lib/simple_form/action_view_extensions/builder.rb +1 -0
  14. data/lib/simple_form/action_view_extensions/form_helper.rb +1 -0
  15. data/lib/simple_form/components/errors.rb +15 -2
  16. data/lib/simple_form/components/hints.rb +1 -0
  17. data/lib/simple_form/components/html5.rb +1 -0
  18. data/lib/simple_form/components/label_input.rb +2 -1
  19. data/lib/simple_form/components/labels.rb +12 -7
  20. data/lib/simple_form/components/maxlength.rb +4 -17
  21. data/lib/simple_form/components/min_max.rb +1 -0
  22. data/lib/simple_form/components/minlength.rb +5 -18
  23. data/lib/simple_form/components/pattern.rb +1 -0
  24. data/lib/simple_form/components/placeholders.rb +2 -1
  25. data/lib/simple_form/components/readonly.rb +1 -0
  26. data/lib/simple_form/components.rb +1 -0
  27. data/lib/simple_form/error_notification.rb +1 -0
  28. data/lib/simple_form/form_builder.rb +104 -29
  29. data/lib/simple_form/helpers/autofocus.rb +1 -0
  30. data/lib/simple_form/helpers/disabled.rb +1 -0
  31. data/lib/simple_form/helpers/readonly.rb +1 -0
  32. data/lib/simple_form/helpers/required.rb +1 -0
  33. data/lib/simple_form/helpers/validators.rb +2 -1
  34. data/lib/simple_form/helpers.rb +1 -0
  35. data/lib/simple_form/inputs/base.rb +24 -5
  36. data/lib/simple_form/inputs/block_input.rb +1 -0
  37. data/lib/simple_form/inputs/boolean_input.rb +4 -2
  38. data/lib/simple_form/inputs/collection_check_boxes_input.rb +3 -2
  39. data/lib/simple_form/inputs/collection_input.rb +6 -7
  40. data/lib/simple_form/inputs/collection_radio_buttons_input.rb +2 -1
  41. data/lib/simple_form/inputs/collection_select_input.rb +1 -0
  42. data/lib/simple_form/inputs/color_input.rb +14 -0
  43. data/lib/simple_form/inputs/date_time_input.rb +1 -0
  44. data/lib/simple_form/inputs/file_input.rb +1 -0
  45. data/lib/simple_form/inputs/grouped_collection_select_input.rb +1 -0
  46. data/lib/simple_form/inputs/hidden_input.rb +1 -0
  47. data/lib/simple_form/inputs/numeric_input.rb +1 -0
  48. data/lib/simple_form/inputs/password_input.rb +1 -0
  49. data/lib/simple_form/inputs/priority_input.rb +1 -4
  50. data/lib/simple_form/inputs/range_input.rb +1 -0
  51. data/lib/simple_form/inputs/rich_text_area_input.rb +12 -0
  52. data/lib/simple_form/inputs/string_input.rb +2 -1
  53. data/lib/simple_form/inputs/text_input.rb +1 -0
  54. data/lib/simple_form/inputs.rb +3 -0
  55. data/lib/simple_form/map_type.rb +1 -0
  56. data/lib/simple_form/railtie.rb +1 -0
  57. data/lib/simple_form/tags.rb +7 -2
  58. data/lib/simple_form/version.rb +2 -1
  59. data/lib/simple_form/wrappers/builder.rb +1 -0
  60. data/lib/simple_form/wrappers/leaf.rb +2 -1
  61. data/lib/simple_form/wrappers/many.rb +1 -0
  62. data/lib/simple_form/wrappers/root.rb +9 -2
  63. data/lib/simple_form/wrappers/single.rb +2 -1
  64. data/lib/simple_form/wrappers.rb +1 -0
  65. data/lib/simple_form.rb +79 -11
  66. data/test/action_view_extensions/builder_test.rb +28 -9
  67. data/test/action_view_extensions/form_helper_test.rb +3 -2
  68. data/test/components/custom_components_test.rb +62 -0
  69. data/test/components/label_test.rb +33 -8
  70. data/test/form_builder/association_test.rb +33 -2
  71. data/test/form_builder/button_test.rb +1 -0
  72. data/test/form_builder/error_notification_test.rb +1 -0
  73. data/test/form_builder/error_test.rb +12 -0
  74. data/test/form_builder/general_test.rb +75 -13
  75. data/test/form_builder/hint_test.rb +6 -0
  76. data/test/form_builder/input_field_test.rb +30 -10
  77. data/test/form_builder/label_test.rb +10 -4
  78. data/test/form_builder/wrapper_test.rb +32 -5
  79. data/test/generators/simple_form_generator_test.rb +4 -3
  80. data/test/inputs/boolean_input_test.rb +17 -0
  81. data/test/inputs/collection_check_boxes_input_test.rb +38 -18
  82. data/test/inputs/collection_radio_buttons_input_test.rb +48 -28
  83. data/test/inputs/collection_select_input_test.rb +46 -43
  84. data/test/inputs/color_input_test.rb +10 -0
  85. data/test/inputs/datetime_input_test.rb +7 -16
  86. data/test/inputs/disabled_test.rb +14 -0
  87. data/test/inputs/discovery_test.rb +22 -0
  88. data/test/inputs/file_input_test.rb +1 -0
  89. data/test/inputs/general_test.rb +3 -2
  90. data/test/inputs/grouped_collection_select_input_test.rb +11 -10
  91. data/test/inputs/hidden_input_test.rb +1 -0
  92. data/test/inputs/numeric_input_test.rb +2 -1
  93. data/test/inputs/priority_input_test.rb +7 -14
  94. data/test/inputs/readonly_test.rb +1 -0
  95. data/test/inputs/required_test.rb +1 -0
  96. data/test/inputs/rich_text_area_input_test.rb +15 -0
  97. data/test/inputs/string_input_test.rb +10 -16
  98. data/test/inputs/text_input_test.rb +1 -0
  99. data/test/simple_form_test.rb +1 -0
  100. data/test/support/discovery_inputs.rb +8 -0
  101. data/test/support/misc_helpers.rb +22 -1
  102. data/test/support/mock_controller.rb +7 -1
  103. data/test/support/models.rb +80 -18
  104. data/test/test_helper.rb +9 -4
  105. metadata +49 -55
  106. data/lib/simple_form/i18n_cache.rb +0 -22
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # encoding: UTF-8
2
3
  require 'test_helper'
3
4
 
@@ -7,6 +8,11 @@ class StringInputTest < ActionView::TestCase
7
8
  assert_select "input#user_name[type=text][name='user[name]'][value='New in SimpleForm!']"
8
9
  end
9
10
 
11
+ test 'input maps text field to citext attribute' do
12
+ with_input_for @user, :name, :citext
13
+ assert_select "input#user_name[type=text][name='user[name]'][value='New in SimpleForm!']"
14
+ end
15
+
10
16
  test 'input generates a password field for password attributes' do
11
17
  with_input_for @user, :password, :password
12
18
  assert_select "input#user_password.password[type=password][name='user[password]']"
@@ -37,18 +43,6 @@ class StringInputTest < ActionView::TestCase
37
43
  assert_select 'input.string[minlength="5"]'
38
44
  end
39
45
 
40
- if ActionPack::VERSION::STRING < '5'
41
- test 'input does not get maxlength from validation when tokenizer present' do
42
- with_input_for @validating_user, :action, :string
43
- assert_no_select 'input.string[maxlength]'
44
- end
45
-
46
- test 'input does not get minlength from validation when tokenizer present' do
47
- with_input_for @validating_user, :action, :string
48
- assert_no_select 'input.string[minlength]'
49
- end
50
- end
51
-
52
46
  test 'input gets maxlength from validation when :is option present' do
53
47
  with_input_for @validating_user, :home_picture, :string
54
48
  assert_select 'input.string[maxlength="12"]'
@@ -87,12 +81,12 @@ class StringInputTest < ActionView::TestCase
87
81
 
88
82
  test 'input infers pattern from attributes' do
89
83
  with_input_for @other_validating_user, :country, :string, pattern: true
90
- assert_select 'input[pattern="\w+"]'
84
+ assert_select "input:match('pattern', ?)", /\w+/
91
85
  end
92
86
 
93
87
  test 'input infers pattern from attributes using proc' do
94
88
  with_input_for @other_validating_user, :name, :string, pattern: true
95
- assert_select 'input[pattern="\w+"]'
89
+ assert_select "input:match('pattern', ?)", /\w+/
96
90
  end
97
91
 
98
92
  test 'input does not infer pattern from attributes if root default is false' do
@@ -104,7 +98,7 @@ class StringInputTest < ActionView::TestCase
104
98
 
105
99
  test 'input uses given pattern from attributes' do
106
100
  with_input_for @other_validating_user, :country, :string, input_html: { pattern: "\\d+" }
107
- assert_select 'input[pattern="\d+"]'
101
+ assert_select "input:match('pattern', ?)", /\\d+/
108
102
  end
109
103
 
110
104
  test 'input does not use pattern if model has :without validation option' do
@@ -132,7 +126,7 @@ class StringInputTest < ActionView::TestCase
132
126
  end
133
127
  end
134
128
 
135
- [:email, :url, :search, :tel].each do |type|
129
+ %i[email url search tel].each do |type|
136
130
  test "input allows type #{type}" do
137
131
  with_input_for @user, :name, type
138
132
  assert_select "input.string.#{type}"
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # encoding: UTF-8
2
3
  require 'test_helper'
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'test_helper'
2
3
 
3
4
  class SimpleFormTest < ActiveSupport::TestCase
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  class StringInput < SimpleForm::Inputs::StringInput
2
3
  def input(wrapper_options = nil)
3
4
  "<section>#{super}</section>".html_safe
@@ -36,6 +37,13 @@ class CollectionSelectInput < SimpleForm::Inputs::CollectionSelectInput
36
37
  end
37
38
  end
38
39
 
40
+ class FileInput < SimpleForm::Inputs::FileInput
41
+ def input_html_classes
42
+ super.delete_if { |html_class| html_class == :file }
43
+ super.push('file-upload')
44
+ end
45
+ end
46
+
39
47
  module CustomInputs
40
48
  class CustomizedInput < SimpleForm::Inputs::StringInput
41
49
  def input_html_classes
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module MiscHelpers
2
3
  def store_translations(locale, translations, &block)
3
4
  I18n.backend.store_translations locale, translations
@@ -181,7 +182,7 @@ module MiscHelpers
181
182
  end
182
183
 
183
184
  def custom_wrapper_with_label_text
184
- SimpleForm.build :label_text => proc { |label, required| "**#{label}**" } do |b|
185
+ SimpleForm.build label_text: proc { |label, required| "**#{label}**" } do |b|
185
186
  b.use :label_input
186
187
  end
187
188
  end
@@ -205,6 +206,20 @@ module MiscHelpers
205
206
  end
206
207
  end
207
208
 
209
+ def custom_wrapper_with_input_error_class
210
+ SimpleForm.build tag: :div, class: "custom_wrapper", error_class: :field_with_errors do |b|
211
+ b.use :label
212
+ b.use :input, class: 'inline-class', error_class: 'is-invalid'
213
+ end
214
+ end
215
+
216
+ def custom_wrapper_with_input_valid_class(valid_class: :field_without_errors)
217
+ SimpleForm.build tag: :div, class: "custom_wrapper", valid_class: valid_class do |b|
218
+ b.use :label
219
+ b.use :input, class: 'inline-class', valid_class: 'is-valid'
220
+ end
221
+ end
222
+
208
223
  def custom_form_for(object, *args, &block)
209
224
  simple_form_for(object, *args, { builder: CustomFormBuilder }, &block)
210
225
  end
@@ -240,6 +255,12 @@ module MiscHelpers
240
255
  f.input(attribute_name, options.merge(as: type))
241
256
  end
242
257
  end
258
+
259
+ def with_input_field_for(object, *args)
260
+ with_concat_form_for(object) do |f|
261
+ f.input_field(*args)
262
+ end
263
+ end
243
264
  end
244
265
 
245
266
  class CustomFormBuilder < SimpleForm::FormBuilder
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  class MockController
2
3
  attr_writer :action_name
3
4
 
@@ -9,7 +10,7 @@ class MockController
9
10
  defined?(@action_name) ? @action_name : "edit"
10
11
  end
11
12
 
12
- def url_for(*args)
13
+ def url_for(*)
13
14
  "http://example.com"
14
15
  end
15
16
 
@@ -17,8 +18,13 @@ class MockController
17
18
  {}
18
19
  end
19
20
 
21
+ def polymorphic_mappings(*); {}; end
22
+
20
23
  def hash_for_user_path(*); end
24
+
21
25
  def hash_for_validating_user_path(*); end
26
+
22
27
  def hash_for_other_validating_user_path(*); end
28
+
23
29
  def hash_for_users_path(*); end
24
30
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  Association = Struct.new(:klass, :name, :macro, :scope, :options)
2
3
 
3
4
  Column = Struct.new(:name, :type, :limit) do
@@ -7,7 +8,7 @@ Relation = Struct.new(:records) do
7
8
  delegate :each, to: :records
8
9
 
9
10
  def where(conditions = nil)
10
- self.class.new conditions ? records.first : records
11
+ self.class.new conditions ? [records.first] : records
11
12
  end
12
13
 
13
14
  def order(conditions = nil)
@@ -18,6 +19,12 @@ Relation = Struct.new(:records) do
18
19
  alias_method :to_ary, :records
19
20
  end
20
21
 
22
+ Decorator = Struct.new(:object) do
23
+ def to_model
24
+ object
25
+ end
26
+ end
27
+
21
28
  Picture = Struct.new(:id, :name) do
22
29
  extend ActiveModel::Naming
23
30
  include ActiveModel::Conversion
@@ -56,7 +63,24 @@ Company = Struct.new(:id, :name) do
56
63
  end
57
64
  end
58
65
 
59
- class Tag < Company; end
66
+ Friend = Struct.new(:id, :name) do
67
+ extend ActiveModel::Naming
68
+ include ActiveModel::Conversion
69
+
70
+ def self.all
71
+ (1..3).map { |i| new(i, "#{name} #{i}") }
72
+ end
73
+
74
+ def persisted?
75
+ true
76
+ end
77
+ end
78
+
79
+ class Tag < Company
80
+ def group_method
81
+ ["category-1"]
82
+ end
83
+ end
60
84
 
61
85
  TagGroup = Struct.new(:id, :name, :tags)
62
86
 
@@ -70,7 +94,8 @@ class User
70
94
  :avatar, :home_picture, :email, :status, :residence_country, :phone_number,
71
95
  :post_count, :lock_version, :amount, :attempts, :action, :credit_card, :gender,
72
96
  :extra_special_company_id, :pictures, :picture_ids, :special_pictures,
73
- :special_picture_ids, :uuid
97
+ :special_picture_ids, :uuid, :friends, :friend_ids, :special_tags, :special_tag_ids,
98
+ :citext, :hstore, :json, :jsonb, :hourly, :favorite_color
74
99
 
75
100
  def self.build(extra_attributes = {})
76
101
  attributes = {
@@ -121,13 +146,22 @@ class User
121
146
  when :attempts then :integer
122
147
  when :action then :string
123
148
  when :credit_card then :string
124
- when :uuid then :uuid
149
+ else attribute.to_sym
125
150
  end
126
151
  Column.new(attribute, column_type, limit)
127
152
  end
128
153
 
129
154
  begin
130
155
  require 'active_model/type'
156
+ begin
157
+ ActiveModel::Type.lookup(:text)
158
+ rescue ArgumentError # :text is no longer an ActiveModel::Type
159
+ # But we don't want our tests to depend on ActiveRecord
160
+ class ::ActiveModel::Type::Text < ActiveModel::Type::String
161
+ def type; :text; end
162
+ end
163
+ ActiveModel::Type.register(:text, ActiveModel::Type::Text)
164
+ end
131
165
  def type_for_attribute(attribute)
132
166
  column_type, limit = case attribute
133
167
  when 'name', 'status', 'password' then [:string, 100]
@@ -146,6 +180,10 @@ class User
146
180
  when 'action' then :string
147
181
  when 'credit_card' then :string
148
182
  when 'uuid' then :string
183
+ when 'citext' then :string
184
+ when 'hstore' then [:text, 200]
185
+ when 'json' then [:text, 200]
186
+ when 'jsonb' then [:text, 200]
149
187
  end
150
188
 
151
189
  ActiveModel::Type.lookup(column_type, limit: limit)
@@ -158,14 +196,15 @@ class User
158
196
  when :name, :status, :password, :description, :age,
159
197
  :credit_limit, :active, :born_at, :delivery_time,
160
198
  :created_at, :updated_at, :lock_version, :home_picture,
161
- :amount, :attempts, :action, :credit_card, :uuid then true
199
+ :amount, :attempts, :action, :credit_card, :uuid,
200
+ :citext, :hstore, :json, :jsonb then true
162
201
  else false
163
202
  end
164
203
  end
165
204
 
166
205
  def self.human_attribute_name(attribute, options = {})
167
206
  case attribute
168
- when 'name'
207
+ when 'name', :name
169
208
  'Super User Name!'
170
209
  when 'description'
171
210
  'User Description!'
@@ -182,16 +221,20 @@ class User
182
221
  Association.new(Company, association, :belongs_to, nil, {})
183
222
  when :tags
184
223
  Association.new(Tag, association, :has_many, nil, {})
224
+ when :special_tags
225
+ Association.new(Tag, association, :has_many, ->(user) { where(id: user.id) }, {})
185
226
  when :first_company
186
227
  Association.new(Company, association, :has_one, nil, {})
187
228
  when :special_company
188
- Association.new(Company, association, :belongs_to, nil, { conditions: { id: 1 } })
229
+ Association.new(Company, association, :belongs_to, nil, conditions: { id: 1 })
189
230
  when :extra_special_company
190
- Association.new(Company, association, :belongs_to, nil, { conditions: proc { { id: self.id } } })
231
+ Association.new(Company, association, :belongs_to, nil, conditions: proc { { id: self.id } })
191
232
  when :pictures
192
233
  Association.new(Picture, association, :has_many, nil, {})
193
234
  when :special_pictures
194
235
  Association.new(Picture, association, :has_many, proc { where(name: self.name) }, {})
236
+ when :friends
237
+ Association.new(Friend, association, :has_many, nil, {})
195
238
  end
196
239
  end
197
240
 
@@ -217,8 +260,8 @@ class ValidatingUser < User
217
260
  include ActiveModel::Validations
218
261
  validates :name, presence: true
219
262
  validates :company, presence: true
220
- validates :age, presence: true, if: Proc.new { |user| user.name }
221
- validates :amount, presence: true, unless: Proc.new { |user| user.age }
263
+ validates :age, presence: true, if: proc { |user| user.name }
264
+ validates :amount, presence: true, unless: proc { |user| user.age }
222
265
 
223
266
  validates :action, presence: true, on: :create
224
267
  validates :credit_limit, presence: true, on: :save
@@ -238,9 +281,6 @@ class ValidatingUser < User
238
281
  only_integer: true
239
282
  validates_length_of :name, maximum: 25, minimum: 5
240
283
  validates_length_of :description, in: 15..50
241
- if ActionPack::VERSION::STRING < '5'
242
- validates_length_of :action, maximum: 10, tokenizer: lambda { |str| str.scan(/\w+/) }
243
- end
244
284
  validates_length_of :home_picture, is: 12
245
285
 
246
286
  def min_amount
@@ -267,16 +307,16 @@ class OtherValidatingUser < User
267
307
  less_than: 100,
268
308
  only_integer: true
269
309
  validates_numericality_of :amount,
270
- greater_than: Proc.new { |user| user.age },
271
- less_than: Proc.new { |user| user.age + 100 },
310
+ greater_than: proc { |user| user.age },
311
+ less_than: proc { |user| user.age + 100 },
272
312
  only_integer: true
273
313
  validates_numericality_of :attempts,
274
- greater_than_or_equal_to: Proc.new { |user| user.age },
275
- less_than_or_equal_to: Proc.new { |user| user.age + 100 },
314
+ greater_than_or_equal_to: proc { |user| user.age },
315
+ less_than_or_equal_to: proc { |user| user.age + 100 },
276
316
  only_integer: true
277
317
 
278
318
  validates_format_of :country, with: /\w+/
279
- validates_format_of :name, with: Proc.new { /\w+/ }
319
+ validates_format_of :name, with: proc { /\w+/ }
280
320
  validates_format_of :description, without: /\d+/
281
321
  end
282
322
 
@@ -293,3 +333,25 @@ end
293
333
 
294
334
  class UserNumber1And2 < User
295
335
  end
336
+
337
+ class UserWithAttachment < User
338
+ def avatar_attachment
339
+ OpenStruct.new
340
+ end
341
+
342
+ def avatars_attachments
343
+ OpenStruct.new
344
+ end
345
+
346
+ def remote_cover_url
347
+ "/uploads/cover.png"
348
+ end
349
+
350
+ def profile_image_attacher
351
+ OpenStruct.new
352
+ end
353
+
354
+ def portrait_file_name
355
+ "portrait.png"
356
+ end
357
+ end
data/test/test_helper.rb CHANGED
@@ -1,14 +1,13 @@
1
- require 'bundler/setup'
2
-
1
+ # frozen_string_literal: true
3
2
  require 'minitest/autorun'
4
3
 
5
4
  require 'active_model'
6
5
  require 'action_controller'
7
6
  require 'action_view'
7
+
8
8
  ActionView::RoutingUrlFor.send(:include, ActionDispatch::Routing::UrlFor)
9
9
 
10
10
  require 'action_view/template'
11
-
12
11
  require 'action_view/test_case'
13
12
 
14
13
  module Rails
@@ -40,10 +39,14 @@ if ActiveSupport::TestCase.respond_to?(:test_order=)
40
39
  ActiveSupport::TestCase.test_order = :random
41
40
  end
42
41
 
42
+ require "rails/test_unit/line_filtering"
43
+
43
44
  class ActionView::TestCase
44
45
  include MiscHelpers
45
46
  include SimpleForm::ActionViewExtensions::FormHelper
46
47
 
48
+ extend Rails::LineFiltering
49
+
47
50
  setup :set_controller
48
51
  setup :setup_users
49
52
 
@@ -53,10 +56,11 @@ class ActionView::TestCase
53
56
 
54
57
  def setup_users(extra_attributes = {})
55
58
  @user = User.build(extra_attributes)
59
+ @decorated_user = Decorator.new(@user)
56
60
 
57
61
  @validating_user = ValidatingUser.build({
58
62
  name: 'Tester McTesterson',
59
- description: 'A test user of the most distinguised caliber',
63
+ description: 'A test user of the most distinguished caliber',
60
64
  home_picture: 'Home picture',
61
65
  age: 19,
62
66
  amount: 15,
@@ -87,4 +91,5 @@ class ActionView::TestCase
87
91
  alias :validating_user_path :user_path
88
92
  alias :validating_users_path :user_path
89
93
  alias :other_validating_user_path :user_path
94
+ alias :user_with_attachment_path :user_path
90
95
  end
metadata CHANGED
@@ -1,59 +1,47 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_form
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.0
4
+ version: 5.1.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: 2017-01-06 00:00:00.000000000 Z
13
+ date: 2021-02-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activemodel
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - ">"
19
+ - - ">="
20
20
  - !ruby/object:Gem::Version
21
- version: '4'
22
- - - "<"
23
- - !ruby/object:Gem::Version
24
- version: '5.1'
21
+ version: '5.2'
25
22
  type: :runtime
26
23
  prerelease: false
27
24
  version_requirements: !ruby/object:Gem::Requirement
28
25
  requirements:
29
- - - ">"
30
- - !ruby/object:Gem::Version
31
- version: '4'
32
- - - "<"
26
+ - - ">="
33
27
  - !ruby/object:Gem::Version
34
- version: '5.1'
28
+ version: '5.2'
35
29
  - !ruby/object:Gem::Dependency
36
30
  name: actionpack
37
31
  requirement: !ruby/object:Gem::Requirement
38
32
  requirements:
39
- - - ">"
33
+ - - ">="
40
34
  - !ruby/object:Gem::Version
41
- version: '4'
42
- - - "<"
43
- - !ruby/object:Gem::Version
44
- version: '5.1'
35
+ version: '5.2'
45
36
  type: :runtime
46
37
  prerelease: false
47
38
  version_requirements: !ruby/object:Gem::Requirement
48
39
  requirements:
49
- - - ">"
50
- - !ruby/object:Gem::Version
51
- version: '4'
52
- - - "<"
40
+ - - ">="
53
41
  - !ruby/object:Gem::Version
54
- version: '5.1'
42
+ version: '5.2'
55
43
  description: Forms made easy!
56
- email: opensource@plataformatec.com.br
44
+ email: heartcombo@googlegroups.com
57
45
  executables: []
58
46
  extensions: []
59
47
  extra_rdoc_files: []
@@ -94,7 +82,6 @@ files:
94
82
  - lib/simple_form/helpers/readonly.rb
95
83
  - lib/simple_form/helpers/required.rb
96
84
  - lib/simple_form/helpers/validators.rb
97
- - lib/simple_form/i18n_cache.rb
98
85
  - lib/simple_form/inputs.rb
99
86
  - lib/simple_form/inputs/base.rb
100
87
  - lib/simple_form/inputs/block_input.rb
@@ -103,6 +90,7 @@ files:
103
90
  - lib/simple_form/inputs/collection_input.rb
104
91
  - lib/simple_form/inputs/collection_radio_buttons_input.rb
105
92
  - lib/simple_form/inputs/collection_select_input.rb
93
+ - lib/simple_form/inputs/color_input.rb
106
94
  - lib/simple_form/inputs/date_time_input.rb
107
95
  - lib/simple_form/inputs/file_input.rb
108
96
  - lib/simple_form/inputs/grouped_collection_select_input.rb
@@ -111,6 +99,7 @@ files:
111
99
  - lib/simple_form/inputs/password_input.rb
112
100
  - lib/simple_form/inputs/priority_input.rb
113
101
  - lib/simple_form/inputs/range_input.rb
102
+ - lib/simple_form/inputs/rich_text_area_input.rb
114
103
  - lib/simple_form/inputs/string_input.rb
115
104
  - lib/simple_form/inputs/text_input.rb
116
105
  - lib/simple_form/map_type.rb
@@ -125,6 +114,7 @@ files:
125
114
  - lib/simple_form/wrappers/single.rb
126
115
  - test/action_view_extensions/builder_test.rb
127
116
  - test/action_view_extensions/form_helper_test.rb
117
+ - test/components/custom_components_test.rb
128
118
  - test/components/label_test.rb
129
119
  - test/form_builder/association_test.rb
130
120
  - test/form_builder/button_test.rb
@@ -140,6 +130,7 @@ files:
140
130
  - test/inputs/collection_check_boxes_input_test.rb
141
131
  - test/inputs/collection_radio_buttons_input_test.rb
142
132
  - test/inputs/collection_select_input_test.rb
133
+ - test/inputs/color_input_test.rb
143
134
  - test/inputs/datetime_input_test.rb
144
135
  - test/inputs/disabled_test.rb
145
136
  - test/inputs/discovery_test.rb
@@ -151,6 +142,7 @@ files:
151
142
  - test/inputs/priority_input_test.rb
152
143
  - test/inputs/readonly_test.rb
153
144
  - test/inputs/required_test.rb
145
+ - test/inputs/rich_text_area_input_test.rb
154
146
  - test/inputs/string_input_test.rb
155
147
  - test/inputs/text_input_test.rb
156
148
  - test/simple_form_test.rb
@@ -159,11 +151,11 @@ files:
159
151
  - test/support/mock_controller.rb
160
152
  - test/support/models.rb
161
153
  - test/test_helper.rb
162
- homepage: https://github.com/plataformatec/simple_form
154
+ homepage: https://github.com/heartcombo/simple_form
163
155
  licenses:
164
156
  - MIT
165
157
  metadata: {}
166
- post_install_message:
158
+ post_install_message:
167
159
  rdoc_options: []
168
160
  require_paths:
169
161
  - lib
@@ -171,52 +163,54 @@ required_ruby_version: !ruby/object:Gem::Requirement
171
163
  requirements:
172
164
  - - ">="
173
165
  - !ruby/object:Gem::Version
174
- version: '0'
166
+ version: 2.5.0
175
167
  required_rubygems_version: !ruby/object:Gem::Requirement
176
168
  requirements:
177
169
  - - ">="
178
170
  - !ruby/object:Gem::Version
179
171
  version: '0'
180
172
  requirements: []
181
- rubyforge_project: simple_form
182
- rubygems_version: 2.6.8
183
- signing_key:
173
+ rubygems_version: 3.2.6
174
+ signing_key:
184
175
  specification_version: 4
185
176
  summary: Forms made easy!
186
177
  test_files:
187
- - test/action_view_extensions/builder_test.rb
188
- - test/action_view_extensions/form_helper_test.rb
189
178
  - test/components/label_test.rb
190
- - test/form_builder/association_test.rb
191
- - test/form_builder/button_test.rb
192
- - test/form_builder/error_notification_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
193
185
  - test/form_builder/error_test.rb
194
- - test/form_builder/general_test.rb
195
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
196
190
  - test/form_builder/input_field_test.rb
197
191
  - test/form_builder/label_test.rb
198
192
  - test/form_builder/wrapper_test.rb
193
+ - test/form_builder/association_test.rb
199
194
  - test/generators/simple_form_generator_test.rb
200
- - test/inputs/boolean_input_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/rich_text_area_input_test.rb
201
+ - test/inputs/readonly_test.rb
202
+ - test/inputs/grouped_collection_select_input_test.rb
203
+ - test/inputs/text_input_test.rb
201
204
  - test/inputs/collection_check_boxes_input_test.rb
202
- - test/inputs/collection_radio_buttons_input_test.rb
203
- - test/inputs/collection_select_input_test.rb
204
- - test/inputs/datetime_input_test.rb
205
+ - test/inputs/boolean_input_test.rb
205
206
  - test/inputs/disabled_test.rb
206
207
  - test/inputs/discovery_test.rb
207
- - test/inputs/file_input_test.rb
208
+ - test/inputs/collection_select_input_test.rb
208
209
  - test/inputs/general_test.rb
209
- - test/inputs/grouped_collection_select_input_test.rb
210
- - test/inputs/hidden_input_test.rb
211
- - test/inputs/numeric_input_test.rb
212
- - test/inputs/priority_input_test.rb
213
- - test/inputs/readonly_test.rb
210
+ - test/inputs/color_input_test.rb
214
211
  - test/inputs/required_test.rb
215
- - test/inputs/string_input_test.rb
216
- - test/inputs/text_input_test.rb
217
- - test/simple_form_test.rb
218
- - test/support/discovery_inputs.rb
219
- - test/support/misc_helpers.rb
220
- - test/support/mock_controller.rb
221
- - test/support/models.rb
222
- - test/test_helper.rb
212
+ - test/inputs/collection_radio_buttons_input_test.rb
213
+ - test/inputs/priority_input_test.rb
214
+ - test/inputs/hidden_input_test.rb
215
+ - test/inputs/file_input_test.rb
216
+ - test/inputs/datetime_input_test.rb
@@ -1,22 +0,0 @@
1
- module SimpleForm
2
- # A lot of configuration values are retrived from I18n,
3
- # like boolean collection, required string. This module provides
4
- # caching facility to speed up form construction.
5
- module I18nCache
6
- def i18n_cache(key)
7
- get_i18n_cache(key)[I18n.locale] ||= yield.freeze
8
- end
9
-
10
- def get_i18n_cache(key)
11
- if class_variable_defined?(:"@@#{key}")
12
- class_variable_get(:"@@#{key}")
13
- else
14
- reset_i18n_cache(key)
15
- end
16
- end
17
-
18
- def reset_i18n_cache(key)
19
- class_variable_set(:"@@#{key}", {})
20
- end
21
- end
22
- end