bootstrap_form 4.4.0 → 4.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4e064911f3a679f4ecf322d6e3e240b35cf1f33e73908d3bf3494a71a3013781
4
- data.tar.gz: 044b4a8d8dd6c046f88b45ddd6fb83ed9d619fd6e2872fbd1eb32c84fda50f71
3
+ metadata.gz: d9c9c11dc8a15ead08e2e5060d5c003933c82630d7124692a9e6dae838d34dde
4
+ data.tar.gz: dfd08f5247ebb273aa6696ef09c023d294c3fde7ec936f1e7721b81bc735dd3a
5
5
  SHA512:
6
- metadata.gz: ec13235058d63f5ff4a12991660d10acff7b7576954e3a103d38592cd90a6ee0a8431c93eeb33878d7a228e432bbf590ff248d60445cfacbca278efc73d5fc52
7
- data.tar.gz: 2b3c704fa1981633bbaaa04dc543d72e9a1e3d535f8d56852752fb9eef65ea4d75089971e073defb193119f80c8cc13a3708a8ac603bcdef0edc8946f2a95958
6
+ metadata.gz: 4b84c600054f7987edbf2774ac4603ed7b0c2c6f13ef4e6a6cb3f84c716d680b5ba8bbb14b9263831d3b9e2d1cea75128aab657cbf48e0110c1f0141df96d2c3
7
+ data.tar.gz: b0b64178a6158c444021ed3818fa02921aff33a6dc1bd299448b72387ee7e4ec19ffa017af1ac4a5e2fe42a952338870c1ec793d64c7bc098a1fa2b31d86f6a2
@@ -5,7 +5,7 @@ require: rubocop-rails
5
5
  AllCops:
6
6
  DisplayCopNames: true
7
7
  DisplayStyleGuide: true
8
- TargetRubyVersion: 2.3
8
+ TargetRubyVersion: 2.5
9
9
  Exclude:
10
10
  - "bin/*"
11
11
  - Capfile
@@ -1,35 +1,28 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.7
3
+ - 2.7.1
4
4
  - 2.6.5
5
5
  - 2.5.7
6
- - 2.4.9
7
6
  gemfile:
8
- - gemfiles/5.0.gemfile
9
- - gemfiles/5.1.gemfile
10
- - gemfiles/5.2.gemfile
11
7
  - gemfiles/6.0.gemfile
8
+ - gemfiles/5.2.gemfile
12
9
  cache:
13
10
  bundler: true
14
11
  script:
15
12
  - bundle exec rake test
16
13
 
17
14
  matrix:
18
- exclude:
19
- - rvm: 2.4.9
20
- gemfile: gemfiles/6.0.gemfile
21
-
22
15
  include:
23
16
  # Bleeding edge Ruby
24
17
  - rvm: ruby-head
25
- gemfile: gemfiles/6.0.gemfile
18
+ gemfile: gemfiles/edge.gemfile
26
19
 
27
20
  # Next version of Rails
28
- - rvm: 2.5.7
21
+ - rvm: 2.7.1
29
22
  gemfile: gemfiles/edge.gemfile
30
23
 
31
24
  # Running one job to execute DANGER bot and linting
32
- - rvm: 2.5.7
25
+ - rvm: 2.7.1
33
26
  gemfile: gemfiles/6.0.gemfile
34
27
  script:
35
28
  - gem install danger
@@ -38,5 +31,5 @@ matrix:
38
31
 
39
32
  allow_failures:
40
33
  - rvm: ruby-head
41
- - rvm: 2.5.7
34
+ - rvm: 2.7.1
42
35
  gemfile: gemfiles/edge.gemfile
@@ -12,6 +12,12 @@
12
12
 
13
13
  * Your contribution here!
14
14
 
15
+ ## [4.5.0][] (2020-04-29)
16
+
17
+ ### New features
18
+
19
+ * [#562](https://github.com/bootstrap-ruby/bootstrap_form/pull/562): Allow to configure default form attributes - [@sharshenov](https://github.com/sharshenov).
20
+
15
21
  ## [4.4.0][] (2020-03-08)
16
22
 
17
23
  ### New features
@@ -286,7 +292,8 @@ Features:
286
292
  - Added support for bootstrap_form_tag (@baldwindavid)
287
293
 
288
294
 
289
- [Pending Release]: https://github.com/bootstrap-ruby/bootstrap_form/compare/v4.4.0...HEAD
295
+ [Pending Release]: https://github.com/bootstrap-ruby/bootstrap_form/compare/v4.5.0...HEAD
296
+ [4.5.0]: https://github.com/bootstrap-ruby/bootstrap_form/compare/v4.4.0...v4.5.0
290
297
  [4.4.0]: https://github.com/bootstrap-ruby/bootstrap_form/compare/v4.3.0...v4.4.0
291
298
  [4.3.0]: https://github.com/bootstrap-ruby/bootstrap_form/compare/v4.2.0...v4.3.0
292
299
  [4.2.0]: https://github.com/bootstrap-ruby/bootstrap_form/compare/v4.1.0...v4.2.0
data/Gemfile CHANGED
@@ -5,22 +5,20 @@ gemspec
5
5
  # Uncomment and change rails version for testing purposes
6
6
  # gem "rails", "~> 5.2.0"
7
7
  gem "rails", "~> 6.0.0"
8
+ # gem "rails", git: "https://github.com/rails/rails.git"
8
9
 
9
10
  group :development do
10
11
  gem "chandler", ">= 0.7.0"
11
12
  gem "htmlbeautifier"
12
13
  gem "rubocop-rails", require: false
13
14
  gem "sassc-rails"
14
- gem "webpacker", ">= 4.0.0.rc.3"
15
+ gem "webpacker"
15
16
  end
16
17
 
17
18
  group :test do
18
19
  # can relax version requirement for Rails 5.2.beta3+
19
- gem "minitest", "~> 5.10.3"
20
-
21
20
  gem "diffy"
22
21
  gem "equivalent-xml"
23
22
  gem "mocha"
24
23
  gem "sqlite3"
25
- gem "timecop", "~> 0.7.1"
26
24
  end
data/README.md CHANGED
@@ -31,8 +31,8 @@ Some other nice things that `bootstrap_form` does for you are:
31
31
 
32
32
  `bootstrap_form` supports at a minimum the currently supported versions of Ruby and Rails:
33
33
 
34
- * Ruby 2.4+
35
- * Rails 5.0+ (Rails 5.1+ for `bootstrap_form_with`)
34
+ * Ruby 2.5+
35
+ * Rails 5.2+
36
36
  * Bootstrap 4.0+
37
37
 
38
38
  ## Installation
@@ -107,7 +107,7 @@ If your form is not backed by a model, use the `bootstrap_form_tag`. Usage of th
107
107
  <% end %>
108
108
  ```
109
109
 
110
- ### bootstrap_form_with (Rails 5.1+)
110
+ ### bootstrap_form_with
111
111
 
112
112
  Note that `form_with` in Rails 5.1 does not add IDs to form elements and labels by default, which are both important to Bootstrap markup. This behaviour is corrected in Rails 5.2.
113
113
 
@@ -150,6 +150,26 @@ in `form_with`.
150
150
 
151
151
  `form_with` has some important differences compared to `form_for` and `form_tag`, and these differences apply to `bootstrap_form_with`. A good summary of the differences can be found at: https://m.patrikonrails.com/rails-5-1s-form-with-vs-old-form-helpers-3a5f72a8c78a, or in the [Rails documentation](api.rubyonrails.org).
152
152
 
153
+
154
+ ## Configuration
155
+
156
+ `bootstrap_form` can be used out-of-the-box without any configuration. However, `bootstrap_form` does have an optional configuration file at `config/initializers/bootstrap_form.rb` for setting options that affect all generated forms in an application.
157
+
158
+ The current configuration options are:
159
+
160
+ | Option | Default value | Description |
161
+ |---------------------------|------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
162
+ | `default_form_attributes` | `{role: "form"}` | version [2.2.0](https://github.com/bootstrap-ruby/bootstrap_form/blob/master/CHANGELOG.md#220-2014-09-16) added a role="form" attribute to all forms. The W3C validator will raise a **warning** on forms with a role="form" attribute. Set this option to `{}` to make forms be W3C compliant. |
163
+
164
+
165
+ Example:
166
+ ```ruby
167
+ # config/initializers/bootstrap_form.rb
168
+ BootstrapForm.configure do |c|
169
+ c.default_form_attributes = {} # to make forms W3C compliant
170
+ end
171
+ ```
172
+
153
173
  ## Form Helpers
154
174
 
155
175
  `bootstrap_form` provides its own version of the following Rails form helpers:
@@ -6,7 +6,7 @@ Follow these steps to release a new version of bootstrap_form to rubygems.org.
6
6
 
7
7
  * You must have commit rights to the bootstrap_form repository.
8
8
  * You must have push rights for the bootstrap_form gem on rubygems.org.
9
- * You must be using Ruby >= 2.4.
9
+ * You must be using Ruby >= 2.5.
10
10
  * Your GitHub credentials must be available to Chandler via `~/.netrc` or an environment variable, [as explained here](https://github.com/mattbrictson/chandler#2-configure-credentials).
11
11
 
12
12
  ## How to release
@@ -15,6 +15,8 @@ Gem::Specification.new do |s|
15
15
  "easy to create beautiful-looking forms using Bootstrap 4"
16
16
  s.license = "MIT"
17
17
 
18
+ s.post_install_message = "Default form attribute role=\"form\" will be dropped in 5.0.0"
19
+
18
20
  s.files = `git ls-files -z`.split("\x0").reject do |f|
19
21
  f.match(%r{^(test)/})
20
22
  end
@@ -22,8 +24,8 @@ Gem::Specification.new do |s|
22
24
  s.bindir = "exe"
23
25
  s.require_paths = ["lib"]
24
26
 
25
- s.required_ruby_version = ">= 2.3"
27
+ s.required_ruby_version = ">= 2.5"
26
28
 
27
- s.add_dependency("actionpack", ">= 5.0")
28
- s.add_dependency("activemodel", ">= 5.0")
29
+ s.add_dependency("actionpack", ">= 5.2")
30
+ s.add_dependency("activemodel", ">= 5.2")
29
31
  end
@@ -16,7 +16,7 @@ Rails.application.configure do
16
16
 
17
17
  # Enable/disable caching. By default caching is disabled.
18
18
  # Run rails dev:cache to toggle caching.
19
- if Rails.root.join("tmp/caching-dev.txt").exist?
19
+ if Rails.root.join("tmp", "caching-dev.txt").exist?
20
20
  config.action_controller.perform_caching = true
21
21
 
22
22
  config.cache_store = :memory_store
@@ -13,6 +13,7 @@ module BootstrapForm
13
13
  extend ActiveSupport::Autoload
14
14
 
15
15
  eager_autoload do
16
+ autoload :Configuration
16
17
  autoload :FormBuilder
17
18
  autoload :FormGroupBuilder
18
19
  autoload :FormGroup
@@ -21,11 +22,21 @@ module BootstrapForm
21
22
  autoload :Helpers
22
23
  end
23
24
 
24
- def self.eager_load!
25
- super
26
- BootstrapForm::Components.eager_load!
27
- BootstrapForm::Helpers.eager_load!
28
- BootstrapForm::Inputs.eager_load!
25
+ class << self
26
+ def eager_load!
27
+ super
28
+ BootstrapForm::Components.eager_load!
29
+ BootstrapForm::Helpers.eager_load!
30
+ BootstrapForm::Inputs.eager_load!
31
+ end
32
+
33
+ def config
34
+ @config ||= BootstrapForm::Configuration.new
35
+ end
36
+
37
+ def configure
38
+ yield config
39
+ end
29
40
  end
30
41
 
31
42
  mattr_accessor :field_error_proc
@@ -29,7 +29,7 @@ module BootstrapForm
29
29
  options.reverse_merge!(builder: BootstrapForm::FormBuilder)
30
30
 
31
31
  with_bootstrap_form_field_error_proc do
32
- form_with(options, &block)
32
+ form_with(**options, &block)
33
33
  end
34
34
  end
35
35
 
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BootstrapForm
4
+ class Configuration
5
+ def default_form_attributes=(attributes)
6
+ case attributes
7
+ when nil
8
+ @default_form_attributes = {}
9
+ when Hash
10
+ @default_form_attributes = attributes
11
+ else
12
+ raise ArgumentError, "Unsupported default_form_attributes #{attributes.inspect}"
13
+ end
14
+ end
15
+
16
+ def default_form_attributes
17
+ return @default_form_attributes if defined? @default_form_attributes
18
+
19
+ # TODO: Return blank hash ({}) in 5.0.0. Role "form" for form tags is redundant and makes W3C to raise a warning.
20
+ { role: "form" }
21
+ end
22
+ end
23
+ end
@@ -58,14 +58,14 @@ module BootstrapForm
58
58
  options[:inline_errors] != false
59
59
  end
60
60
  @acts_like_form_tag = options[:acts_like_form_tag]
61
- add_form_role_and_form_inline options
61
+ add_default_form_attributes_and_form_inline options
62
62
  super
63
63
  end
64
64
  # rubocop:enable Metrics/AbcSize
65
65
 
66
- def add_form_role_and_form_inline(options)
66
+ def add_default_form_attributes_and_form_inline(options)
67
67
  options[:html] ||= {}
68
- options[:html][:role] ||= "form"
68
+ options[:html].reverse_merge!(BootstrapForm.config.default_form_attributes)
69
69
 
70
70
  return unless options[:layout] == :inline
71
71
 
@@ -1,3 +1,3 @@
1
1
  module BootstrapForm
2
- VERSION = "4.4.0".freeze
2
+ VERSION = "4.5.0".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstrap_form
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.4.0
4
+ version: 4.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Potenza
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2020-03-08 00:00:00.000000000 Z
12
+ date: 2020-04-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -17,28 +17,28 @@ dependencies:
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: '5.0'
20
+ version: '5.2'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: '5.0'
27
+ version: '5.2'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: activemodel
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - ">="
33
33
  - !ruby/object:Gem::Version
34
- version: '5.0'
34
+ version: '5.2'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - ">="
40
40
  - !ruby/object:Gem::Version
41
- version: '5.0'
41
+ version: '5.2'
42
42
  description: bootstrap_form is a rails form builder that makes it super easy to create
43
43
  beautiful-looking forms using Bootstrap 4
44
44
  email:
@@ -125,8 +125,6 @@ files:
125
125
  - demo/public/favicon.ico
126
126
  - demo/test/fixtures/action_text/rich_texts.yml
127
127
  - demo/yarn.lock
128
- - gemfiles/5.0.gemfile
129
- - gemfiles/5.1.gemfile
130
128
  - gemfiles/5.2.gemfile
131
129
  - gemfiles/6.0.gemfile
132
130
  - gemfiles/edge.gemfile
@@ -137,6 +135,7 @@ files:
137
135
  - lib/bootstrap_form/components/labels.rb
138
136
  - lib/bootstrap_form/components/layout.rb
139
137
  - lib/bootstrap_form/components/validation.rb
138
+ - lib/bootstrap_form/configuration.rb
140
139
  - lib/bootstrap_form/engine.rb
141
140
  - lib/bootstrap_form/form_builder.rb
142
141
  - lib/bootstrap_form/form_group.rb
@@ -181,7 +180,7 @@ homepage: https://github.com/bootstrap-ruby/bootstrap_form
181
180
  licenses:
182
181
  - MIT
183
182
  metadata: {}
184
- post_install_message:
183
+ post_install_message: Default form attribute role="form" will be dropped in 5.0.0
185
184
  rdoc_options: []
186
185
  require_paths:
187
186
  - lib
@@ -189,7 +188,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
189
188
  requirements:
190
189
  - - ">="
191
190
  - !ruby/object:Gem::Version
192
- version: '2.3'
191
+ version: '2.5'
193
192
  required_rubygems_version: !ruby/object:Gem::Requirement
194
193
  requirements:
195
194
  - - ">="
@@ -1,18 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- gemspec path: "../"
4
-
5
- gem "rails", "~> 5.0.0"
6
-
7
- group :development do
8
- gem "rubocop-rails", require: false
9
- end
10
-
11
- group :test do
12
- gem "diffy"
13
- gem "equivalent-xml"
14
- gem "minitest", "~> 5.10.3"
15
- gem "mocha"
16
- gem "sqlite3", "~> 1.3.6"
17
- gem "timecop", "~> 0.7.1"
18
- end
@@ -1,17 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- gemspec path: "../"
4
-
5
- gem "rails", "~> 5.1.0"
6
-
7
- group :development do
8
- gem "rubocop-rails", require: false
9
- end
10
-
11
- group :test do
12
- gem "diffy"
13
- gem "equivalent-xml"
14
- gem "mocha"
15
- gem "sqlite3", "~> 1.4"
16
- gem "timecop", "~> 0.7.1"
17
- end