bootstrap_form 4.2.0 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.editorconfig +13 -0
  3. data/.github/workflows/ruby.yml +46 -0
  4. data/.gitignore +16 -1
  5. data/.rubocop.yml +20 -17
  6. data/CHANGELOG.md +59 -1
  7. data/CONTRIBUTING.md +72 -6
  8. data/Dangerfile +5 -7
  9. data/Dockerfile +26 -0
  10. data/Gemfile +10 -13
  11. data/OLD-README.md +12 -1
  12. data/README.md +140 -60
  13. data/RELEASING.md +2 -2
  14. data/UPGRADE-4.0.md +1 -1
  15. data/UPGRADE-5.0.md +25 -0
  16. data/bootstrap_form.gemspec +9 -5
  17. data/demo/app/assets/config/manifest.js +1 -2
  18. data/demo/app/helpers/bootstrap_helper.rb +5 -5
  19. data/demo/app/views/bootstrap/form.html.erb +14 -1
  20. data/demo/app/views/layouts/application.html.erb +3 -3
  21. data/demo/config/environments/development.rb +1 -1
  22. data/demo/config/puma.rb +2 -2
  23. data/demo/db/schema.rb +2 -2
  24. data/docker-compose.yml +70 -0
  25. data/gemfiles/5.2.gemfile +4 -0
  26. data/gemfiles/6.0.gemfile +4 -0
  27. data/gemfiles/6.1.gemfile +4 -0
  28. data/gemfiles/edge.gemfile +4 -0
  29. data/lib/bootstrap_form/action_view_extensions/form_helper.rb +1 -15
  30. data/lib/bootstrap_form/components/labels.rb +1 -1
  31. data/lib/bootstrap_form/components/layout.rb +1 -1
  32. data/lib/bootstrap_form/components/validation.rb +1 -1
  33. data/lib/bootstrap_form/configuration.rb +22 -0
  34. data/lib/bootstrap_form/form_builder.rb +17 -2
  35. data/lib/bootstrap_form/form_group.rb +21 -10
  36. data/lib/bootstrap_form/form_group_builder.rb +6 -8
  37. data/lib/bootstrap_form/helpers/bootstrap.rb +16 -18
  38. data/lib/bootstrap_form/inputs/base.rb +5 -5
  39. data/lib/bootstrap_form/inputs/check_box.rb +9 -23
  40. data/lib/bootstrap_form/inputs/collection_select.rb +1 -0
  41. data/lib/bootstrap_form/inputs/file_field.rb +3 -15
  42. data/lib/bootstrap_form/inputs/grouped_collection_select.rb +1 -0
  43. data/lib/bootstrap_form/inputs/radio_button.rb +6 -24
  44. data/lib/bootstrap_form/inputs/select.rb +1 -0
  45. data/lib/bootstrap_form/inputs/time_zone_select.rb +1 -0
  46. data/lib/bootstrap_form/version.rb +1 -1
  47. data/lib/bootstrap_form.rb +17 -7
  48. metadata +33 -10
  49. data/.travis.yml +0 -38
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3eb9dd9edad01a3b8fc83d83506c4a9a19d70f849620dde77847baaaa0231b9a
4
- data.tar.gz: 942e9b16f5ffe3873e49defc113255c61939e479621c25ed5846348b2bdfe304
3
+ metadata.gz: a510f995829dd7bbdfa67fa4eeaa73b8cb8a10a73a2d46c89aad425709caf7c2
4
+ data.tar.gz: 33543b5b3a9dd167ef7896e0ad55c7d86d31a54e4c19072d13e09b332bb5a872
5
5
  SHA512:
6
- metadata.gz: e61107ff84b13b61270438556d0320c94a1f395b5acdb9221122ba89078c7dca3c0d96b3f2db8bc5e3c7e0cdca4eb124f0bb5944fd47be31a9a217ad6a714716
7
- data.tar.gz: 55b15e5a89aa152ad0c2ca05e1bfb6fc99c15f0e1b5235ad6a0d41df0429097e775d3c006ed59e0773e9b397d2c7332fb57334bc577a47331eebff0c7dff75b8
6
+ metadata.gz: 4a703b03f34bb7208380b3370aab0b6444526fb4a33303f473c5b1a78c4c55639701d499c4013d437f79a240554c9da703a1698fc32fe5d91f73f69b919d080c
7
+ data.tar.gz: 77362e8c4c482ad19a81d63b8c4b55fe213b42e28e44dc66cd716da7106afc2e7509e43428ec135a00f652ed6112cd6fcee4af8bb2e271bb77d3cc187e441045
data/.editorconfig ADDED
@@ -0,0 +1,13 @@
1
+ # editorconfig.org
2
+ root = true
3
+
4
+ [*]
5
+ indent_style = space
6
+ indent_size = 2
7
+ end_of_line = lf
8
+ charset = utf-8
9
+ trim_trailing_whitespace = true
10
+ insert_final_newline = true
11
+
12
+ [*.md]
13
+ trim_trailing_whitespace = false
@@ -0,0 +1,46 @@
1
+ name: Ruby
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ pull_request:
7
+ branches: [ main ]
8
+
9
+ jobs:
10
+ Lint:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v2
14
+ - uses: ruby/setup-ruby@v1
15
+ with:
16
+ ruby-version: 2.7.2
17
+ bundler-cache: true
18
+ - name: Danger
19
+ if: ${{ github.event_name == 'pull_request' }}
20
+ run: |
21
+ gem install danger
22
+ export DANGER_GITHUB_API_TOKEN=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
23
+ danger
24
+ - name: Rubocop
25
+ run: bundle exec rubocop --auto-correct
26
+ Test:
27
+ runs-on: ubuntu-latest
28
+ strategy:
29
+ fail-fast: false
30
+ matrix:
31
+ ruby-version: [ '3.0', '2.7', '2.6' ]
32
+ gemfile: [ '6.1', '6.0', '5.2', 'edge' ]
33
+ exclude:
34
+ - { ruby-version: '3.0', gemfile: "5.2" }
35
+ - { ruby-version: '2.6', gemfile: "edge" }
36
+ env:
37
+ BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
38
+ steps:
39
+ - uses: actions/checkout@v2
40
+ - name: Set up Ruby
41
+ uses: ruby/setup-ruby@v1
42
+ with:
43
+ ruby-version: ${{ matrix.ruby-version }}
44
+ bundler-cache: true
45
+ - name: Run tests
46
+ run: bundle exec rake test
data/.gitignore CHANGED
@@ -1,4 +1,5 @@
1
1
  .bundle/
2
+ .idea
2
3
  log/*.log
3
4
  pkg/
4
5
  demo/db/*.sqlite3
@@ -13,7 +14,7 @@ test/gemfiles/*.lock
13
14
  Vagrantfile
14
15
  .vagrant
15
16
 
16
- // For the demo app.
17
+ # For the demo app.
17
18
 
18
19
  # Ignore uploaded files in development.
19
20
  demo/storage/*
@@ -30,3 +31,17 @@ demo/node_modules
30
31
  demo/yarn-error.log
31
32
  demo/yarn-debug.log*
32
33
  demo/.yarn-integrity
34
+
35
+ # For stuff that gets created if using the Dockerfile image
36
+ .bundle/
37
+ .cache/
38
+ vendor/bundle
39
+
40
+ # or .local/share/pry/pry_history if you need to be more exact
41
+ .local/
42
+ .irb_history
43
+ .byebug_history
44
+ # For Debian images with Bash
45
+ .bash_history
46
+ # For Alpine images
47
+ .ash_history
data/.rubocop.yml CHANGED
@@ -1,25 +1,37 @@
1
- # Taken from: https://github.com/mattbrictson/rails-template/blob/master/rubocop.yml.tt
2
- # Modified for demo app in `demo/` directory.
1
+ require:
2
+ - rubocop-performance
3
+ - rubocop-rails
4
+
3
5
  AllCops:
4
6
  DisplayCopNames: true
5
7
  DisplayStyleGuide: true
6
- TargetRubyVersion: 2.2.2
8
+ TargetRubyVersion: 2.5
9
+ NewCops: enable
7
10
  Exclude:
8
- - "bin/*"
11
+ - bin/*
9
12
  - Capfile
10
13
  - demo/bin/*
11
- - "demo/bower_components/**/*"
14
+ - demo/bower_components/**/*
12
15
  - demo/config/boot.rb
13
16
  - demo/config/environment.rb
14
17
  - demo/config/initializers/version.rb
15
18
  - demo/db/schema.rb
16
- - "demo/node_modules/**/*"
19
+ - demo/node_modules/**/*
17
20
  - demo/Rakefile
18
- - "demo/tmp/**/*"
19
- - "demo/vendor/**/*"
21
+ - demo/tmp/**/*
22
+ - demo/vendor/**/*
20
23
  - Gemfile
24
+ - gemfiles/vendor/bundle/**/*
25
+ - vendor/bundle/**/*
21
26
  - Guardfile
22
27
  - Rakefile
28
+ - vendor/**/*
29
+
30
+ Layout/LineLength:
31
+ Max: 132
32
+ Exclude:
33
+ - "demo/config/**/*"
34
+ - "demo/db/**/*"
23
35
 
24
36
  Layout/SpaceAroundEqualsInParameterDefault:
25
37
  EnforcedStyle: no_space
@@ -40,12 +52,6 @@ Metrics/ClassLength:
40
52
  - "demo/test/**/*"
41
53
  - "test/**/*"
42
54
 
43
- Metrics/LineLength:
44
- Max: 132
45
- Exclude:
46
- - "demo/config/**/*"
47
- - "demo/db/**/*"
48
-
49
55
  Metrics/MethodLength:
50
56
  Max: 12
51
57
  Exclude:
@@ -59,9 +65,6 @@ Naming/MemoizedInstanceVariableName:
59
65
  Naming/VariableNumber:
60
66
  Enabled: false
61
67
 
62
- Performance/Casecmp:
63
- Enabled: false
64
-
65
68
  Rails:
66
69
  Enabled: true
67
70
 
data/CHANGELOG.md CHANGED
@@ -12,6 +12,60 @@
12
12
 
13
13
  * Your contribution here!
14
14
 
15
+ ## [5.0.0][] (2021-11-11)
16
+
17
+ ### Breaking changes
18
+
19
+ * Generates markup for Bootstrap 5.
20
+
21
+ ### New features
22
+
23
+ * [#572](https://github.com/bootstrap-ruby/bootstrap_form/issues/572): Simplify the formatting of the file upload control to follow the new Bootstrap 5 styles
24
+ * [#573](https://github.com/bootstrap-ruby/bootstrap_form/issues/573): Add support for Bootstrap 5's floating labels
25
+
26
+ ### Bugfixes
27
+
28
+ * [#582](https://github.com/bootstrap-ruby/bootstrap_form/issues/582): Fix tests in bootstrap-5 branch, removes Rubocop offenses, and adds testing with Rails 6.1.
29
+
30
+ ## [5.0.0.alpha1][]
31
+
32
+ ### Breaking changes
33
+
34
+ * [#569] Remove `role="form"` from the default generated form HTML so forms pass W3C validation. (Only a breaking change if you depended on the `form` attribute. `bootstrap_form` doesn't depend on it.)
35
+
36
+ ### New features
37
+
38
+ * Your contribution here!
39
+
40
+ ### Bugfixes
41
+
42
+ * [#586](https://github.com/bootstrap-ruby/bootstrap_form/pull/586): Fix Rails 6.1 tests on master - [@thimo](https://github.com/thimo).
43
+ * [#587](https://github.com/bootstrap-ruby/bootstrap_form/pull/587): Replace `strip_heredoc` with `<<~` - [@thimo](https://github.com/thimo).
44
+
45
+ ## [4.5.0][] (2020-04-29)
46
+
47
+ ### New features
48
+
49
+ * [#562](https://github.com/bootstrap-ruby/bootstrap_form/pull/562): Allow to configure default form attributes - [@sharshenov](https://github.com/sharshenov).
50
+
51
+ ## [4.4.0][] (2020-03-08)
52
+
53
+ ### New features
54
+
55
+ * [#557](https://github.com/bootstrap-ruby/bootstrap_form/pull/557): Allow prepending and appending multiple items to an input by passing an array to `prepend` and `append` options - [@donv](https://github.com/donv).
56
+ * [#550](https://github.com/bootstrap-ruby/bootstrap_form/pull/550): Add `default_layout` so we can use it for all forms - [@duleorlovic](https://github.com/duleorlovic).
57
+
58
+ ### Bugfixes
59
+
60
+ * Your contribution here!
61
+
62
+ ## [4.3.0][] (2019-09-22)
63
+
64
+ ### New features
65
+
66
+ * [#503] Support Rails 6.0.0.
67
+ * Small documentation changes.
68
+
15
69
  ## [4.2.0][] (2019-03-08)
16
70
 
17
71
  ### New features
@@ -268,7 +322,11 @@ Features:
268
322
  - Added support for bootstrap_form_tag (@baldwindavid)
269
323
 
270
324
 
271
- [Pending Release]: https://github.com/bootstrap-ruby/bootstrap_form/compare/v4.2.0...HEAD
325
+ [Pending Release]: https://github.com/bootstrap-ruby/bootstrap_form/compare/v5.0.0...HEAD
326
+ [5.0.0]: https://github.com/bootstrap-ruby/bootstrap_form/compare/v4.5.0...v5.0.0
327
+ [4.5.0]: https://github.com/bootstrap-ruby/bootstrap_form/compare/v4.4.0...v4.5.0
328
+ [4.4.0]: https://github.com/bootstrap-ruby/bootstrap_form/compare/v4.3.0...v4.4.0
329
+ [4.3.0]: https://github.com/bootstrap-ruby/bootstrap_form/compare/v4.2.0...v4.3.0
272
330
  [4.2.0]: https://github.com/bootstrap-ruby/bootstrap_form/compare/v4.1.0...v4.2.0
273
331
  [4.1.0]: https://github.com/bootstrap-ruby/bootstrap_form/compare/v4.0.0...v4.1.0
274
332
  [4.0.0]: https://github.com/bootstrap-ruby/bootstrap_form/compare/v4.0.0.alpha1...v4.0.0
data/CONTRIBUTING.md CHANGED
@@ -10,6 +10,11 @@ There are a number of ways you can contribute to `bootstrap_form`:
10
10
  - Add to the documentation
11
11
  - Review pull requests
12
12
 
13
+ *Note:* If you want to work on preparing `bootstrap_form` for Bootstrap 5,
14
+ please start from the `bootstrap-5` branch.
15
+ If you're submitting a pull request with code or documentation,
16
+ target the pull request to the `bootstrap-5` branch.
17
+
13
18
  ## Code Contributions
14
19
 
15
20
  Here's a quick guide for code contributions:
@@ -58,19 +63,77 @@ You may find the demo application useful for development and debugging.
58
63
  ### 7. Done!
59
64
 
60
65
  Somebody will shortly review your pull request and if everything is good, it will be
61
- merged into the master branch. Eventually the gem will be published with your changes.
66
+ merged into the main branch. Eventually the gem will be published with your changes.
62
67
 
63
68
  ### Coding guidelines
64
69
 
65
70
  This project uses [RuboCop](https://github.com/bbatsov/rubocop) to enforce standard Ruby coding
66
- guidelines. Currently we run RuboCop's as described by [this post](https://tech.offgrid-electric.com/rubocop-getting-to-green-in-a-huge-rails-app-12d1ad6678eb), under the section "How to make CI pass". That means we allow certain existing RuboCop offences in the code, but prevent people from adding any new offences. So you might copy some existing code, and then discover that it doesn't pass. Please fix the new code, and if you're ambitious, fix the old code as well.
71
+ guidelines.
67
72
 
68
- * Test that your contribution passes with `rake rubocop`.
69
- * RuboCop is also run as part of the full test suite with `bundle exec rake`.
70
- * Note the Travis build will fail and your PR cannot be merged if RuboCop finds offences.
73
+ - Test that your contribution passes with `rake rubocop`.
74
+ - RuboCop is also run as part of the full test suite with `bundle exec rake`.
75
+ - Note the Travis build will fail and your PR cannot be merged if RuboCop finds offences.
71
76
 
72
77
  Note that most editors have plugins to run RuboCop as you type, or when you save a file. You may find it well worth your time to install and configure the RuboCop plugin for your editor. Read the [RuboCop documentation](https://rubocop.readthedocs.io/en/latest/integration_with_other_tools/).
73
78
 
79
+ ### Supported Versions of Ruby and Rails
80
+
81
+ The goal of `bootstrap_form` is to support all versions of Rails currently supported for bug fixes and security issues. We do not test against versions supported for severe security issues. We test against the minimum [version of Ruby required](https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#ruby-versions) for those versions of Rails.
82
+
83
+ The Ruby on Rails support policy is [here](https://guides.rubyonrails.org/maintenance_policy.html).
84
+
85
+ ### Developing with Docker
86
+
87
+ This repository includes a `Dockerfile` to build an image with the minimum `bootstrap_form`-supported Ruby environment. To build the image:
88
+
89
+ ```bash
90
+ docker build --tag bootstrap_form .
91
+ ```
92
+
93
+ This builds an image called `bootstrap_form`. You can change that to any tag you wish. Just make sure you use the same tag name in the `docker run` command.
94
+
95
+ If you want to use a different Ruby version, or a smaller Linux distribution (although the distro may be missing tools you need):
96
+
97
+ ```bash
98
+ docker build --build-arg "RUBY_VERSION=2.7" --build-arg "DISTRO=slim-buster" --tag bootstrap_form .
99
+ ```
100
+
101
+ Then run the container you built with the shell, and create the bundle:
102
+
103
+ ```bash
104
+ docker run --volume "$PWD:/app" --user $UID:`grep ^$USERNAME /etc/passwd | cut -d: -f4` -it bootstrap_form /bin/bash
105
+ bundle install
106
+ ```
107
+
108
+ You can run tests in the container as normal, with `rake test`.
109
+
110
+ (Some of that command line is need for Linux hosts, to run the container as the current user.)
111
+
112
+ ### The Demo App
113
+
114
+ There is a demo app in this repository. It shows some of the features of `bootstrap_form`, and provides a base on which to build ad-hoc testing, if you need it.
115
+
116
+ To run the demo app, set up the database and run the server:
117
+
118
+ ```bash
119
+ cd demo
120
+ export BUNDLER_GEMFILE=../gemfiles/6.1.gemfile
121
+ rails db:setup
122
+ rails s -b 0.0.0.0
123
+ ```
124
+
125
+ To run the demo app in the Docker container:
126
+
127
+ ```bash
128
+ docker run --volume "$PWD:/app" --user $UID:`grep ^$USERNAME /etc/passwd | cut -d: -f4` -p 3000:3000 -it bootstrap_form /bin/bash
129
+ cd demo
130
+ export BUNDLER_GEMFILE=../gemfiles/6.1.gemfile
131
+ rails db:setup
132
+ rails s -b 0.0.0.0
133
+ ```
134
+
135
+ To use other supported versions of Rails, change the `export BUNDLER_GEMFILE...` line to another gem file.
136
+
74
137
  ## Documentation Contributions
75
138
 
76
139
  Contributions to documentation are always welcome. Even fixing one typo improves the quality of `bootstrap_form`. To make a documentation contribution, follow steps 1-3 of Code Contributions, then make the documentation changes, then make the pull request (step 6 of Code Contributions).
@@ -86,11 +149,14 @@ We are an entirely volunteer project. Sometimes it's hard for people to find the
86
149
  Thanks to all the great contributors over the years: https://github.com/bootstrap-ruby/bootstrap_form/graphs/contributors
87
150
 
88
151
  ## Troubleshooting
152
+
89
153
  ### Models and Database Tables
154
+
90
155
  `bootstrap_form` needs a few models and tables to support testing. It appears that the necessary tables were created via the `demo/db/schema.rb` file. To support `rich_text_area`, Rails 6 creates some migrations. These migrations had to be run in the existing database (not an empty one) to create a new `schema.rb` that creates the `bootstrap_form` test tables, and the tables needed by Rails 6. The `schema.rb` file was checked in to GitHub, but the migrations were not.
91
156
 
92
157
  In the future, any new Rails functionality that creates tables would likely have to be prepared the same way:
93
- ```
158
+
159
+ ```bash
94
160
  cd demo
95
161
  rails db:setup # create the databases from `schema.rb`
96
162
  rails db:migrate # add the new tables and create a new `schema.rb`
data/Dangerfile CHANGED
@@ -44,11 +44,9 @@ end
44
44
  # ------------------------------------------------------------------------------
45
45
  # Did you remove the CHANGELOG's "Your contribution here!" line?
46
46
  # ------------------------------------------------------------------------------
47
- if has_changelog_changes
48
- if IO.read("CHANGELOG.md").scan(/^\s*[-\*] Your contribution here/i).count < 3
49
- raise(
50
- "Please put the `- Your contribution here!` line back into CHANGELOG.md.",
51
- sticky: false
52
- )
53
- end
47
+ if has_changelog_changes && IO.read("CHANGELOG.md").scan(/^\s*[-*] Your contribution here/i).count < 3
48
+ raise(
49
+ "Please put the `- Your contribution here!` line back into CHANGELOG.md.",
50
+ sticky: false
51
+ )
54
52
  end
data/Dockerfile ADDED
@@ -0,0 +1,26 @@
1
+ ARG DISTRO=buster
2
+ ARG RUBY_VERSION=2.6
3
+
4
+ FROM ruby:$RUBY_VERSION-$DISTRO
5
+
6
+ RUN mkdir -p /app
7
+ ENV HOME /app
8
+ WORKDIR /app
9
+
10
+ ENV GEM_HOME $HOME/vendor/bundle
11
+ ENV BUNDLE_APP_CONFIG="$GEM_HOME"
12
+ ENV PATH ./bin:$GEM_HOME/bin:$PATH
13
+ RUN (echo 'docker'; echo 'docker') | passwd root
14
+
15
+ # Yarn installs nodejs.
16
+ RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
17
+ echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
18
+ apt update -y -q && \
19
+ apt install -y -q yarn sqlite3
20
+
21
+ # Ruby now comes with bundler, but we're not using the default version yet, because we were using
22
+ # a newer version of bundler already. Ruby 3 comes with Bundler 2.2.3. Ruby 2.7 has Bundler 2.1.2,
23
+ # which is still behind what we were using.
24
+ RUN gem install bundler -v 2.1.4
25
+
26
+ EXPOSE 3000
data/Gemfile CHANGED
@@ -1,28 +1,25 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gemspec
3
+ gemspec path: __dir__
4
4
 
5
5
  # Uncomment and change rails version for testing purposes
6
- gem "rails", "~> 5.2.0"
7
- # gem "rails", "~> 6.0.0.beta1"
6
+ # gem "rails", "~> 5.2.0"
7
+ # gem "rails", "~> 6.0.0"
8
+ # gem "rails", "~> 6.1.0"
9
+ # gem "rails", git: "https://github.com/rails/rails.git"
8
10
 
9
11
  group :development do
10
12
  gem "chandler", ">= 0.7.0"
11
13
  gem "htmlbeautifier"
12
- gem "rubocop", require: false
13
- gem "sass-rails"
14
- gem 'webpacker', '>= 4.0.0.rc.3'
14
+ gem "rubocop-performance", require: false
15
+ gem "rubocop-rails", require: false
16
+ gem "sassc-rails"
17
+ gem "webpacker"
15
18
  end
16
19
 
17
20
  group :test do
18
- # can relax version requirement for Rails 5.2.beta3+
19
- gem "minitest", "~> 5.10.3"
20
-
21
21
  gem "diffy"
22
22
  gem "equivalent-xml"
23
23
  gem "mocha"
24
- # sqlite3 1.4.0 breaks the test suite.
25
- # https://github.com/rails/rails/pull/35154
26
- gem "sqlite3", "~> 1.3.6"
27
- gem "timecop", "~> 0.7.1"
24
+ gem "sqlite3"
28
25
  end
data/OLD-README.md CHANGED
@@ -415,8 +415,19 @@ Here's the output for a horizontal layout:
415
415
  You can also create a static control that isn't based on a model attribute:
416
416
 
417
417
  ```erb
418
- <%= f.static_control label: "Custom Static Control" value: "Content Here" %>
418
+ <%= f.static_control :field_name, label: "Custom Static Control" value: "Content Here" %>
419
419
  ```
420
+
421
+ `field_name` may be any name that isn't already used in the form. Note that you may get "unpermitted parameter" messages in your log file with this approach.
422
+
423
+ You can also create the static control the following way, if you don't need to get the value of the static control as a parameter when the form is submitted:
424
+
425
+ ```erb
426
+ <%= f.static_control label: "Custom Static Control" value: "Content Here", name: nil %>
427
+ ```
428
+
429
+ (If you neither provide a field name nor `name: nil`, the Rails code that submits the form will give a JavaScript error.)
430
+
420
431
  Prior to version 4 of `bootstrap_form`, you could pass a block to the `static_control` method.
421
432
  The value of the block would be used for the content of the static "control".
422
433
  Bootstrap 4 actually creates and styles a disabled input field for static controls, so the value of the control has to be specified by the `value:` option.