simple_form 5.0.3 → 5.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +7 -2
- 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/inputs/base.rb +0 -3
- data/lib/simple_form/inputs/collection_input.rb +2 -4
- data/lib/simple_form/version.rb +1 -1
- data/test/components/label_test.rb +0 -4
- data/test/inputs/collection_check_boxes_input_test.rb +0 -4
- data/test/inputs/collection_radio_buttons_input_test.rb +0 -4
- data/test/inputs/collection_select_input_test.rb +0 -4
- metadata +8 -9
- data/lib/simple_form/i18n_cache.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8260fa0dbaf1a82ae7b8a5c120c4f26ba4e2f0c03a9821241bf6d2d193962384
|
4
|
+
data.tar.gz: f1ef61699c7246302e31eb405c734816491b1698419bc810643b71c54d7ffb2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31be8f22b6fbe417be6051466e6370c8d54e4667df16c1506a84580df69376daae06af454bb46e21b8b86e61fed6efaf954f45c876005f2b33dde00ad3ca8374
|
7
|
+
data.tar.gz: 756ef0c153e13b61a6d6823f3ea9f615ee507e329effce3c31ca477b85de86c6b0aa7bb645802be3c405281b621777191b1c34efba2cdeceb9035c2dfbb9ce82
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## 5.1.0
|
2
|
+
|
3
|
+
* Remove `I18nCache` module entirely. It was added complexity for very little gain in some translations, and caused extra trouble upgrading to Ruby 3. If you need that level of caching consider looking into I18n caching as a whole.
|
4
|
+
* Add support for Ruby 3.0, drop support for Ruby < 2.5.
|
5
|
+
* Add support for Rails 6.1, drop support for Rails < 5.2.
|
6
|
+
* Move CI to GitHub Actions.
|
7
|
+
|
1
8
|
## 5.0.3
|
2
9
|
|
3
10
|
### Bug fix
|
data/README.md
CHANGED
@@ -1216,6 +1216,13 @@ You can view the **Simple Form** documentation in RDoc format here:
|
|
1216
1216
|
|
1217
1217
|
http://rubydoc.info/github/heartcombo/simple_form/master/frames
|
1218
1218
|
|
1219
|
+
### Supported Ruby / Rails versions
|
1220
|
+
|
1221
|
+
We intend to maintain support for all Ruby / Rails versions that haven't reached end-of-life.
|
1222
|
+
|
1223
|
+
For more information about specific versions please check [Ruby](https://www.ruby-lang.org/en/downloads/branches/)
|
1224
|
+
and [Rails](https://guides.rubyonrails.org/maintenance_policy.html) maintenance policies, and our test matrix.
|
1225
|
+
|
1219
1226
|
### Bug reports
|
1220
1227
|
|
1221
1228
|
If you discover any bugs, feel free to create an issue on GitHub. Please add as much information as
|
@@ -1233,7 +1240,6 @@ If you have discovered a security related bug, please do NOT use the GitHub issu
|
|
1233
1240
|
* Felipe Renan (https://github.com/feliperenan)
|
1234
1241
|
|
1235
1242
|
[![Gem Version](https://fury-badge.herokuapp.com/rb/simple_form.png)](http://badge.fury.io/rb/simple_form)
|
1236
|
-
[![Build Status](https://api.travis-ci.org/heartcombo/simple_form.svg?branch=master)](http://travis-ci.org/heartcombo/simple_form)
|
1237
1243
|
[![Code Climate](https://codeclimate.com/github/heartcombo/simple_form.png)](https://codeclimate.com/github/heartcombo/simple_form)
|
1238
1244
|
[![Inline docs](http://inch-ci.org/github/heartcombo/simple_form.png)](http://inch-ci.org/github/heartcombo/simple_form)
|
1239
1245
|
|
@@ -1242,4 +1248,3 @@ If you have discovered a security related bug, please do NOT use the GitHub issu
|
|
1242
1248
|
MIT License. Copyright 2020 Rafael França, Carlos Antônio da Silva. Copyright 2009-2019 Plataformatec.
|
1243
1249
|
|
1244
1250
|
The Simple Form logo is licensed under [Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License](https://creativecommons.org/licenses/by-nc-nd/4.0/).
|
1245
|
-
|
@@ -6,11 +6,9 @@ module SimpleForm
|
|
6
6
|
|
7
7
|
module ClassMethods #:nodoc:
|
8
8
|
def translate_required_html
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
)
|
13
|
-
end
|
9
|
+
I18n.t(:"required.html", scope: i18n_scope, default:
|
10
|
+
%(<abbr title="#{translate_required_text}">#{translate_required_mark}</abbr>)
|
11
|
+
)
|
14
12
|
end
|
15
13
|
|
16
14
|
def translate_required_text
|
@@ -24,10 +24,6 @@ module SimpleForm
|
|
24
24
|
find_validator(:length)
|
25
25
|
end
|
26
26
|
|
27
|
-
def has_tokenizer?(length_validator)
|
28
|
-
length_validator.options[:tokenizer]
|
29
|
-
end
|
30
|
-
|
31
27
|
def maximum_length_value_from(length_validator)
|
32
28
|
if length_validator
|
33
29
|
length_validator.options[:is] || length_validator.options[:maximum]
|
@@ -24,10 +24,6 @@ module SimpleForm
|
|
24
24
|
find_validator(:length)
|
25
25
|
end
|
26
26
|
|
27
|
-
def has_tokenizer?(length_validator)
|
28
|
-
length_validator.options[:tokenizer]
|
29
|
-
end
|
30
|
-
|
31
27
|
def minimum_length_value_from(length_validator)
|
32
28
|
if length_validator
|
33
29
|
length_validator.options[:is] || length_validator.options[:minimum]
|
@@ -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
|
@@ -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)
|
data/lib/simple_form/version.rb
CHANGED
@@ -4,10 +4,6 @@ require 'test_helper'
|
|
4
4
|
|
5
5
|
# Isolated tests for label without triggering f.label.
|
6
6
|
class IsolatedLabelTest < ActionView::TestCase
|
7
|
-
setup do
|
8
|
-
SimpleForm::Inputs::Base.reset_i18n_cache :translate_required_html
|
9
|
-
end
|
10
|
-
|
11
7
|
def with_label_for(object, attribute_name, type, options = {})
|
12
8
|
with_concat_form_for(object) do |f|
|
13
9
|
options[:reflection] = Association.new(Company, :company, {}) if options.delete(:setup_association)
|
@@ -3,10 +3,6 @@
|
|
3
3
|
require 'test_helper'
|
4
4
|
|
5
5
|
class CollectionCheckBoxesInputTest < ActionView::TestCase
|
6
|
-
setup do
|
7
|
-
SimpleForm::Inputs::CollectionCheckBoxesInput.reset_i18n_cache :boolean_collection
|
8
|
-
end
|
9
|
-
|
10
6
|
test 'input check boxes does not include for attribute by default' do
|
11
7
|
with_input_for @user, :gender, :check_boxes, collection: %i[male female]
|
12
8
|
assert_select 'label'
|
@@ -3,10 +3,6 @@
|
|
3
3
|
require 'test_helper'
|
4
4
|
|
5
5
|
class CollectionRadioButtonsInputTest < ActionView::TestCase
|
6
|
-
setup do
|
7
|
-
SimpleForm::Inputs::CollectionRadioButtonsInput.reset_i18n_cache :boolean_collection
|
8
|
-
end
|
9
|
-
|
10
6
|
test 'input generates boolean radio buttons by default for radio types' do
|
11
7
|
with_input_for @user, :active, :radio_buttons
|
12
8
|
assert_select 'input[type=radio][value=true].radio_buttons#user_active_true'
|
@@ -3,10 +3,6 @@
|
|
3
3
|
require 'test_helper'
|
4
4
|
|
5
5
|
class CollectionSelectInputTest < ActionView::TestCase
|
6
|
-
setup do
|
7
|
-
SimpleForm::Inputs::CollectionSelectInput.reset_i18n_cache :boolean_collection
|
8
|
-
end
|
9
|
-
|
10
6
|
test 'input generates a boolean select with options by default for select types' do
|
11
7
|
with_input_for @user, :active, :select
|
12
8
|
assert_select 'select.select#user_active'
|
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: 5.0
|
4
|
+
version: 5.1.0
|
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: 2021-02-09 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activemodel
|
@@ -18,28 +18,28 @@ 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
44
|
email: heartcombo@googlegroups.com
|
45
45
|
executables: []
|
@@ -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
|
@@ -164,14 +163,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
164
163
|
requirements:
|
165
164
|
- - ">="
|
166
165
|
- !ruby/object:Gem::Version
|
167
|
-
version: 2.
|
166
|
+
version: 2.5.0
|
168
167
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
169
168
|
requirements:
|
170
169
|
- - ">="
|
171
170
|
- !ruby/object:Gem::Version
|
172
171
|
version: '0'
|
173
172
|
requirements: []
|
174
|
-
rubygems_version: 3.
|
173
|
+
rubygems_version: 3.2.6
|
175
174
|
signing_key:
|
176
175
|
specification_version: 4
|
177
176
|
summary: Forms made easy!
|
@@ -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
|