simple_form 5.0.2 → 5.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a0bc629634439c07aaad7a623c7d98f38debf0a17883f97b50f016ee82ea30e1
4
- data.tar.gz: 2e5a8780c50af021b99c5e6a3192c0c86a127feee31f8548871d9a1f89007b86
3
+ metadata.gz: 184b100fac3f2109461f1678b8a7fc1d0691e285946a5c2395bcba13a90ac4cd
4
+ data.tar.gz: bd14c6e07ab469e8d8df1822545c0707231412d10b18eaa00c1bfd015dfee4d5
5
5
  SHA512:
6
- metadata.gz: 84f39f8d9a582bb53bd58ef7b913a13e581596dc70cb6d5503c6215059e59ca0498411d038dcd6f4e497e97aa3ad8b8d769b3fc27ef872a1f5065288453895de
7
- data.tar.gz: 19ba331b70a5fa0dbabf818c13b79abd432c14cc7216077d3fd49f6801047f32c5a52b4513ef49a57b1356383f3dd8fbffb56dcceba8018abb02db577ab27877
6
+ metadata.gz: 99a5a7a83a866c5582d413b49ef6a5c14571b943e0e3c8a72b88084e24b91d46aa04f308566ce9aae0b6a6e7475e747f08fb82945f6f4122da84f9b0672c95d0
7
+ data.tar.gz: c6ae34fe070436f81a1cd79c18a359853e3a3dab4b5413c302011d82623d523e6c4826f44b4b58b59d1faddf319e3dae1da835d55e6c756f93cae4195d403e42
@@ -1,4 +1,7 @@
1
- ## Unreleased
1
+ ## 5.0.3
2
+
3
+ ### Bug fix
4
+ * Fix for ActiveStorage::Attached::Many. [@enriquez](https://github.com/enriquez)
2
5
 
3
6
  ## 5.0.2
4
7
 
data/README.md CHANGED
@@ -7,7 +7,7 @@ your forms. The basic goal of **Simple Form** is to not touch your way of defini
7
7
  you find the better design for your eyes. Most of the DSL was inherited from Formtastic,
8
8
  which we are thankful for and should make you feel right at home.
9
9
 
10
- INFO: This README refers to **Simple Form** 3.1. For older releases, check the related branch for your version.
10
+ INFO: This README refers to **Simple Form** 5.0. For older releases, check the related branch for your version.
11
11
 
12
12
  ## Installation
13
13
 
@@ -115,7 +115,7 @@ of any of them:
115
115
 
116
116
  ```erb
117
117
  <%= simple_form_for @user do |f| %>
118
- <%= f.input :username, label_html: { class: 'my_class' } %>
118
+ <%= f.input :username, label_html: { class: 'my_class' }, hint_html: { class: 'hint_class' } %>
119
119
  <%= f.input :password, hint: false, error_html: { id: 'password_error'} %>
120
120
  <%= f.input :password_confirmation, label: false %>
121
121
  <%= f.button :submit %>
@@ -538,7 +538,7 @@ end
538
538
  To add a CSS class to the label item, you can use the `item_label_class` option:
539
539
 
540
540
  ```ruby
541
- f.collection_check_boxes :role_ids, Role.all, :id, :name, item_label_class: 'my-custom-class'
541
+ f.collection_check_boxes :role_ids, Role.all, :id, :name, item_label_class: 'my-custom-class'
542
542
  ```
543
543
 
544
544
  ## Available input types and defaults for each column type
@@ -1159,8 +1159,8 @@ it to the model.
1159
1159
  ```ruby
1160
1160
  class UserPresenter < SimpleDelegator
1161
1161
  # Without that, Simple Form will consider the user model as the object.
1162
- def to_model
1163
- self
1162
+ def to_model
1163
+ self
1164
1164
  end
1165
1165
  end
1166
1166
  ```
@@ -1168,7 +1168,7 @@ end
1168
1168
  You can define all methods required by the helpers.
1169
1169
 
1170
1170
  ```ruby
1171
- class User
1171
+ class User
1172
1172
  extend ActiveModel::Naming
1173
1173
 
1174
1174
  attr_accessor :id, :name
@@ -1177,12 +1177,12 @@ class User
1177
1177
  self
1178
1178
  end
1179
1179
 
1180
- def to_key
1181
- id
1180
+ def to_key
1181
+ id
1182
1182
  end
1183
1183
 
1184
- def persisted?
1185
- false
1184
+ def persisted?
1185
+ false
1186
1186
  end
1187
1187
  end
1188
1188
  ```
@@ -1191,11 +1191,11 @@ If your object doesn't implement those methods, you must make explicit it when y
1191
1191
  building the form
1192
1192
 
1193
1193
  ```ruby
1194
- class User
1194
+ class User
1195
1195
  attr_accessor :id, :name
1196
1196
 
1197
1197
  # The only method required to use the f.submit helper.
1198
- def persisted?
1198
+ def persisted?
1199
1199
  false
1200
1200
  end
1201
1201
  end
@@ -1203,7 +1203,7 @@ end
1203
1203
 
1204
1204
  ```erb
1205
1205
  <%= simple_form_for(@user, as: :user, method: :post, url: users_path) do |f| %>
1206
- <%= f.input :name %>
1206
+ <%= f.input :name %>
1207
1207
  <%= f.submit 'New user' %>
1208
1208
  <% end %>
1209
1209
  ```
@@ -591,6 +591,7 @@ module SimpleForm
591
591
  # Returns a Boolean.
592
592
  def file_method?(attribute_name)
593
593
  @object.respond_to?("#{attribute_name}_attachment") ||
594
+ @object.respond_to?("#{attribute_name}_attachments") ||
594
595
  @object.respond_to?("remote_#{attribute_name}_url") ||
595
596
  @object.respond_to?("#{attribute_name}_attacher") ||
596
597
  @object.respond_to?("#{attribute_name}_file_name")
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module SimpleForm
3
- VERSION = "5.0.2".freeze
3
+ VERSION = "5.0.3".freeze
4
4
  end
@@ -244,6 +244,11 @@ class FormBuilderTest < ActionView::TestCase
244
244
  assert_select 'form input#user_with_attachment_avatar.file'
245
245
  end
246
246
 
247
+ test 'builder generates file input for ActiveStorage::Attached::Many' do
248
+ with_form_for UserWithAttachment.build, :avatars
249
+ assert_select 'form input#user_with_attachment_avatars.file'
250
+ end
251
+
247
252
  test 'builder generates file input for Refile >= 0.3.0 and CarrierWave >= 0.2.2' do
248
253
  with_form_for UserWithAttachment.build, :cover
249
254
  assert_select 'form input#user_with_attachment_cover.file'
@@ -339,6 +339,10 @@ class UserWithAttachment < User
339
339
  OpenStruct.new
340
340
  end
341
341
 
342
+ def avatars_attachments
343
+ OpenStruct.new
344
+ end
345
+
342
346
  def remote_cover_url
343
347
  "/uploads/cover.png"
344
348
  end
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.0.2
4
+ version: 5.0.3
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: 2020-02-06 00:00:00.000000000 Z
13
+ date: 2020-09-30 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activemodel
@@ -156,7 +156,7 @@ homepage: https://github.com/heartcombo/simple_form
156
156
  licenses:
157
157
  - MIT
158
158
  metadata: {}
159
- post_install_message:
159
+ post_install_message:
160
160
  rdoc_options: []
161
161
  require_paths:
162
162
  - lib
@@ -171,47 +171,47 @@ required_rubygems_version: !ruby/object:Gem::Requirement
171
171
  - !ruby/object:Gem::Version
172
172
  version: '0'
173
173
  requirements: []
174
- rubygems_version: 3.0.3
175
- signing_key:
174
+ rubygems_version: 3.1.2
175
+ signing_key:
176
176
  specification_version: 4
177
177
  summary: Forms made easy!
178
178
  test_files:
179
- - test/support/mock_controller.rb
179
+ - test/components/label_test.rb
180
+ - test/components/custom_components_test.rb
180
181
  - test/support/discovery_inputs.rb
181
182
  - test/support/misc_helpers.rb
183
+ - test/support/mock_controller.rb
182
184
  - test/support/models.rb
183
- - test/inputs/hidden_input_test.rb
184
- - test/inputs/collection_select_input_test.rb
185
- - test/inputs/priority_input_test.rb
186
- - test/inputs/general_test.rb
187
- - test/inputs/text_input_test.rb
188
- - test/inputs/boolean_input_test.rb
189
- - test/inputs/grouped_collection_select_input_test.rb
190
- - test/inputs/required_test.rb
191
- - test/inputs/disabled_test.rb
192
- - test/inputs/collection_radio_buttons_input_test.rb
193
- - test/inputs/collection_check_boxes_input_test.rb
194
- - test/inputs/color_input_test.rb
195
- - test/inputs/numeric_input_test.rb
196
- - test/inputs/string_input_test.rb
197
- - test/inputs/datetime_input_test.rb
198
- - test/inputs/rich_text_area_input_test.rb
199
- - test/inputs/readonly_test.rb
200
- - test/inputs/discovery_test.rb
201
- - test/inputs/file_input_test.rb
202
- - test/generators/simple_form_generator_test.rb
185
+ - test/test_helper.rb
186
+ - test/form_builder/error_test.rb
187
+ - test/form_builder/hint_test.rb
188
+ - test/form_builder/error_notification_test.rb
203
189
  - test/form_builder/general_test.rb
204
190
  - test/form_builder/button_test.rb
205
- - test/form_builder/error_test.rb
191
+ - test/form_builder/input_field_test.rb
206
192
  - test/form_builder/label_test.rb
207
- - test/form_builder/association_test.rb
208
- - test/form_builder/error_notification_test.rb
209
193
  - test/form_builder/wrapper_test.rb
210
- - test/form_builder/input_field_test.rb
211
- - test/form_builder/hint_test.rb
212
- - test/simple_form_test.rb
213
- - test/test_helper.rb
214
- - test/action_view_extensions/form_helper_test.rb
194
+ - test/form_builder/association_test.rb
195
+ - test/generators/simple_form_generator_test.rb
215
196
  - test/action_view_extensions/builder_test.rb
216
- - test/components/label_test.rb
217
- - test/components/custom_components_test.rb
197
+ - test/action_view_extensions/form_helper_test.rb
198
+ - test/simple_form_test.rb
199
+ - test/inputs/string_input_test.rb
200
+ - test/inputs/numeric_input_test.rb
201
+ - test/inputs/rich_text_area_input_test.rb
202
+ - test/inputs/readonly_test.rb
203
+ - test/inputs/grouped_collection_select_input_test.rb
204
+ - test/inputs/text_input_test.rb
205
+ - test/inputs/collection_check_boxes_input_test.rb
206
+ - test/inputs/boolean_input_test.rb
207
+ - test/inputs/disabled_test.rb
208
+ - test/inputs/discovery_test.rb
209
+ - test/inputs/collection_select_input_test.rb
210
+ - test/inputs/general_test.rb
211
+ - test/inputs/color_input_test.rb
212
+ - test/inputs/required_test.rb
213
+ - test/inputs/collection_radio_buttons_input_test.rb
214
+ - test/inputs/priority_input_test.rb
215
+ - test/inputs/hidden_input_test.rb
216
+ - test/inputs/file_input_test.rb
217
+ - test/inputs/datetime_input_test.rb