Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify rendering of file_field for Bootstrap 5 alpha 3 #572

Closed
thimo opened this issue Nov 12, 2020 · 3 comments
Closed

Simplify rendering of file_field for Bootstrap 5 alpha 3 #572

thimo opened this issue Nov 12, 2020 · 3 comments
Assignees

Comments

@thimo
Copy link
Collaborator

thimo commented Nov 12, 2020

Bootstrap 5 alpha 3 can now render a very nice looking file selector without needing additional classes or extra markup.

Current markup for f.file_field :image:

<div class="mb-3">
  <label class="form-label" for="workout_video_image">Image</label>
  <div class="form-file">
    <input class="form-file-input" type="file" name="workout_video[image]" id="workout_video_image">
    <label class="form-label form-file-label" for="workout_video_image">Choose file</label>
  </div>
</div>

Can be simplified to:

<div class="mb-3">
  <label class="form-label" for="workout_template_image">Image</label>
  <input class="form-control" type="file" name="workout_video[image]" id="workout_video_image">
</div>

More information can be found here: https://v5.getbootstrap.com/docs/5.0/forms/form-control/#file-input

I'd like to try to make this change myself, but if someone else is in a position to pick this up feel free to do so.

@lcreid
Copy link
Contributor

lcreid commented Jan 14, 2021

Nice catch! We'd love to see a PR for this. If you have time to work on it, just assign the issue to yourself (so no one else starts working on it), and have a go. Thanks very much for your contribution.

(And no worries if you don't find time to do this. We'll get it done eventually.)

@thimo
Copy link
Collaborator Author

thimo commented Apr 6, 2021

@lcreid I'd like to (finally) start working on this and assign this issue to myself. But I can't seem to find the option to do so. Any help on how I can do that? Or maybe you can assign it to me? Same for the other issue I created: #573.

@lcreid
Copy link
Contributor

lcreid commented Apr 10, 2021

Hmmm. Maybe you're not allowed to assign yourself. The history of this gem is long, and none of us currently have full permissions on the repo, so maybe we're stuck with people not being able to assign themselves. Thanks for pointing that out.

lcreid added a commit that referenced this issue Apr 11, 2021
* 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 #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 <lcreid@jadesystems.ca>
@lcreid lcreid closed this as completed Apr 11, 2021
lcreid added a commit that referenced this issue Nov 12, 2021
* Start README for Bootstrap 5

* Preliminary support for Bootstrap 5 (#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" (#571)

* Fix tests in bootstrap-5 branch. Fixes #582 (#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. Fixes #573 (#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. Fixes #572 (#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 #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 <lcreid@jadesystems.ca>

* Get rid of `heredoc` on `bootstrap-5` branch (#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 (#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 <<~ (#587)

* Replace strip_heredoc with <<~

Also fix newly detected Rubocop offenses on indentation

* Update CHANGELOG

* Simplify Dockerfile and add documentation (#588)

* Simplify Dockerfile and add documentation

* A few more additions to .gitignore

* Ignore gems placed when using Dockerfile (#590)

* Fix formatting and heredoc

* Fix bad merge

Co-authored-by: Uwe Kubosch <uwe@kubosch.no>
Co-authored-by: Uwe Kubosch <donv@users.noreply.github.com>
Co-authored-by: Thimo Jansen <thimo@defrog.nl>

* Cherry pick some commits from `main` (#594)

* Change default branch to `main` (#592)

* Change default branch to `main`

* Add GitHub token for Danger

* Change default branch to `main` (#592)

* Change default branch to `main`

* Add GitHub token for Danger

* Fix deprecation that I broke again

* Errors on invalid feedback (#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 <lcreid@jadesystems.ca>

* README: Use GH Actions badge, drop Travis badge, configuration file (#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 <taylorthurlow@me.com>
Co-authored-by: Thimo Jansen <thimo@defrog.nl>
Co-authored-by: Uwe Kubosch <uwe@kubosch.no>
Co-authored-by: Uwe Kubosch <donv@users.noreply.github.com>
Co-authored-by: Chrıs Seelus <cseelus@gmail.com>
Co-authored-by: Olle Jonsson <olle.jonsson@gmail.com>
lcreid added a commit that referenced this issue Nov 12, 2021
* Start README for Bootstrap 5

* Preliminary support for Bootstrap 5 (#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" (#571)

* Fix tests in bootstrap-5 branch. Fixes #582 (#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. Fixes #573 (#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. Fixes #572 (#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 #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 <lcreid@jadesystems.ca>

* Get rid of `heredoc` on `bootstrap-5` branch (#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 (#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 <<~ (#587)

* Replace strip_heredoc with <<~

Also fix newly detected Rubocop offenses on indentation

* Update CHANGELOG

* Simplify Dockerfile and add documentation (#588)

* Simplify Dockerfile and add documentation

* A few more additions to .gitignore

* Ignore gems placed when using Dockerfile (#590)

* Fix formatting and heredoc

* Fix bad merge

Co-authored-by: Uwe Kubosch <uwe@kubosch.no>
Co-authored-by: Uwe Kubosch <donv@users.noreply.github.com>
Co-authored-by: Thimo Jansen <thimo@defrog.nl>

* Cherry pick some commits from `main` (#594)

* Change default branch to `main` (#592)

* Change default branch to `main`

* Add GitHub token for Danger

* Change default branch to `main` (#592)

* Change default branch to `main`

* Add GitHub token for Danger

* Fix deprecation that I broke again

* Errors on invalid feedback (#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 <lcreid@jadesystems.ca>

* README: Use GH Actions badge, drop Travis badge, configuration file (#600)

* README: Use GH Actions badge, drop Travis badge

* Delete unused TravisCI configuration file

* Update README for release of 5.0

* Preparing v5.0.0

Co-authored-by: Taylor Thurlow <taylorthurlow@me.com>
Co-authored-by: Thimo Jansen <thimo@defrog.nl>
Co-authored-by: Uwe Kubosch <uwe@kubosch.no>
Co-authored-by: Uwe Kubosch <donv@users.noreply.github.com>
Co-authored-by: Chrıs Seelus <cseelus@gmail.com>
Co-authored-by: Olle Jonsson <olle.jonsson@gmail.com>
CharlieWinkwaves pushed a commit to CharlieWinkwaves/bootstrap_form that referenced this issue Dec 28, 2021
…y#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 <lcreid@jadesystems.ca>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants