diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 001af2df..ac590079 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -50,7 +50,7 @@ You may find the [demo application](#the-demo-application) useful for developmen - If your PR fixes an issues, be sure to put "Fixes #nnn" in the description of the PR (where `nnn` is the issue number). Github will automatically close the issue when the PR is merged. - When the PR is submitted, check if GitHub Actions ran all the tests successfully, and didn't raise any issues. -When you create or update a pull request, GitHub automatically runs tests that generate the screenshots in the [`README.md`](/README.md). If any of the screenshots change, GitHub will add an additional commit with the updated screenshots. +When you create or update a pull request, GitHub automatically runs tests that generate the screenshots in the [`README.md`](/README.md). If any of the screenshots change, GitHub will add an additional commit to your branch, with the updated screenshots. Normally, the screenshots should _not_ change. If the screenshots changed, please review them _carefully_. Some clear reasons why you would want to keep the changed screenshots: @@ -73,7 +73,7 @@ You can run the tests that generate the screenshots locally, but unless your env ```bash cd demo -bundle exec rails test:all +bundle exec rails test:all # or test:system ``` The [Docker development environment](#using-docker-compose) appears to generate screenshots that are the same as what GitHub generates. diff --git a/README.md b/README.md index 00d2f4a9..efc18ed5 100644 --- a/README.md +++ b/README.md @@ -1586,6 +1586,7 @@ If you want to display a custom inline error for a specific attribute not repres ![Example 50](demo/doc/screenshots/bootstrap/readme/50_example.png "Example 50") ```erb <%= bootstrap_form_for @user_with_error do |f| %> + <%= f.errors_on :email %> <% end %> ``` @@ -1594,15 +1595,19 @@ Which outputs: ```html
+
Email is invalid
``` +Note that the `invalid-feedback` `div` is hidden unless there is a preceding element under the same parent that has class `is-invalid`. For the examples, we've artificially added a hidden input. + You can hide the attribute name like this: ![Example 51](demo/doc/screenshots/bootstrap/readme/51_example.png "Example 51") ```erb <%= bootstrap_form_for @user_with_error do |f| %> + <%= f.errors_on :email, hide_attribute_name: true %> <% end %> ``` @@ -1611,6 +1616,7 @@ Which outputs: ```html
+
is invalid
``` @@ -1620,6 +1626,7 @@ You can also use a custom class for the wrapping div, like this: ![Example 52](demo/doc/screenshots/bootstrap/readme/52_example.png "Example 52") ```erb <%= bootstrap_form_for @user_with_error do |f| %> + <%= f.errors_on :email, custom_class: 'custom-error' %> <% end %> ``` @@ -1628,10 +1635,13 @@ Which outputs: ```html
+
Email is invalid
``` +Note that adding the custom class removes the default `invalid-feedback` class. If you still want the default `invalid-feedback` formatting, add it to your `custom_class`es. + ## Required Fields A label that is associated with a required field is automatically annotated with diff --git a/demo/doc/screenshots/bootstrap/readme/50_example.png b/demo/doc/screenshots/bootstrap/readme/50_example.png index 128c12e3..a9b96cc0 100644 Binary files a/demo/doc/screenshots/bootstrap/readme/50_example.png and b/demo/doc/screenshots/bootstrap/readme/50_example.png differ diff --git a/demo/doc/screenshots/bootstrap/readme/51_example.png b/demo/doc/screenshots/bootstrap/readme/51_example.png index 128c12e3..537a63ca 100644 Binary files a/demo/doc/screenshots/bootstrap/readme/51_example.png and b/demo/doc/screenshots/bootstrap/readme/51_example.png differ