diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e75951cc5c2..5dbddfd3208 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -25,6 +25,7 @@ jobs: os: - ubuntu-latest deps: + - rails_72 - rails_71 - rails_70 - rails_61 @@ -37,11 +38,11 @@ jobs: - name: Configure bundler (default) run: | echo "BUNDLE_GEMFILE=Gemfile" >> "$GITHUB_ENV" - if: matrix.deps == 'rails_71' + if: matrix.deps == 'rails_72' - name: Configure bundler (alternative) run: | echo "BUNDLE_GEMFILE=gemfiles/${{ matrix.deps }}/Gemfile" >> "$GITHUB_ENV" - if: matrix.deps != 'rails_71' + if: matrix.deps != 'rails_72' - uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b1232ee870..bae681f4064 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ ## Unreleased +## 3.2.4 [☰](https://github.com/activeadmin/activeadmin/compare/v3.2.3..v3.2.4) + +### Enhancements + +* Test against Rails 7.2 [#8434] by [@mgrunberg] + +### Bug Fixes + +* Backport Improve form f.inputs attributes rendering [#8446] by [@amiel] + ## 3.2.3 [☰](https://github.com/activeadmin/activeadmin/compare/v3.2.2..v3.2.3) ### Enhancements @@ -932,6 +942,8 @@ Please check [0-6-stable] for previous changes. [#8349]: https://github.com/activeadmin/activeadmin/pull/8349 [#8405]: https://github.com/activeadmin/activeadmin/pull/8405 [#8412]: https://github.com/activeadmin/activeadmin/pull/8412 +[#8434]: https://github.com/activeadmin/activeadmin/pull/8434 +[#8446]: https://github.com/activeadmin/activeadmin/pull/8446 [@1000ship]: https://github.com/1000ship [@5t111111]: https://github.com/5t111111 diff --git a/Gemfile b/Gemfile index 858019ae430..fd6ffbceb4c 100644 --- a/Gemfile +++ b/Gemfile @@ -10,11 +10,11 @@ group :development, :test do gem "draper" gem "devise" - gem "rails", "~> 7.1.0" + gem "rails", "~> 7.2.0" gem "sprockets-rails" gem "sassc-rails" - gem "ransack", ">= 4.1.0" + gem "ransack", ">= 4.2.0" gem "formtastic", ">= 5.0.0" end @@ -31,7 +31,7 @@ group :test do gem "launchy" gem "parallel_tests" gem "rspec-rails" - gem "sqlite3", "~> 1.7", platform: :mri + gem "sqlite3", platform: :mri # Translations gem "i18n-tasks" diff --git a/Gemfile.lock b/Gemfile.lock index d3ac1148c62..ba7554882c6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - activeadmin (3.2.3) + activeadmin (3.2.4) arbre (~> 1.2, >= 1.2.1) csv formtastic (>= 3.1) @@ -15,84 +15,80 @@ PATH GEM remote: https://rubygems.org/ specs: - actioncable (7.1.3.4) - actionpack (= 7.1.3.4) - activesupport (= 7.1.3.4) + actioncable (7.2.0) + actionpack (= 7.2.0) + activesupport (= 7.2.0) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.1.3.4) - actionpack (= 7.1.3.4) - activejob (= 7.1.3.4) - activerecord (= 7.1.3.4) - activestorage (= 7.1.3.4) - activesupport (= 7.1.3.4) - mail (>= 2.7.1) - net-imap - net-pop - net-smtp - actionmailer (7.1.3.4) - actionpack (= 7.1.3.4) - actionview (= 7.1.3.4) - activejob (= 7.1.3.4) - activesupport (= 7.1.3.4) - mail (~> 2.5, >= 2.5.4) - net-imap - net-pop - net-smtp + actionmailbox (7.2.0) + actionpack (= 7.2.0) + activejob (= 7.2.0) + activerecord (= 7.2.0) + activestorage (= 7.2.0) + activesupport (= 7.2.0) + mail (>= 2.8.0) + actionmailer (7.2.0) + actionpack (= 7.2.0) + actionview (= 7.2.0) + activejob (= 7.2.0) + activesupport (= 7.2.0) + mail (>= 2.8.0) rails-dom-testing (~> 2.2) - actionpack (7.1.3.4) - actionview (= 7.1.3.4) - activesupport (= 7.1.3.4) + actionpack (7.2.0) + actionview (= 7.2.0) + activesupport (= 7.2.0) nokogiri (>= 1.8.5) racc - rack (>= 2.2.4) + rack (>= 2.2.4, < 3.2) rack-session (>= 1.0.1) rack-test (>= 0.6.3) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - actiontext (7.1.3.4) - actionpack (= 7.1.3.4) - activerecord (= 7.1.3.4) - activestorage (= 7.1.3.4) - activesupport (= 7.1.3.4) + useragent (~> 0.16) + actiontext (7.2.0) + actionpack (= 7.2.0) + activerecord (= 7.2.0) + activestorage (= 7.2.0) + activesupport (= 7.2.0) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.1.3.4) - activesupport (= 7.1.3.4) + actionview (7.2.0) + activesupport (= 7.2.0) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activejob (7.1.3.4) - activesupport (= 7.1.3.4) + activejob (7.2.0) + activesupport (= 7.2.0) globalid (>= 0.3.6) - activemodel (7.1.3.4) - activesupport (= 7.1.3.4) + activemodel (7.2.0) + activesupport (= 7.2.0) activemodel-serializers-xml (1.0.2) activemodel (> 5.x) activesupport (> 5.x) builder (~> 3.1) - activerecord (7.1.3.4) - activemodel (= 7.1.3.4) - activesupport (= 7.1.3.4) + activerecord (7.2.0) + activemodel (= 7.2.0) + activesupport (= 7.2.0) timeout (>= 0.4.0) - activestorage (7.1.3.4) - actionpack (= 7.1.3.4) - activejob (= 7.1.3.4) - activerecord (= 7.1.3.4) - activesupport (= 7.1.3.4) + activestorage (7.2.0) + actionpack (= 7.2.0) + activejob (= 7.2.0) + activerecord (= 7.2.0) + activesupport (= 7.2.0) marcel (~> 1.0) - activesupport (7.1.3.4) + activesupport (7.2.0) base64 bigdecimal - concurrent-ruby (~> 1.0, >= 1.0.2) + concurrent-ruby (~> 1.0, >= 1.3.1) connection_pool (>= 2.2.5) drb i18n (>= 1.6, < 2) + logger (>= 1.4.2) minitest (>= 5.1) - mutex_m - tzinfo (~> 2.0) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) addressable (2.8.7) public_suffix (>= 2.0.2, < 7.0) arbre (1.7.0) @@ -261,7 +257,6 @@ GEM mini_portile2 (2.8.7) minitest (5.24.1) multi_test (1.1.0) - mutex_m (0.2.0) net-http (0.4.1) uri net-imap (0.4.14) @@ -306,20 +301,20 @@ GEM rackup (2.1.0) rack (>= 3) webrick (~> 1.8) - rails (7.1.3.4) - actioncable (= 7.1.3.4) - actionmailbox (= 7.1.3.4) - actionmailer (= 7.1.3.4) - actionpack (= 7.1.3.4) - actiontext (= 7.1.3.4) - actionview (= 7.1.3.4) - activejob (= 7.1.3.4) - activemodel (= 7.1.3.4) - activerecord (= 7.1.3.4) - activestorage (= 7.1.3.4) - activesupport (= 7.1.3.4) + rails (7.2.0) + actioncable (= 7.2.0) + actionmailbox (= 7.2.0) + actionmailer (= 7.2.0) + actionpack (= 7.2.0) + actiontext (= 7.2.0) + actionview (= 7.2.0) + activejob (= 7.2.0) + activemodel (= 7.2.0) + activerecord (= 7.2.0) + activestorage (= 7.2.0) + activesupport (= 7.2.0) bundler (>= 1.15.0) - railties (= 7.1.3.4) + railties (= 7.2.0) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -330,10 +325,10 @@ GEM rails-i18n (7.0.9) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 8) - railties (7.1.3.4) - actionpack (= 7.1.3.4) - activesupport (= 7.1.3.4) - irb + railties (7.2.0) + actionpack (= 7.2.0) + activesupport (= 7.2.0) + irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) thor (~> 1.0, >= 1.2.2) @@ -408,6 +403,7 @@ GEM sawyer (0.9.2) addressable (>= 2.3.5) faraday (>= 0.17.3, < 3) + securerandom (0.3.1) simplecov (0.22.0) docile (~> 1.1) simplecov-html (~> 0.11) @@ -441,6 +437,7 @@ GEM concurrent-ruby (~> 1.0) unicode-display_width (2.5.0) uri (0.13.0) + useragent (0.16.10) warden (1.2.9) rack (>= 2.0.9) webrick (1.8.1) @@ -476,10 +473,10 @@ DEPENDENCIES octokit parallel_tests pundit - rails (~> 7.1.0) + rails (~> 7.2.0) rails-i18n rake - ransack (>= 4.1.0) + ransack (>= 4.2.0) rspec-rails rubocop rubocop-packaging @@ -489,7 +486,7 @@ DEPENDENCIES simplecov simplecov-cobertura sprockets-rails - sqlite3 (~> 1.7) + sqlite3 webrick yard diff --git a/features/edit_page.feature b/features/edit_page.feature index 5368e4e6dfa..7ed9be47873 100644 --- a/features/edit_page.feature +++ b/features/edit_page.feature @@ -6,8 +6,11 @@ Feature: Edit Page Given a category named "Music" exists And a user named "John Doe" exists And a post with the title "Hello World" written by "John Doe" exists + And a tag named "Bugs" exists And I am logged in - And a configuration of: + + Scenario: Default form with no config + Given a configuration of: """ ActiveAdmin.register Post do permit_params :custom_category_id, :author_id, :title, @@ -15,9 +18,7 @@ Feature: Edit Page end """ When I am on the index page for posts - - Scenario: Default form with no config - Given I follow "Edit" + And I follow "Edit" Then the "Title" field should contain "Hello World" And the "Body" field should contain "" And the "Category" field should contain "" @@ -47,6 +48,7 @@ Feature: Edit Page end end """ + When I am on the index page for posts And I follow "Edit" Then I should see a fieldset titled "Your Post" And I should see a fieldset titled "Publishing" @@ -76,6 +78,7 @@ Feature: Edit Page end end """ + When I am on the index page for posts And I follow "New" Then I follow "Posts" And I follow "Edit" @@ -107,6 +110,7 @@ Feature: Edit Page form partial: "form" end """ + When I am on the index page for posts And I follow "Edit" Then the "Title" field should contain "Hello World" And the "Body" field should contain "" @@ -115,3 +119,20 @@ Feature: Edit Page Then I should see "Post was successfully updated." And I should see the attribute "Title" with "Hello World from update" And I should see the attribute "Author" with "John Doe" + + Scenario: Generating a custom form for Tag resource + Given a configuration of: + """ + ActiveAdmin.register Tag do + form do |f| + f.inputs "Details" do + f.input :name + end + f.actions + end + end + """ + When I am on the index page for tags + And I follow "Edit" + Then I should see a fieldset titled "Details" + And the "Name" field should contain "Bugs" diff --git a/features/step_definitions/factory_steps.rb b/features/step_definitions/factory_steps.rb index 8cb67ec5acc..9bc7f5bcf79 100644 --- a/features/step_definitions/factory_steps.rb +++ b/features/step_definitions/factory_steps.rb @@ -28,6 +28,10 @@ def create_user(name, type = "User") Store.create! name: name end +Given /^a tag named "([^"]*)" exists$/ do |name| + Tag.create! name: name +end + Given /^I create a new post with the title "([^"]*)"$/ do |title| first(:link, "Posts").click click_link "New Post" diff --git a/gemfiles/rails_61/Gemfile.lock b/gemfiles/rails_61/Gemfile.lock index 53a0b6e402b..edd857f9a6a 100644 --- a/gemfiles/rails_61/Gemfile.lock +++ b/gemfiles/rails_61/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: ../.. specs: - activeadmin (3.2.3) + activeadmin (3.2.4) arbre (~> 1.2, >= 1.2.1) csv formtastic (>= 3.1) diff --git a/gemfiles/rails_70/Gemfile.lock b/gemfiles/rails_70/Gemfile.lock index e10206222a4..1e4b30183e8 100644 --- a/gemfiles/rails_70/Gemfile.lock +++ b/gemfiles/rails_70/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: ../.. specs: - activeadmin (3.2.3) + activeadmin (3.2.4) arbre (~> 1.2, >= 1.2.1) csv formtastic (>= 3.1) diff --git a/gemfiles/rails_71/Gemfile b/gemfiles/rails_71/Gemfile new file mode 100644 index 00000000000..c8504adf545 --- /dev/null +++ b/gemfiles/rails_71/Gemfile @@ -0,0 +1,59 @@ +# frozen_string_literal: true +source "https://rubygems.org" + +group :development, :test do + gem "rake" + + gem "cancancan" + gem "pundit" + + gem "draper" + gem "devise" + + gem "rails", "~> 7.1.0" + + gem "sprockets-rails" + gem "sassc-rails" + gem "ransack", ">= 4.1.0" + gem "formtastic", ">= 5.0.0" +end + +group :test do + gem "cuprite" + gem "capybara" + gem "webrick" + + gem "simplecov", require: false # Test coverage generator. Go to /coverage/ after running tests + gem "simplecov-cobertura", require: false + gem "cucumber-rails", require: false + gem "cucumber" + gem "database_cleaner-active_record" + gem "launchy" + gem "parallel_tests" + gem "rspec-rails" + gem "sqlite3", "~> 1.7", platform: :mri + + # Translations + gem "i18n-tasks" + gem "i18n-spec" + gem "rails-i18n" # Provides default i18n for many languages +end + +group :release do + gem "chandler" # Github releases from changelog + gem "octokit" +end + +group :rubocop do + gem "rubocop" + gem "rubocop-packaging" + gem "rubocop-rspec" + gem "rubocop-rails" +end + +group :docs do + gem "yard" # Documentation generator + gem "kramdown" # Markdown implementation (for yard) +end + +gemspec path: "../.." diff --git a/gemfiles/rails_71/Gemfile.lock b/gemfiles/rails_71/Gemfile.lock new file mode 100644 index 00000000000..a48bf0a77e3 --- /dev/null +++ b/gemfiles/rails_71/Gemfile.lock @@ -0,0 +1,497 @@ +PATH + remote: ../.. + specs: + activeadmin (3.2.4) + arbre (~> 1.2, >= 1.2.1) + csv + formtastic (>= 3.1) + formtastic_i18n (>= 0.4) + inherited_resources (~> 1.7) + jquery-rails (>= 4.2) + kaminari (>= 1.2.1) + railties (>= 6.1) + ransack (>= 4.0) + +GEM + remote: https://rubygems.org/ + specs: + actioncable (7.1.3.4) + actionpack (= 7.1.3.4) + activesupport (= 7.1.3.4) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + zeitwerk (~> 2.6) + actionmailbox (7.1.3.4) + actionpack (= 7.1.3.4) + activejob (= 7.1.3.4) + activerecord (= 7.1.3.4) + activestorage (= 7.1.3.4) + activesupport (= 7.1.3.4) + mail (>= 2.7.1) + net-imap + net-pop + net-smtp + actionmailer (7.1.3.4) + actionpack (= 7.1.3.4) + actionview (= 7.1.3.4) + activejob (= 7.1.3.4) + activesupport (= 7.1.3.4) + mail (~> 2.5, >= 2.5.4) + net-imap + net-pop + net-smtp + rails-dom-testing (~> 2.2) + actionpack (7.1.3.4) + actionview (= 7.1.3.4) + activesupport (= 7.1.3.4) + nokogiri (>= 1.8.5) + racc + rack (>= 2.2.4) + rack-session (>= 1.0.1) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + actiontext (7.1.3.4) + actionpack (= 7.1.3.4) + activerecord (= 7.1.3.4) + activestorage (= 7.1.3.4) + activesupport (= 7.1.3.4) + globalid (>= 0.6.0) + nokogiri (>= 1.8.5) + actionview (7.1.3.4) + activesupport (= 7.1.3.4) + builder (~> 3.1) + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + activejob (7.1.3.4) + activesupport (= 7.1.3.4) + globalid (>= 0.3.6) + activemodel (7.1.3.4) + activesupport (= 7.1.3.4) + activemodel-serializers-xml (1.0.2) + activemodel (> 5.x) + activesupport (> 5.x) + builder (~> 3.1) + activerecord (7.1.3.4) + activemodel (= 7.1.3.4) + activesupport (= 7.1.3.4) + timeout (>= 0.4.0) + activestorage (7.1.3.4) + actionpack (= 7.1.3.4) + activejob (= 7.1.3.4) + activerecord (= 7.1.3.4) + activesupport (= 7.1.3.4) + marcel (~> 1.0) + activesupport (7.1.3.4) + base64 + bigdecimal + concurrent-ruby (~> 1.0, >= 1.0.2) + connection_pool (>= 2.2.5) + drb + i18n (>= 1.6, < 2) + minitest (>= 5.1) + mutex_m + tzinfo (~> 2.0) + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) + arbre (1.7.0) + activesupport (>= 3.0.0) + ruby2_keywords (>= 0.0.2) + ast (2.4.2) + base64 (0.2.0) + bcrypt (3.1.20) + bigdecimal (3.1.8) + builder (3.3.0) + cancancan (3.6.1) + capybara (3.40.0) + addressable + matrix + mini_mime (>= 0.1.3) + nokogiri (~> 1.11) + rack (>= 1.6.0) + rack-test (>= 0.6.3) + regexp_parser (>= 1.5, < 3.0) + xpath (~> 3.2) + chandler (0.9.0) + netrc + octokit (>= 2.2.0) + childprocess (5.0.0) + concurrent-ruby (1.3.3) + connection_pool (2.4.1) + crass (1.0.6) + csv (3.3.0) + cucumber (9.2.0) + builder (~> 3.2) + cucumber-ci-environment (> 9, < 11) + cucumber-core (> 13, < 14) + cucumber-cucumber-expressions (~> 17.0) + cucumber-gherkin (> 24, < 28) + cucumber-html-formatter (> 20.3, < 22) + cucumber-messages (> 19, < 25) + diff-lcs (~> 1.5) + mini_mime (~> 1.1) + multi_test (~> 1.1) + sys-uname (~> 1.2) + cucumber-ci-environment (10.0.1) + cucumber-core (13.0.3) + cucumber-gherkin (>= 27, < 28) + cucumber-messages (>= 20, < 23) + cucumber-tag-expressions (> 5, < 7) + cucumber-cucumber-expressions (17.1.0) + bigdecimal + cucumber-gherkin (27.0.0) + cucumber-messages (>= 19.1.4, < 23) + cucumber-html-formatter (21.4.1) + cucumber-messages (> 19, < 25) + cucumber-messages (22.0.0) + cucumber-rails (3.0.0) + capybara (>= 3.11, < 4) + cucumber (>= 5, < 10) + railties (>= 5.2, < 8) + cucumber-tag-expressions (6.1.0) + cuprite (0.15.1) + capybara (~> 3.0) + ferrum (~> 0.15.0) + database_cleaner-active_record (2.2.0) + activerecord (>= 5.a) + database_cleaner-core (~> 2.0.0) + database_cleaner-core (2.0.1) + date (3.3.4) + devise (4.9.4) + bcrypt (~> 3.0) + orm_adapter (~> 0.1) + railties (>= 4.1.0) + responders + warden (~> 1.2.3) + diff-lcs (1.5.1) + docile (1.4.1) + draper (4.0.2) + actionpack (>= 5.0) + activemodel (>= 5.0) + activemodel-serializers-xml (>= 1.0) + activesupport (>= 5.0) + request_store (>= 1.0) + ruby2_keywords + drb (2.2.1) + erubi (1.13.0) + faraday (2.10.0) + faraday-net_http (>= 2.0, < 3.2) + logger + faraday-net_http (3.1.1) + net-http + ferrum (0.15) + addressable (~> 2.5) + concurrent-ruby (~> 1.1) + webrick (~> 1.7) + websocket-driver (~> 0.7) + ffi (1.17.0) + ffi (1.17.0-arm64-darwin) + ffi (1.17.0-x86_64-linux-gnu) + formtastic (5.0.0) + actionpack (>= 6.0.0) + formtastic_i18n (0.7.0) + globalid (1.2.1) + activesupport (>= 6.1) + has_scope (0.8.2) + actionpack (>= 5.2) + activesupport (>= 5.2) + highline (3.1.0) + reline + i18n (1.14.5) + concurrent-ruby (~> 1.0) + i18n-spec (0.6.0) + iso + i18n-tasks (1.0.14) + activesupport (>= 4.0.2) + ast (>= 2.1.0) + erubi + highline (>= 2.0.0) + i18n + parser (>= 3.2.2.1) + rails-i18n + rainbow (>= 2.2.2, < 4.0) + terminal-table (>= 1.5.1) + inherited_resources (1.14.0) + actionpack (>= 6.0) + has_scope (>= 0.6) + railties (>= 6.0) + responders (>= 2) + io-console (0.7.2) + irb (1.14.0) + rdoc (>= 4.0.0) + reline (>= 0.4.2) + iso (0.4.0) + i18n + jquery-rails (4.6.0) + rails-dom-testing (>= 1, < 3) + railties (>= 4.2.0) + thor (>= 0.14, < 2.0) + json (2.7.2) + kaminari (1.2.2) + activesupport (>= 4.1.0) + kaminari-actionview (= 1.2.2) + kaminari-activerecord (= 1.2.2) + kaminari-core (= 1.2.2) + kaminari-actionview (1.2.2) + actionview + kaminari-core (= 1.2.2) + kaminari-activerecord (1.2.2) + activerecord + kaminari-core (= 1.2.2) + kaminari-core (1.2.2) + kramdown (2.4.0) + rexml + language_server-protocol (3.17.0.3) + launchy (3.0.1) + addressable (~> 2.8) + childprocess (~> 5.0) + logger (1.6.0) + loofah (2.22.0) + crass (~> 1.0.2) + nokogiri (>= 1.12.0) + mail (2.8.1) + mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp + marcel (1.0.4) + matrix (0.4.2) + mini_mime (1.1.5) + mini_portile2 (2.8.7) + minitest (5.24.1) + multi_test (1.1.0) + mutex_m (0.2.0) + net-http (0.4.1) + uri + net-imap (0.4.14) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.2) + timeout + net-smtp (0.5.0) + net-protocol + netrc (0.11.0) + nio4r (2.7.3) + nokogiri (1.16.7) + mini_portile2 (~> 2.8.2) + racc (~> 1.4) + nokogiri (1.16.7-arm64-darwin) + racc (~> 1.4) + nokogiri (1.16.7-x86_64-linux) + racc (~> 1.4) + octokit (9.1.0) + faraday (>= 1, < 3) + sawyer (~> 0.9) + orm_adapter (0.5.0) + parallel (1.25.1) + parallel_tests (4.7.1) + parallel + parser (3.3.4.0) + ast (~> 2.4.1) + racc + psych (5.1.2) + stringio + public_suffix (6.0.1) + pundit (2.3.2) + activesupport (>= 3.0.0) + racc (1.8.0) + rack (3.1.7) + rack-session (2.0.0) + rack (>= 3.0.0) + rack-test (2.1.0) + rack (>= 1.3) + rackup (2.1.0) + rack (>= 3) + webrick (~> 1.8) + rails (7.1.3.4) + actioncable (= 7.1.3.4) + actionmailbox (= 7.1.3.4) + actionmailer (= 7.1.3.4) + actionpack (= 7.1.3.4) + actiontext (= 7.1.3.4) + actionview (= 7.1.3.4) + activejob (= 7.1.3.4) + activemodel (= 7.1.3.4) + activerecord (= 7.1.3.4) + activestorage (= 7.1.3.4) + activesupport (= 7.1.3.4) + bundler (>= 1.15.0) + railties (= 7.1.3.4) + rails-dom-testing (2.2.0) + activesupport (>= 5.0.0) + minitest + nokogiri (>= 1.6) + rails-html-sanitizer (1.6.0) + loofah (~> 2.21) + nokogiri (~> 1.14) + rails-i18n (7.0.9) + i18n (>= 0.7, < 2) + railties (>= 6.0.0, < 8) + railties (7.1.3.4) + actionpack (= 7.1.3.4) + activesupport (= 7.1.3.4) + irb + rackup (>= 1.0.0) + rake (>= 12.2) + thor (~> 1.0, >= 1.2.2) + zeitwerk (~> 2.6) + rainbow (3.1.1) + rake (13.2.1) + ransack (4.2.0) + activerecord (>= 6.1.5) + activesupport (>= 6.1.5) + i18n + rdoc (6.7.0) + psych (>= 4.0.0) + regexp_parser (2.9.2) + reline (0.5.9) + io-console (~> 0.5) + request_store (1.7.0) + rack (>= 1.4) + responders (3.1.1) + actionpack (>= 5.2) + railties (>= 5.2) + rexml (3.3.2) + strscan + rspec-core (3.13.0) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.1) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.1) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-rails (6.1.3) + actionpack (>= 6.1) + activesupport (>= 6.1) + railties (>= 6.1) + rspec-core (~> 3.13) + rspec-expectations (~> 3.13) + rspec-mocks (~> 3.13) + rspec-support (~> 3.13) + rspec-support (3.13.1) + rubocop (1.65.0) + json (~> 2.3) + language_server-protocol (>= 3.17.0) + parallel (~> 1.10) + parser (>= 3.3.0.2) + rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 2.4, < 3.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.31.1, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.31.3) + parser (>= 3.3.1.0) + rubocop-packaging (0.5.2) + rubocop (>= 1.33, < 2.0) + rubocop-rails (2.25.1) + activesupport (>= 4.2.0) + rack (>= 1.1) + rubocop (>= 1.33.0, < 2.0) + rubocop-ast (>= 1.31.1, < 2.0) + rubocop-rspec (3.0.3) + rubocop (~> 1.61) + ruby-progressbar (1.13.0) + ruby2_keywords (0.0.5) + sassc (2.4.0) + ffi (~> 1.9) + sassc-rails (2.1.2) + railties (>= 4.0.0) + sassc (>= 2.0) + sprockets (> 3.0) + sprockets-rails + tilt + sawyer (0.9.2) + addressable (>= 2.3.5) + faraday (>= 0.17.3, < 3) + simplecov (0.22.0) + docile (~> 1.1) + simplecov-html (~> 0.11) + simplecov_json_formatter (~> 0.1) + simplecov-cobertura (2.1.0) + rexml + simplecov (~> 0.19) + simplecov-html (0.12.3) + simplecov_json_formatter (0.1.4) + sprockets (4.2.1) + concurrent-ruby (~> 1.0) + rack (>= 2.2.4, < 4) + sprockets-rails (3.5.1) + actionpack (>= 6.1) + activesupport (>= 6.1) + sprockets (>= 3.0.0) + sqlite3 (1.7.3) + mini_portile2 (~> 2.8.0) + sqlite3 (1.7.3-arm64-darwin) + sqlite3 (1.7.3-x86_64-linux) + stringio (3.1.1) + strscan (3.1.0) + sys-uname (1.3.0) + ffi (~> 1.1) + terminal-table (3.0.2) + unicode-display_width (>= 1.1.1, < 3) + thor (1.3.1) + tilt (2.4.0) + timeout (0.4.1) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + unicode-display_width (2.5.0) + uri (0.13.0) + warden (1.2.9) + rack (>= 2.0.9) + webrick (1.8.1) + websocket-driver (0.7.6) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + xpath (3.2.0) + nokogiri (~> 1.8) + yard (0.9.36) + zeitwerk (2.6.16) + +PLATFORMS + arm64-darwin + ruby + x86_64-linux + +DEPENDENCIES + activeadmin! + cancancan + capybara + chandler + cucumber + cucumber-rails + cuprite + database_cleaner-active_record + devise + draper + formtastic (>= 5.0.0) + i18n-spec + i18n-tasks + kramdown + launchy + octokit + parallel_tests + pundit + rails (~> 7.1.0) + rails-i18n + rake + ransack (>= 4.1.0) + rspec-rails + rubocop + rubocop-packaging + rubocop-rails + rubocop-rspec + sassc-rails + simplecov + simplecov-cobertura + sprockets-rails + sqlite3 (~> 1.7) + webrick + yard + +BUNDLED WITH + 2.5.16 diff --git a/lib/active_admin/version.rb b/lib/active_admin/version.rb index 1540aad0f5c..1addf212421 100644 --- a/lib/active_admin/version.rb +++ b/lib/active_admin/version.rb @@ -1,4 +1,4 @@ # frozen_string_literal: true module ActiveAdmin - VERSION = "3.2.3" + VERSION = "3.2.4" end diff --git a/lib/active_admin/views/components/active_admin_form.rb b/lib/active_admin/views/components/active_admin_form.rb index a2a6d11b075..82c2d3edf99 100644 --- a/lib/active_admin/views/components/active_admin_form.rb +++ b/lib/active_admin/views/components/active_admin_form.rb @@ -127,12 +127,24 @@ def build(form_builder, *args, &block) html_options[:class] ||= "inputs" legend = args.shift if args.first.is_a?(::String) legend = html_options.delete(:name) if html_options.key?(:name) - legend_tag = legend ? "" : "" - fieldset_attrs = html_options.map { |k, v| %Q{#{k}="#{v}"} }.join(" ") + legend_tag = legend ? helpers.tag.legend(legend, class: "fieldset-title") : "" + fieldset_attrs = tag_attributes html_options @opening_tag = "
" super(*(args << html_options), &block) end + + private + + def tag_attributes(html_options) + if Rails::VERSION::MAJOR <= 6 + # Reimplement tag.attributes to backport support for Rails 6.1. + # TODO: this can be removed when support for Rails 6.x is dropped + helpers.tag.tag_options(html_options.to_h).to_s.strip.html_safe + else + helpers.tag.attributes html_options + end + end end class SemanticActionsProxy < FormtasticProxy diff --git a/package.json b/package.json index 5ba7ba4b22a..31f83d03c96 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@activeadmin/activeadmin", - "version": "3.2.3", + "version": "3.2.4", "description": "The administration framework for Ruby on Rails.", "main": "app/assets/javascripts/active_admin/base.js", "type": "module", diff --git a/spec/unit/form_builder_spec.rb b/spec/unit/form_builder_spec.rb index 127b3bfc274..fe3bc97545c 100644 --- a/spec/unit/form_builder_spec.rb +++ b/spec/unit/form_builder_spec.rb @@ -62,7 +62,7 @@ def build_form(options = {}, form_object = Post.new, &block) context "with custom settings" do let :body do build_form do |f| - f.inputs class: "custom_class", name: "custom_name", custom_attr: "custom_attr" do + f.inputs class: "custom_class", name: "custom_name", custom_attr: "custom_attr", data: { test: "custom" } do f.input :title f.input :body end @@ -80,6 +80,10 @@ def build_form(options = {}, form_object = Post.new, &block) it "should generate a fieldset with a custom attributes" do expect(body).to have_selector("fieldset[custom_attr='custom_attr']") end + + it "should use the rails helper for rendering attributes" do + expect(body).to have_css("fieldset[data-test='custom']") + end end context "with XSS payload as name" do diff --git a/tasks/test_application.rb b/tasks/test_application.rb index d3197f982a9..7014d6bde5d 100644 --- a/tasks/test_application.rb +++ b/tasks/test_application.rb @@ -61,7 +61,7 @@ def base_dir end def app_name - return "rails_71" if main_app? + return "rails_72" if main_app? File.basename(File.dirname(gemfile)) end