You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Start README for Bootstrap 5
* Preliminary support for Bootstrap 5 (bootstrap-ruby#567)
* Switch demo bootstrap JS include URL
* Remove "custom-control" support from radios and check boxes
In 5.0 they are consolidated into the .form-check class, and no longer
need to be treated as separate cases. Relevant tests will be fixed or
removed in the next commit.
* Remove "custom-control" tests for radios and check boxes
* Rename ".custom-file" to ".form-file"
* Change all ".form-group" uses to ".mb-3"
Bootstrap 5 is now recommending using bottom margin utilities to
control group spacing, and has removed ".form-group" entirely.
* Replace ".form-row" with gutter utils (".g-3")
Some methods in FormGroup were refactored to meet a RuboCop lint
complexity requirement. I don't personally think the refactor is
necessary but it won't pass CI without it.
* Replace ".form-inline" where necessary
Bootstrap 5 removes ".form-inline" in favor of the usage of ".col-auto"
and the new gutter utilities.
* Remove wrapper divs for elements prepended/appended to input groups
Bootstrap 5 removes ".input-group-prepend" and ".input-group-append",
they are no longer necessary. You can now add buttons and
".input-group-text" as direct children of the input groups.
* Add ".form-label" to all generated label tags
* Fix broken tests after label class change
* Fix switch style check boxes
My heavy-handedness with the previous commits removed the ability to use
switch style checkboxes when I removed the custom check box classes.
* Update switch checkbox syntax in README.md
* Add anchors for stricter #classes_include_gutters?
* Handle string or array of classes for check boxes and radio buttons
The Rails view helpers that accept a `class` option accept both single
strings and arrays of strings, so this change makes the CSS class array
builder agnostic to the input type.
I'm now also noticing that the result already had `#flatten` called on
it, so this probably wasn't an issue, but this is nicer!
* Use only form-check-label class for check box and radio button labels
Thanks to @thimo for catching this one.
* Change select box class from "form-control" to "form-select"
This required some extra effort because all the select forms inherited
their control class from the base input class.
* Add upgrade doc and update gemspec
* Remove role="form" (bootstrap-ruby#571)
* Fix tests in bootstrap-5 branch. Fixesbootstrap-ruby#582 (bootstrap-ruby#583)
* Fix tests for Rails updates
* Fix Rubocop offenses
Dangerfile:48:3: C: [Correctable] Style/SoleNestedConditional: Consider merging nested conditions into outer if conditions.
if IO.read("CHANGELOG.md").scan(/^\s*[-\*] Your contribution here/i).count < 3
^^
Dangerfile:48:42: C: [Correctable] Style/RedundantRegexpEscape: Redundant escape inside regexp literal
if IO.read("CHANGELOG.md").scan(/^\s*[-\*] Your contribution here/i).count < 3
^^
bootstrap_form.gemspec:27:3: W: Lint/ConstantDefinitionInBlock: Do not define constants this way within a block. (https://rubystyle.guide#no-constant-definition-in-block)
REQUIRED_RAILS_VERSION = ">= 5.2".freeze
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
demo/config/puma.rb:7:21: C: [Correctable] Style/RedundantFetchBlock: Use fetch("RAILS_MAX_THREADS", 5) instead of fetch("RAILS_MAX_THREADS") { 5 }. (https://github.com/JuanitoFatas/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code)
threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
demo/config/puma.rb:12:17: C: [Correctable] Style/RedundantFetchBlock: Use fetch("PORT", 3000) instead of fetch("PORT") { 3000 }. (https://github.com/JuanitoFatas/fast-ruby#hashfetch-with-argument-vs-hashfetch--block-code)
port ENV.fetch("PORT") { 3000 }
^^^^^^^^^^^^^^^^^^^^^^
lib/bootstrap_form.rb:5:11: C: [Correctable] Style/StringConcatenation: Prefer string interpolation to string concatenation. (https://rubystyle.guide#string-interpolation)
require Gem::Specification.find_by_name("actiontext").gem_dir + ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/bootstrap_form/components/validation.rb:17:22: C: [Correctable] Style/ClassEqualityComparison: Use instance_of?(Class) instead of comparing classes. (https://rubystyle.guide#instance-of-vs-class-comparison)
target = obj.class == Class ? obj : obj.class
^^^^^^^^^^^^^^
lib/bootstrap_form/form_builder.rb:48:5: W: [Correctable] Lint/RedundantCopDisableDirective: Unnecessary disabling of Metrics/AbcSize.
# rubocop:disable Metrics/AbcSize
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/bootstrap_form/form_group_builder.rb:24:9: C: [Correctable] Style/ExplicitBlockArgument: Consider using explicit block argument in the surrounding method's signature over yield. (https://rubystyle.guide#block-argument)
form_group(method, form_group_options) { yield }
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/bootstrap_form/form_group_builder.rb:32:59: C: [Correctable] Style/SoleNestedConditional: Consider merging nested conditions into outer unless conditions.
options[:required] = form_group_required(options) if options.key?(:skip_required)
^^
lib/bootstrap_form/form_group_builder.rb:60:7: C: [Correctable] Style/RedundantAssignment: Redundant assignment before returning detected.
hash = { ...
^^^^^^^^
lib/bootstrap_form/helpers/bootstrap.rb:25:44: W: [Correctable] Lint/RedundantCopDisableDirective: Unnecessary disabling of Metrics/AbcSize.
def alert_message(title, options={}) # rubocop:disable Metrics/AbcSize
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
test/test_helper.rb:7:18: C: [Correctable] Style/RedundantFileExtensionInRequire: Redundant .rb file extension detected. (https://rubystyle.guide#no-explicit-rb-to-require)
require_relative "../demo/config/environment.rb"
* Update CHANGELOG
* Add gemfile for Rails 6.1
* Run Travis against latest Ruby versions
* Update tests to both handle Rails 5.2/6 and Rails 6.1
* Step down 1 minor version for Ruby as Travis is not yet ready
* Update changelog
* Support Bootstrap 5 floating labels. Fixesbootstrap-ruby#573 (bootstrap-ruby#584)
* Support floating labels
* Add tests for floating labels
* Update demo app with floating labels section
* Add floating labels to CHANGELOG
* Describe floating labels in README
* Fix rubop offense for block length
lib/bootstrap_form/inputs/base.rb:8:7: C: Metrics/BlockLength: Block has too many lines. [26/25]
class_methods do ...
^^^^^^^^^^^^^^^^
* Fix capitalization
* Use <<~ instead of strip_heredoc
* Simplify rendering of file_field for Bootstrap 5. Fixesbootstrap-ruby#572 (bootstrap-ruby#581)
* Use Bootstrap 5 beta 3 CDN libraries in demo app
Links to both CSS and JS libraries taken from https://getbootstrap.com/docs/5.0/getting-started/introduction/
* Remove linking ../images
Folder doesn’t exist and causes the error "ActionView::Template::Error (link_tree argument must be a directory)"
* Cleanup generated HTML for file upload as per Bootstrap 5
See bootstrap-ruby#572
* Update tests for new file upload rendering
* Add changelog entry
* Fix Rubocop offense on whitespace
lib/bootstrap_form/inputs/file_field.rb:10:52: C: [Correctable] Layout/SpaceAroundEqualsInParameterDefault: Surrounding space detected in default value assignment. (https://rubystyle.guide#spaces-around-equals)
def file_field_with_bootstrap(name, options = {})
^^^
Co-authored-by: Larry Reid <[email protected]>
* Get rid of `heredoc` on `bootstrap-5` branch (bootstrap-ruby#591)
* Ignore RubyMine config directory
* Initial setup of GitHb Actions
* Run tests for rails 5 and rails 6
* Run tests for rails 5 and rails 6 + run lint job
* GH Actions: Correct gemfile names
* GH Actions: Only run the test task in the matrix. rubocop is run in the separate Lint job.
* GH Actions: Separate the Danger run for better output
* GH Actions: Run rubocop directly instead of as a Rake task. Allow autocorrectable offences.
* GH Actions: Only run Danger for pull requests
* GH Actions: Try to calm RuboCop
* Use the default Gemfile to pick up rubocop.yml
* GH Actions: Ignore the vendor directory for rubocop
* Forward the options as keyword arguments
* Test Rails 6.1 and skip Rails 5.2 + Ruby 3.0
* Fix Rails 6.1 tests on master (bootstrap-ruby#586)
* Fix tests for Rails 6.1
* Fix Rubocop offenses
bootstrap_form.gemspec:27:29: C: Gemspec/RequiredRubyVersion: required_ruby_version (2.5, declared in bootstrap_form.gemspec) and TargetRubyVersion (2.7, which may be specified in .rubocop.yml) should be equal.
s.required_ruby_version = ">= 2.5"
^^^^^^^^
lib/bootstrap_form/form_group.rb:14:30: C: [Correctable] Layout/ArgumentAlignment: Align the arguments of a method call if they span more than one line. (https://rubystyle.guide#no-double-indent)
:input_group_class, :label_col, :control_col,
^^^^^^^^^^^^^^^^^^
lib/bootstrap_form/form_group.rb:15:30: C: [Correctable] Layout/ArgumentAlignment: Align the arguments of a method call if they span more than one line. (https://rubystyle.guide#no-double-indent)
:add_control_col_class, :layout, :prepend)) do
^^^^^^^^^^^^^^^^^^^^^^
test/bootstrap_form_test.rb:123:103: C: [Correctable] Style/IfUnlessModifier: Modifier form of if makes the line too long. (https://rubystyle.guide#if-as-a-modifier)
<form accept-charset="UTF-8" action="/users" method="post" role="form" #{'data-remote="true"' if ::Rails::VERSION::STRING < "6.1"}>
^^
test/bootstrap_form_test.rb:123:133: C: [Correctable] Style/StringLiteralsInInterpolation: Prefer single-quoted strings inside interpolations.
<form accept-charset="UTF-8" action="/users" method="post" role="form" #{'data-remote="true"' if ::Rails::VERSION::STRING < "6.1"}>
^^^^^
test/bootstrap_rich_text_area_test.rb:23:54: C: [Correctable] Style/StringLiteralsInInterpolation: Prefer single-quoted strings inside interpolations.
"http://test.host/rails/active_storage/blobs/#{"redirect/" if ::Rails::VERSION::STRING >= "6.1"}:signed_id/:filename"
^^^^^^^^^^^
test/bootstrap_rich_text_area_test.rb:23:97: C: [Correctable] Style/StringLiteralsInInterpolation: Prefer single-quoted strings inside interpolations.
"http://test.host/rails/active_storage/blobs/#{"redirect/" if ::Rails::VERSION::STRING >= "6.1"}:signed_id/:filename"
^^^^^
* Include Rails 6.1 in Travis tests + update Ruby versions
* Update CHANGELOG
* Rails Edge requires Ruby 2.7+
* Remove rubocop_todo and fix Rubocop offenses
* Replace strip_heredoc with <<~ (bootstrap-ruby#587)
* Replace strip_heredoc with <<~
Also fix newly detected Rubocop offenses on indentation
* Update CHANGELOG
* Simplify Dockerfile and add documentation (bootstrap-ruby#588)
* Simplify Dockerfile and add documentation
* A few more additions to .gitignore
* Ignore gems placed when using Dockerfile (bootstrap-ruby#590)
* Fix formatting and heredoc
* Fix bad merge
Co-authored-by: Uwe Kubosch <[email protected]>
Co-authored-by: Uwe Kubosch <[email protected]>
Co-authored-by: Thimo Jansen <[email protected]>
* Cherry pick some commits from `main` (bootstrap-ruby#594)
* Change default branch to `main` (bootstrap-ruby#592)
* Change default branch to `main`
* Add GitHub token for Danger
* Change default branch to `main` (bootstrap-ruby#592)
* Change default branch to `main`
* Add GitHub token for Danger
* Fix deprecation that I broke again
* Errors on invalid feedback (bootstrap-ruby#580)
* Use "invalid-feedback" class name for errors_on
* Add custom class option for errors_on helper
* Improve tests, docs and changelog
Co-authored-by: Larry Reid <[email protected]>
* README: Use GH Actions badge, drop Travis badge, configuration file (bootstrap-ruby#600)
* README: Use GH Actions badge, drop Travis badge
* Delete unused TravisCI configuration file
* Update README for release of 5.0
Co-authored-by: Taylor Thurlow <[email protected]>
Co-authored-by: Thimo Jansen <[email protected]>
Co-authored-by: Uwe Kubosch <[email protected]>
Co-authored-by: Uwe Kubosch <[email protected]>
Co-authored-by: Chrıs Seelus <[email protected]>
Co-authored-by: Olle Jonsson <[email protected]>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+15Lines changed: 15 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,21 @@
6
6
7
7
### New features
8
8
9
+
*[#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
10
+
*[#573](https://github.com/bootstrap-ruby/bootstrap_form/issues/573): Add support for Bootstrap 5's floating labels
11
+
12
+
### Bugfixes
13
+
14
+
*[#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.
15
+
16
+
## [5.0.0.alpha1][]
17
+
18
+
### Breaking changes
19
+
20
+
*[#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.)
`bootstrap_form` is a Rails form builder that makes it super easy to integrate Bootstrap v4-style forms into your Rails application. It provides form helpers that augment the Rails form helpers. `bootstrap_forms`'s form helpers generate the form field and its label and all the Bootstrap mark-up required for proper Bootstrap display. `bootstrap_form` also provides:
6
+
`bootstrap_form` is a Rails form builder that makes it super easy to integrate Bootstrap v5-style forms into your Rails application. It provides form helpers that augment the Rails form helpers. `bootstrap_forms`'s form helpers generate the form field and its label and all the Bootstrap mark-up required for proper Bootstrap display. `bootstrap_form` also provides:
13
7
14
8
*[Validation error messages](#validation-and-errors) below the field they correspond to, by default. You can also put the error messages after the label, or turn off `bootstrap_form`'s validation error handling and do it yourself. _Note that this applies to Rails-generated validation messages._ HTML 5 client-side validation and Rails validation out of the box don't really work well together. One discussion of the challenges and some solutions is [here](https://www.jorgemanrubia.com/2019/02/16/form-validations-with-html5-and-modern-rails/)
15
9
* Automatic [mark-up for the `required` attribute](#required-fields) on required fields.
@@ -33,14 +27,14 @@ Some other nice things that `bootstrap_form` does for you are:
33
27
34
28
* Ruby 2.5+
35
29
* Rails 5.2+
36
-
* Bootstrap 4.0+
30
+
* Bootstrap 5.0+
37
31
38
32
## Installation
39
33
40
34
Add it to your Gemfile:
41
35
42
36
```ruby
43
-
gem "bootstrap_form", "~> 4.0"
37
+
gem "bootstrap_form", "~> 5.0"
44
38
```
45
39
46
40
Then:
@@ -79,12 +73,12 @@ This generates the following HTML:
<smallclass="form-text text-muted">A good password should be at least six characters long</small>
138
132
</div>
@@ -150,7 +144,6 @@ in `form_with`.
150
144
151
145
`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
146
153
-
154
147
## Configuration
155
148
156
149
`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.
@@ -159,14 +152,14 @@ The current configuration options are:
|`default_form_attributes`|`{role: "form"}`| version [2.2.0](https://github.com/bootstrap-ruby/bootstrap_form/blob/main/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
-
155
+
|`default_form_attributes`||`bootstrap_form` versions 3 and 4 added a role="form" attribute to all forms. The W3C validator will raise a **warning** on forms with a role="form" attribute. `bootstrap_form` version 5 drops this attribute by default. Set this option to `{ role: "form" }` to make forms non-compliant with W3C, but generate the `role="form"` attribute like `bootstrap_form` versions 3 and 4. |
164
156
165
157
Example:
158
+
166
159
```ruby
167
160
# config/initializers/bootstrap_form.rb
168
161
BootstrapForm.configure do |c|
169
-
c.default_form_attributes = {} # to make forms W3C compliant
162
+
c.default_form_attributes = {role:"form"} # to make forms non-compliant with W3C.
170
163
end
171
164
```
172
165
@@ -319,7 +312,7 @@ To add a class to the input group wrapper, use the `:input_group_class` option.
319
312
320
313
### Additional Form Group Attributes
321
314
322
-
Bootstrap mark-up dictates that most input field types have the label and input wrapped in a `div.form-group`.
315
+
Bootstrap mark-up dictates that most input field types have the label and input wrapped in a `div.mb-3`.
323
316
324
317
If you want to add an additional CSS class or any other attribute to the form group div, you can use the `wrapper: { class: 'additional-class', data: { foo: 'bar' } }` option.
325
318
@@ -330,8 +323,8 @@ If you want to add an additional CSS class or any other attribute to the form gr
Rails normally wraps fields with validation errors in a `div.field_with_errors`, but this behaviour isn't consistent with Bootstrap 4 styling. By default, `bootstrap_form` generations in-line errors which appear below the field. But it can also generate errors on the label, or not display any errors, leaving it up to you.
@@ -710,8 +718,8 @@ By default, fields that have validation errors will be outlined in red and the
710
718
error will be displayed below the field. Here's an example:
We made every effort to make the upgrade from `bootstrap_form` v4 (Bootstrap 4) to `bootstrap_form` 5.0 (Bootstrap 5) as easy as possible. However, Bootstrap 5 is fundamentally different from Bootstrap 4, so some changes may be necessary in your code.
4
+
5
+
## Bootstrap 5 Changes
6
+
7
+
Upgrading `bootstrap_form` to version 5 means you must upgrade your whole application to Bootstrap 5. Read the [Bootstrap 5 migration guide](https://v5.getbootstrap.com/docs/5.0/migration/) to see what changes you have to make to your views. This will also help you understand changes you might have to make to your `bootstrap_form` code.
8
+
9
+
## `bootstrap_form` Version 5 Changes
10
+
11
+
## No `role="form"` Attribute
12
+
13
+
As explained in #560, the `role="form"` attribute generated by `bootstrap_4` caused the W3C validator to output a warning. The `role="form"` attribute was deprecated in the 4.5.0 and is being remove completely in 5.0.0. This has no impact on `bootstrap_form` code itself, but may affect your application if it depended on a form having this attribute set. (Issue #569)
14
+
15
+
## Different behavior for `errors_on` helper
16
+
17
+
The `errors_on` helper now wraps the error message in a CSS class `invalid-feedback`, instead of `alert` and `alert-danger`, as before.
18
+
19
+
This will display the error as any other [Bootstrap inline form error](https://getbootstrap.com/docs/5.0/forms/validation/#server-side), instead of displaying it as an [Bootstrap alert](https://getbootstrap.com/docs/5.0/components/alerts/).
20
+
21
+
You can use the `custom_class` options for this helper with `alert alert-danger` to restore the old behaviour:
0 commit comments