diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 7a8e47a4f..af6718c83 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -9,14 +9,14 @@ jobs: Lint: runs-on: ubuntu-latest env: - BUNDLE_GEMFILE: gemfiles/6.1.gemfile + BUNDLE_GEMFILE: gemfiles/7.1.gemfile steps: - uses: actions/checkout@v3 with: fetch-depth: 0 - uses: ruby/setup-ruby@v1 with: - ruby-version: 3.0.6 + ruby-version: 3.2.7 bundler-cache: true # Disabled since it requires access not granted by GitHub Actions for PRs # - name: Danger @@ -32,15 +32,8 @@ jobs: strategy: fail-fast: false matrix: - ruby-version: [ '3.3', '3.2', '3.1', '3.0', 'ruby-head' ] - gemfile: [ '7.2', '7.1', '7.0', '6.1', 'edge' ] - exclude: - - ruby-version: '3.1' - gemfile: 'edge' - - ruby-version: '3.0' - gemfile: 'edge' - - ruby-version: '3.0' - gemfile: '7.2' + ruby-version: [ '3.4', '3.3', '3.2', 'ruby-head' ] + gemfile: [ '7.2', '7.1', 'edge' ] env: BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile steps: @@ -61,12 +54,12 @@ jobs: with: working-directory: demo bundler-cache: true - ruby-version: 3.3.2 + ruby-version: 3.4.2 - name: Run tests working-directory: demo run: bundle exec rake test:all - - name: Commit changed screenshots and other files - if: failure() - working-directory: demo - run: bundle exec rake commit + # - name: Commit changed screenshots and other files + # if: failure() + # working-directory: demo + # run: bundle exec rake commit diff --git a/.rubocop.yml b/.rubocop.yml index f9e797b99..15e25d3ff 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,12 +1,12 @@ -require: +plugins: - rubocop-performance - rubocop-rails AllCops: DisplayCopNames: true DisplayStyleGuide: true - TargetRubyVersion: 3.0 - TargetRailsVersion: 6.1 + TargetRubyVersion: 3.2 + TargetRailsVersion: 7.1 NewCops: enable Exclude: - bin/* diff --git a/README.md b/README.md index 3780d6c98..738be31d1 100644 --- a/README.md +++ b/README.md @@ -25,8 +25,8 @@ Some other nice things that `bootstrap_form` does for you are: `bootstrap_form` supports at a minimum the currently supported versions of Ruby and Rails: -* Ruby 3.0+ (https://www.ruby-lang.org/en/downloads/branches/) -* Rails 6.1+ (https://guides.rubyonrails.org/maintenance_policy.html) +* Ruby 3.2+ (https://www.ruby-lang.org/en/downloads/branches/) +* Rails 7.1+ (https://guides.rubyonrails.org/maintenance_policy.html) * Bootstrap 5.0+ ## Installation diff --git a/bootstrap_form.gemspec b/bootstrap_form.gemspec index 4118aaf8e..9cfabe09b 100644 --- a/bootstrap_form.gemspec +++ b/bootstrap_form.gemspec @@ -23,7 +23,7 @@ Gem::Specification.new do |s| s.bindir = "exe" s.require_paths = ["lib"] - s.required_ruby_version = ">= 3.0" + s.required_ruby_version = ">= 3.2" s.add_dependency("actionpack", BootstrapForm::REQUIRED_RAILS_VERSION) s.add_dependency("activemodel", BootstrapForm::REQUIRED_RAILS_VERSION) diff --git a/demo/.ruby-version b/demo/.ruby-version index 14dbd3772..fb72f061b 100644 --- a/demo/.ruby-version +++ b/demo/.ruby-version @@ -1 +1 @@ -ruby-3.0.6 +ruby-3.2.7 diff --git a/demo/Gemfile.lock b/demo/Gemfile.lock index 410156e63..fa74e11de 100644 --- a/demo/Gemfile.lock +++ b/demo/Gemfile.lock @@ -2,35 +2,35 @@ PATH remote: .. specs: bootstrap_form (5.4.0) - actionpack (>= 6.1) - activemodel (>= 6.1) + actionpack (>= 7.1) + activemodel (>= 7.1) GEM remote: https://rubygems.org/ specs: - actioncable (7.2.1) - actionpack (= 7.2.1) - activesupport (= 7.2.1) + actioncable (7.2.2.1) + actionpack (= 7.2.2.1) + activesupport (= 7.2.2.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.2.1) - actionpack (= 7.2.1) - activejob (= 7.2.1) - activerecord (= 7.2.1) - activestorage (= 7.2.1) - activesupport (= 7.2.1) + actionmailbox (7.2.2.1) + actionpack (= 7.2.2.1) + activejob (= 7.2.2.1) + activerecord (= 7.2.2.1) + activestorage (= 7.2.2.1) + activesupport (= 7.2.2.1) mail (>= 2.8.0) - actionmailer (7.2.1) - actionpack (= 7.2.1) - actionview (= 7.2.1) - activejob (= 7.2.1) - activesupport (= 7.2.1) + actionmailer (7.2.2.1) + actionpack (= 7.2.2.1) + actionview (= 7.2.2.1) + activejob (= 7.2.2.1) + activesupport (= 7.2.2.1) mail (>= 2.8.0) rails-dom-testing (~> 2.2) - actionpack (7.2.1) - actionview (= 7.2.1) - activesupport (= 7.2.1) + actionpack (7.2.2.1) + actionview (= 7.2.2.1) + activesupport (= 7.2.2.1) nokogiri (>= 1.8.5) racc rack (>= 2.2.4, < 3.2) @@ -39,36 +39,37 @@ GEM rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) useragent (~> 0.16) - actiontext (7.2.1) - actionpack (= 7.2.1) - activerecord (= 7.2.1) - activestorage (= 7.2.1) - activesupport (= 7.2.1) + actiontext (7.2.2.1) + actionpack (= 7.2.2.1) + activerecord (= 7.2.2.1) + activestorage (= 7.2.2.1) + activesupport (= 7.2.2.1) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.2.1) - activesupport (= 7.2.1) + actionview (7.2.2.1) + activesupport (= 7.2.2.1) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activejob (7.2.1) - activesupport (= 7.2.1) + activejob (7.2.2.1) + activesupport (= 7.2.2.1) globalid (>= 0.3.6) - activemodel (7.2.1) - activesupport (= 7.2.1) - activerecord (7.2.1) - activemodel (= 7.2.1) - activesupport (= 7.2.1) + activemodel (7.2.2.1) + activesupport (= 7.2.2.1) + activerecord (7.2.2.1) + activemodel (= 7.2.2.1) + activesupport (= 7.2.2.1) timeout (>= 0.4.0) - activestorage (7.2.1) - actionpack (= 7.2.1) - activejob (= 7.2.1) - activerecord (= 7.2.1) - activesupport (= 7.2.1) + activestorage (7.2.2.1) + actionpack (= 7.2.2.1) + activejob (= 7.2.2.1) + activerecord (= 7.2.2.1) + activesupport (= 7.2.2.1) marcel (~> 1.0) - activesupport (7.2.1) + activesupport (7.2.2.1) base64 + benchmark (>= 0.3) bigdecimal concurrent-ruby (~> 1.0, >= 1.3.1) connection_pool (>= 2.2.5) @@ -81,7 +82,8 @@ GEM addressable (2.8.7) public_suffix (>= 2.0.2, < 7.0) base64 (0.2.0) - bigdecimal (3.1.8) + benchmark (0.4.0) + bigdecimal (3.1.9) bindex (0.8.1) bootsnap (1.18.4) msgpack (~> 1.2) @@ -95,28 +97,29 @@ GEM rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) - capybara-screenshot-diff (1.9.0) - actionpack (>= 6.1, < 8) + capybara-screenshot-diff (1.10.2) + actionpack (>= 7.0, < 9) capybara (>= 2, < 4) chunky_png (1.4.0) - concurrent-ruby (1.3.4) - connection_pool (2.4.1) + concurrent-ruby (1.3.5) + connection_pool (2.5.0) crass (1.0.6) - cssbundling-rails (1.4.1) + cssbundling-rails (1.4.3) railties (>= 6.0.0) - date (3.3.4) - debug (1.9.2) + date (3.4.1) + debug (1.10.0) irb (~> 1.10) reline (>= 0.3.8) drb (2.2.1) - erubi (1.13.0) + erubi (1.13.1) globalid (1.2.1) activesupport (>= 6.1) htmlbeautifier (1.4.3) - i18n (1.14.6) + i18n (1.14.7) concurrent-ruby (~> 1.0) - io-console (0.7.2) - irb (1.14.1) + io-console (0.8.0) + irb (1.15.1) + pp (>= 0.6.0) rdoc (>= 4.0.0) reline (>= 0.4.2) jbuilder (2.13.0) @@ -124,8 +127,8 @@ GEM activesupport (>= 5.0.0) jsbundling-rails (1.3.1) railties (>= 6.0.0) - logger (1.6.1) - loofah (2.22.0) + logger (1.6.6) + loofah (2.24.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) mail (2.8.1) @@ -136,83 +139,89 @@ GEM marcel (1.0.4) matrix (0.4.2) mini_mime (1.1.5) - minitest (5.25.1) - msgpack (1.7.3) - net-imap (0.4.17) + mini_portile2 (2.8.8) + minitest (5.25.4) + msgpack (1.8.0) + net-imap (0.5.6) date net-protocol net-pop (0.1.2) net-protocol net-protocol (0.2.2) timeout - net-smtp (0.5.0) + net-smtp (0.5.1) net-protocol - nio4r (2.7.3) - nokogiri (1.16.7-aarch64-linux) + nio4r (2.7.4) + nokogiri (1.18.3) + mini_portile2 (~> 2.8.2) racc (~> 1.4) - nokogiri (1.16.7-arm-linux) + nokogiri (1.18.3-aarch64-linux-gnu) racc (~> 1.4) - nokogiri (1.16.7-arm64-darwin) + nokogiri (1.18.3-arm-linux-gnu) racc (~> 1.4) - nokogiri (1.16.7-x86-linux) + nokogiri (1.18.3-arm64-darwin) racc (~> 1.4) - nokogiri (1.16.7-x86_64-darwin) + nokogiri (1.18.3-x86_64-darwin) racc (~> 1.4) - nokogiri (1.16.7-x86_64-linux) + nokogiri (1.18.3-x86_64-linux-gnu) racc (~> 1.4) - psych (5.1.2) + pp (0.6.2) + prettyprint + prettyprint (0.2.0) + psych (5.2.3) + date stringio public_suffix (6.0.1) - puma (6.4.3) + puma (6.6.0) nio4r (~> 2.0) racc (1.8.1) - rack (3.1.8) - rack-session (2.0.0) + rack (3.1.12) + rack-session (2.1.0) + base64 (>= 0.1.0) rack (>= 3.0.0) - rack-test (2.1.0) + rack-test (2.2.0) rack (>= 1.3) - rackup (2.1.0) + rackup (2.2.1) rack (>= 3) - webrick (~> 1.8) - rails (7.2.1) - actioncable (= 7.2.1) - actionmailbox (= 7.2.1) - actionmailer (= 7.2.1) - actionpack (= 7.2.1) - actiontext (= 7.2.1) - actionview (= 7.2.1) - activejob (= 7.2.1) - activemodel (= 7.2.1) - activerecord (= 7.2.1) - activestorage (= 7.2.1) - activesupport (= 7.2.1) + rails (7.2.2.1) + actioncable (= 7.2.2.1) + actionmailbox (= 7.2.2.1) + actionmailer (= 7.2.2.1) + actionpack (= 7.2.2.1) + actiontext (= 7.2.2.1) + actionview (= 7.2.2.1) + activejob (= 7.2.2.1) + activemodel (= 7.2.2.1) + activerecord (= 7.2.2.1) + activestorage (= 7.2.2.1) + activesupport (= 7.2.2.1) bundler (>= 1.15.0) - railties (= 7.2.1) + railties (= 7.2.2.1) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.6.0) + rails-html-sanitizer (1.6.2) loofah (~> 2.21) - nokogiri (~> 1.14) - railties (7.2.1) - actionpack (= 7.2.1) - activesupport (= 7.2.1) + nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) + railties (7.2.2.1) + actionpack (= 7.2.2.1) + activesupport (= 7.2.2.1) irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) thor (~> 1.0, >= 1.2.2) zeitwerk (~> 2.6) rake (13.2.1) - rdoc (6.7.0) + rdoc (6.12.0) psych (>= 4.0.0) - regexp_parser (2.9.2) - reline (0.5.10) + regexp_parser (2.10.0) + reline (0.6.0) io-console (~> 0.5) - rexml (3.3.8) - rubyzip (2.3.2) - securerandom (0.3.1) - selenium-webdriver (4.25.0) + rexml (3.4.1) + rubyzip (2.4.1) + securerandom (0.4.1) + selenium-webdriver (4.29.1) base64 (~> 0.2) logger (~> 1.4) rexml (~> 3.2, >= 3.2.5) @@ -225,31 +234,31 @@ GEM actionpack (>= 6.1) activesupport (>= 6.1) sprockets (>= 3.0.0) - sqlite3 (2.1.0-aarch64-linux-gnu) - sqlite3 (2.1.0-arm-linux-gnu) - sqlite3 (2.1.0-arm64-darwin) - sqlite3 (2.1.0-x86-linux-gnu) - sqlite3 (2.1.0-x86_64-darwin) - sqlite3 (2.1.0-x86_64-linux-gnu) - stringio (3.1.1) + sqlite3 (2.6.0-aarch64-linux-gnu) + sqlite3 (2.6.0-arm-linux-gnu) + sqlite3 (2.6.0-arm64-darwin) + sqlite3 (2.6.0-x86-linux-gnu) + sqlite3 (2.6.0-x86_64-darwin) + sqlite3 (2.6.0-x86_64-linux-gnu) + stringio (3.1.5) thor (1.3.2) - timeout (0.4.1) + timeout (0.4.3) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - useragent (0.16.10) + useragent (0.16.11) web-console (4.2.1) actionview (>= 6.0.0) activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - webrick (1.8.2) websocket (1.2.11) - websocket-driver (0.7.6) + websocket-driver (0.7.7) + base64 websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.7.0) + zeitwerk (2.7.2) PLATFORMS aarch64-linux diff --git a/demo/app/helpers/bootstrap_helper.rb b/demo/app/helpers/bootstrap_helper.rb index a69c77156..b28a0573d 100644 --- a/demo/app/helpers/bootstrap_helper.rb +++ b/demo/app/helpers/bootstrap_helper.rb @@ -1,6 +1,6 @@ module BootstrapHelper - def form_with_source(&block) - form_html = capture(&block) + def form_with_source(&) + form_html = capture(&) tag.div(class: "example") do concat(form_html) diff --git a/demo/app/models/user.rb b/demo/app/models/user.rb index 67a627e1f..fea3172bf 100644 --- a/demo/app/models/user.rb +++ b/demo/app/models/user.rb @@ -13,7 +13,7 @@ class User < ApplicationRecord has_one :address accepts_nested_attributes_for :address - has_rich_text(:life_story) if Rails::VERSION::STRING > "6" + has_rich_text(:life_story) def always true diff --git a/demo/app/views/bootstrap/form.html.erb b/demo/app/views/bootstrap/form.html.erb index 74d8bf654..105e462e4 100644 --- a/demo/app/views/bootstrap/form.html.erb +++ b/demo/app/views/bootstrap/form.html.erb @@ -48,7 +48,7 @@ <%= form.password_field :password, placeholder: "Password" %> <%= form.check_box :terms, label: "Agree to Terms" %> <%= form.collection_check_boxes :misc, @collection, :id, :street %> - <%= form.rich_text_area(:life_story) if Rails::VERSION::STRING > "6" %> + <%= form.rich_text_area(:life_story) %> <%= form.submit %> <% end %> <% end %> diff --git a/gemfiles/6.1.gemfile b/gemfiles/6.1.gemfile deleted file mode 100644 index fc548c835..000000000 --- a/gemfiles/6.1.gemfile +++ /dev/null @@ -1,10 +0,0 @@ -gems = "#{__dir__}/common.gemfile" -eval File.read(gems), binding, gems # rubocop: disable Security/Eval - -gem "base64" if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") -gem "bigdecimal" if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") -gem "drb" if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") -gem "logger" if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") -gem "mutex_m" if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") -gem "rails", "~> 6.1.0" -gem "sqlite3", "~> 1.4" diff --git a/gemfiles/7.0.gemfile b/gemfiles/7.0.gemfile deleted file mode 100644 index 2a3524da2..000000000 --- a/gemfiles/7.0.gemfile +++ /dev/null @@ -1,11 +0,0 @@ -gems = "#{__dir__}/common.gemfile" -eval File.read(gems), binding, gems # rubocop: disable Security/Eval - -gem "base64" if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") -gem "bigdecimal" if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") -gem "drb" if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") -gem "logger" if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") -gem "mutex_m" if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") -gem "rails", "~> 7.0.2" -gem "sprockets-rails", require: "sprockets/railtie" -gem "sqlite3", "~> 1.4" diff --git a/gemfiles/common.gemfile b/gemfiles/common.gemfile index cefcfad56..f65c6ff5f 100644 --- a/gemfiles/common.gemfile +++ b/gemfiles/common.gemfile @@ -19,7 +19,7 @@ end group :development, :test do gem "debug" - gem "pry-byebug" + gem "ostruct" if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.5.0") end group :ci do diff --git a/lib/bootstrap_form/action_view_extensions/form_helper.rb b/lib/bootstrap_form/action_view_extensions/form_helper.rb index c60b8bcf3..a0ebf1620 100644 --- a/lib/bootstrap_form/action_view_extensions/form_helper.rb +++ b/lib/bootstrap_form/action_view_extensions/form_helper.rb @@ -33,20 +33,20 @@ def bootstrap_form_with(options={}, &block) end end - def bootstrap_form_tag(options={}, &block) + def bootstrap_form_tag(options={}, &) options[:acts_like_form_tag] = true - bootstrap_form_for("", options, &block) + bootstrap_form_for("", options, &) end - def bootstrap_fields_for(record_name, record_object=nil, options={}, &block) + def bootstrap_fields_for(record_name, record_object=nil, options={}, &) options[:builder] = BootstrapForm::FormBuilder - fields_for(record_name, record_object, options, &block) + fields_for(record_name, record_object, options, &) end - def bootstrap_fields(scope=nil, model: nil, **options, &block) + def bootstrap_fields(scope=nil, model: nil, **options, &) options[:builder] = BootstrapForm::FormBuilder - fields(scope, model: model, **options, &block) + fields(scope, model: model, **options, &) end private diff --git a/lib/bootstrap_form/components/labels.rb b/lib/bootstrap_form/components/labels.rb index f496d80fa..579957ed8 100644 --- a/lib/bootstrap_form/components/labels.rb +++ b/lib/bootstrap_form/components/labels.rb @@ -43,7 +43,7 @@ def label_layout_classes(custom_label_col, group_layout) end def label_text(name, options) - label = options[:text] || object&.class&.try(:human_attribute_name, name)&.html_safe # rubocop:disable Rails/OutputSafety + label = options[:text] || object&.class&.try(:human_attribute_name, name)&.html_safe # rubocop:disable Rails/OutputSafety, Style/SafeNavigationChainLength if label_errors && error?(name) (" ".html_safe + get_error_messages(name)).prepend(label) else diff --git a/lib/bootstrap_form/form_builder.rb b/lib/bootstrap_form/form_builder.rb index fbc2fcf94..c4b425479 100644 --- a/lib/bootstrap_form/form_builder.rb +++ b/lib/bootstrap_form/form_builder.rb @@ -72,10 +72,10 @@ def add_default_form_attributes_and_form_inline(options) .compact.uniq, " ") end - def fields_for_with_bootstrap(record_name, record_object=nil, fields_options={}, &block) + def fields_for_with_bootstrap(record_name, record_object=nil, fields_options={}, &) fields_options = fields_for_options(record_object, fields_options) record_object = nil if record_object.is_a?(Hash) && record_object.extractable_options? - fields_for_without_bootstrap(record_name, record_object, fields_options, &block) + fields_for_without_bootstrap(record_name, record_object, fields_options, &) end bootstrap_alias :fields_for @@ -92,7 +92,7 @@ def fields_for_options(record_object, fields_options) %i[layout control_col inline_errors label_errors].each do |option| field_options[option] ||= options[option] end - field_options[:label_col] = field_options[:label_col].present? ? (field_options[:label_col]).to_s : options[:label_col] + field_options[:label_col] = field_options[:label_col].present? ? field_options[:label_col].to_s : options[:label_col] field_options end diff --git a/lib/bootstrap_form/form_group.rb b/lib/bootstrap_form/form_group.rb index c06a7e9c9..5039aa71a 100644 --- a/lib/bootstrap_form/form_group.rb +++ b/lib/bootstrap_form/form_group.rb @@ -29,15 +29,15 @@ def form_group_content_tag(name, field_name, without_field_name, options, html_o end end - def form_group_content(label, help_text, options, &block) # rubocop:disable Metrics/AbcSize + def form_group_content(label, help_text, options, &) # rubocop:disable Metrics/AbcSize label ||= ActiveSupport::SafeBuffer.new if group_layout_horizontal?(options[:layout]) - label + tag.div(capture(&block) + help_text, class: form_group_control_class(options)) + label + tag.div(capture(&) + help_text, class: form_group_control_class(options)) else content = ActiveSupport::SafeBuffer.new # Floating labels need to be rendered after the field content << label unless options[:floating] - content << capture(&block) + content << capture(&) content << label if options[:floating] content << help_text if help_text content diff --git a/lib/bootstrap_form/form_group_builder.rb b/lib/bootstrap_form/form_group_builder.rb index c465c1d7c..79eff7e56 100644 --- a/lib/bootstrap_form/form_group_builder.rb +++ b/lib/bootstrap_form/form_group_builder.rb @@ -6,7 +6,7 @@ module FormGroupBuilder private - def form_group_builder(method, options, html_options=nil, &block) + def form_group_builder(method, options, html_options=nil, &) no_wrapper = options[:wrapper] == false options = form_group_builder_options(options, method) @@ -21,7 +21,7 @@ def form_group_builder(method, options, html_options=nil, &block) if no_wrapper yield else - form_group(method, form_group_options, &block) + form_group(method, form_group_options, &) end end diff --git a/lib/bootstrap_form/helpers/bootstrap.rb b/lib/bootstrap_form/helpers/bootstrap.rb index 38934b235..3ed6bf13c 100644 --- a/lib/bootstrap_form/helpers/bootstrap.rb +++ b/lib/bootstrap_form/helpers/bootstrap.rb @@ -56,17 +56,17 @@ def static_control(*args) text_field_with_bootstrap(name, static_options) end - def custom_control(*args, &block) + def custom_control(*args, &) options = args.extract_options! name = args.first - form_group_builder(name, options, &block) + form_group_builder(name, options, &) end - def prepend_and_append_input(name, options, &block) + def prepend_and_append_input(name, options, &) options = options.extract!(:prepend, :append, :input_group_class).compact - input = capture(&block) || ActiveSupport::SafeBuffer.new + input = capture(&) || ActiveSupport::SafeBuffer.new input = attach_input(options, :prepend) + input + attach_input(options, :append) input << generate_error(name) @@ -75,8 +75,8 @@ def prepend_and_append_input(name, options, &block) input end - def input_with_error(name, &block) - input = capture(&block) + def input_with_error(name, &) + input = capture(&) input << generate_error(name) end diff --git a/lib/bootstrap_form/inputs/check_box.rb b/lib/bootstrap_form/inputs/check_box.rb index b095b75d6..eb2a2cff0 100644 --- a/lib/bootstrap_form/inputs/check_box.rb +++ b/lib/bootstrap_form/inputs/check_box.rb @@ -42,7 +42,7 @@ def check_box_options(name, options) check_box_options.merge!(required_field_options(options, name)) end - def check_box_label(name, options, checked_value, &block) + def check_box_label(name, options, checked_value, &) label_name = if options[:multiple] check_box_value(name, checked_value) else @@ -50,7 +50,7 @@ def check_box_label(name, options, checked_value, &block) end label_options = { class: check_box_label_class(options) } label_options[:for] = options[:id] if options[:id].present? - label(label_name, check_box_description(name, options, &block), label_options) + label(label_name, check_box_description(name, options, &), label_options) end def check_box_description(name, options, &block) diff --git a/lib/bootstrap_form/inputs/submit.rb b/lib/bootstrap_form/inputs/submit.rb index 272b0795b..cddad6636 100644 --- a/lib/bootstrap_form/inputs/submit.rb +++ b/lib/bootstrap_form/inputs/submit.rb @@ -1,7 +1,7 @@ module BootstrapForm module Inputs module Submit - def button(value=nil, options={}, &block) + def button(value=nil, options={}, &) value = setup_css_class "btn btn-secondary", value, options super end diff --git a/lib/bootstrap_form/version.rb b/lib/bootstrap_form/version.rb index 309980fa2..2b3d295c5 100644 --- a/lib/bootstrap_form/version.rb +++ b/lib/bootstrap_form/version.rb @@ -1,4 +1,4 @@ module BootstrapForm VERSION = "5.4.0".freeze - REQUIRED_RAILS_VERSION = ">= 6.1".freeze + REQUIRED_RAILS_VERSION = ">= 7.1".freeze end diff --git a/test/bootstrap_checkbox_test.rb b/test/bootstrap_checkbox_test.rb index 7fb61ce6e..6fdfd4549 100644 --- a/test/bootstrap_checkbox_test.rb +++ b/test/bootstrap_checkbox_test.rb @@ -124,7 +124,6 @@ class BootstrapCheckboxTest < ActionView::TestCase test "inline checkboxes from form layout" do expected = <<~HTML