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

Change main branch to Bootstrap 5 #611

Merged
merged 16 commits into from
Nov 12, 2021
Merged

Change main branch to Bootstrap 5 #611

merged 16 commits into from
Nov 12, 2021

Conversation

lcreid
Copy link
Contributor

@lcreid lcreid commented Nov 12, 2021

No description provided.

lcreid and others added 16 commits June 18, 2020 18:41
* 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.
…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
…rap-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
…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>
* 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 <uwe@kubosch.no>
Co-authored-by: Uwe Kubosch <donv@users.noreply.github.com>
Co-authored-by: Thimo Jansen <thimo@defrog.nl>
* 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
* 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>
…ootstrap-ruby#600)

* README: Use GH Actions badge, drop Travis badge

* Delete unused TravisCI configuration file
@lcreid lcreid merged commit 13af7bd into bootstrap-ruby:main Nov 12, 2021
@michaelbaudino michaelbaudino mentioned this pull request Feb 22, 2022
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

Successfully merging this pull request may close these issues.

None yet

5 participants