diff --git a/.erb-lint.yml b/.erb-lint.yml new file mode 100644 index 0000000000..ad23fb6248 --- /dev/null +++ b/.erb-lint.yml @@ -0,0 +1,12 @@ +--- +EnableDefaultLinters: true +linters: + Rubocop: + enabled: true + rubocop_config: + require: standard + inherit_gem: + standard: config/base.yml + inherit_from: .erb-lint_rubocop.yml + AllCops: + DisabledByDefault: true diff --git a/.erb-lint_rubocop.yml b/.erb-lint_rubocop.yml new file mode 100644 index 0000000000..01944519ef --- /dev/null +++ b/.erb-lint_rubocop.yml @@ -0,0 +1,8 @@ +Layout/TrailingEmptyLines: + Enabled: false + +Layout/InitialIndentation: + Enabled: false + +Lint/UselessAssignment: + Enabled: false diff --git a/Gemfile b/Gemfile index b2a286c9ec..6ef092ebaa 100644 --- a/Gemfile +++ b/Gemfile @@ -22,6 +22,7 @@ gem 'cssbundling-rails' # # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem "rails", "~> 7.1.0" +# gem 'rails', github: 'rails/rails' # Use postgresql as the database for Active Record gem "pg", ">= 0.18", "< 2.0" @@ -102,6 +103,8 @@ group :development, :test do gem "faker", require: false gem "i18n-tasks", "~> 1.0.12" gem "erb-formatter" + # https://thoughtbot.com/blog/a-standard-way-to-lint-your-views + gem "erb_lint" gem "solargraph" gem "solargraph-rails" @@ -139,6 +142,7 @@ gem "active_median" gem 'acts_as_list' gem 'acts-as-taggable-on', '~> 10.0' +# gem 'acts-as-taggable-on', github: 'avo-hq/acts-as-taggable-on' gem "bundler-integrity", "~> 1.0" @@ -150,6 +154,7 @@ gem "chartkick" # Avo file filed requires this gem gem "activestorage" +# gem "activestorage", github: "rails/rails", branch: "main" # Required by Avo gem "sprockets-rails" diff --git a/Gemfile.lock b/Gemfile.lock index af4f47fce8..d13c06e45b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -154,7 +154,7 @@ GEM erubi (~> 1.4) parser (>= 2.4) smart_properties - bigdecimal (3.1.8) + bigdecimal (3.1.7) bindex (0.8.1) bootsnap (1.18.3) msgpack (~> 1.2) @@ -184,7 +184,6 @@ GEM crass (1.0.6) cssbundling-rails (1.4.0) railties (>= 6.0.0) - csv (3.3.0) cuprite (0.15) capybara (~> 3.0) ferrum (~> 0.14.0) @@ -238,6 +237,13 @@ GEM e2mmap (0.1.0) erb-formatter (0.7.1) syntax_tree (~> 6.0) + erb_lint (0.5.0) + activesupport + better_html (>= 2.0.1) + parser (>= 2.7.1.4) + rainbow + rubocop + smart_properties erubi (1.12.0) factory_bot (6.4.6) activesupport (>= 5.0.0) @@ -281,11 +287,10 @@ GEM listen (>= 3.0.0) railties (>= 6.0.0) htmlbeautifier (1.4.2) - httparty (0.22.0) - csv + httparty (0.21.0) mini_mime (>= 1.0.0) multi_xml (>= 0.5.2) - i18n (1.14.5) + i18n (1.14.4) concurrent-ruby (~> 1.0) i18n-tasks (1.0.13) activesupport (>= 4.0.2) @@ -306,8 +311,8 @@ GEM activesupport (>= 3.0) nokogiri (>= 1.6) io-console (0.7.2) - irb (1.13.1) - rdoc (>= 4.0.0) + irb (1.12.0) + rdoc reline (>= 0.4.2) iso (0.4.0) i18n @@ -338,9 +343,9 @@ GEM mapkick-rb (0.1.5) marcel (1.0.2) matrix (0.4.2) - meta-tags (2.21.0) + meta-tags (2.20.0) actionpack (>= 6.0.0, < 7.2) - method_source (1.1.0) + method_source (1.0.0) mini_magick (4.12.0) mini_mime (1.1.5) mini_portile2 (2.8.6) @@ -355,8 +360,7 @@ GEM money (~> 6.13) railties (>= 3.0) msgpack (1.7.2) - multi_xml (0.7.1) - bigdecimal (~> 3.1) + multi_xml (0.6.0) mutex_m (0.2.0) net-imap (0.4.10) date @@ -387,7 +391,7 @@ GEM prettier_print (1.2.1) psych (5.1.2) stringio - public_suffix (5.0.5) + public_suffix (5.0.4) puma (6.4.2) nio4r (~> 2.0) racc (1.7.3) @@ -457,15 +461,14 @@ GEM rainbow (>= 2.0, < 4.0) rexml (~> 3.1) regexp_parser (2.9.0) - reline (0.5.6) + reline (0.5.1) io-console (~> 0.5) responders (3.1.1) actionpack (>= 5.2) railties (>= 5.2) reverse_markdown (2.1.1) nokogiri - rexml (3.2.8) - strscan (>= 3.0.9) + rexml (3.2.6) ripper-tags (1.0.1) rspec-core (3.13.0) rspec-support (~> 3.13.0) @@ -576,7 +579,6 @@ GEM lint_roller (~> 1.1) rubocop-performance (~> 1.20.2) stringio (3.1.0) - strscan (3.1.0) syntax_tree (6.2.0) prettier_print (>= 1.2.0) terminal-table (3.0.2) @@ -587,7 +589,7 @@ GEM tilt (2.3.0) timeout (0.4.1) tty-which (0.5.0) - turbo-rails (2.0.5) + turbo-rails (2.0.1) actionpack (>= 6.0.0) activejob (>= 6.0.0) railties (>= 6.0.0) @@ -597,7 +599,7 @@ GEM concurrent-ruby (~> 1.0) unaccent (0.4.0) unicode-display_width (2.5.0) - view_component (3.12.1) + view_component (3.10.0) activesupport (>= 5.2.0, < 8.0) concurrent-ruby (~> 1.0) method_source (~> 1.0) @@ -656,6 +658,7 @@ DEPENDENCIES devise dotenv-rails erb-formatter + erb_lint factory_bot_rails faker friendly_id (~> 5.5.1) diff --git a/gemfiles/rails_6.1_ruby_3.1.4.gemfile b/gemfiles/rails_6.1_ruby_3.1.4.gemfile index 319693fd79..c16cc04987 100644 --- a/gemfiles/rails_6.1_ruby_3.1.4.gemfile +++ b/gemfiles/rails_6.1_ruby_3.1.4.gemfile @@ -44,6 +44,7 @@ gem "pluggy", path: "../pluggy" gem "money-rails", "~> 1.12" gem "avo-money_field" gem "avo-record_link_field" +gem "pagy", "> 8" gem "psych", "< 4" group :development do @@ -80,6 +81,7 @@ group :development, :test do gem "faker", require: false gem "i18n-tasks", "~> 1.0.12" gem "erb-formatter" + gem "erb_lint" gem "solargraph" gem "solargraph-rails" gem "factory_bot_rails" diff --git a/gemfiles/rails_6.1_ruby_3.1.4.gemfile.lock b/gemfiles/rails_6.1_ruby_3.1.4.gemfile.lock index ac0f378fdc..243ad0d446 100644 --- a/gemfiles/rails_6.1_ruby_3.1.4.gemfile.lock +++ b/gemfiles/rails_6.1_ruby_3.1.4.gemfile.lock @@ -220,6 +220,13 @@ GEM e2mmap (0.1.0) erb-formatter (0.7.1) syntax_tree (~> 6.0) + erb_lint (0.5.0) + activesupport + better_html (>= 2.0.1) + parser (>= 2.7.1.4) + rainbow + rubocop + smart_properties erubi (1.12.0) factory_bot (6.4.6) activesupport (>= 5.0.0) @@ -347,7 +354,7 @@ GEM nokogiri (1.16.5-x86_64-linux) racc (~> 1.4) orm_adapter (0.5.0) - pagy (7.0.6) + pagy (8.4.0) parallel (1.24.0) parser (3.3.0.5) ast (~> 2.4.1) @@ -616,6 +623,7 @@ DEPENDENCIES devise dotenv-rails erb-formatter + erb_lint factory_bot_rails faker friendly_id (~> 5.5.1) @@ -636,6 +644,7 @@ DEPENDENCIES meta-tags money-rails (~> 1.12) net-smtp + pagy (> 8) pg (>= 0.18, < 2.0) pluggy! prefixed_ids diff --git a/gemfiles/rails_6.1_ruby_3.2.2.gemfile b/gemfiles/rails_6.1_ruby_3.2.2.gemfile index 319693fd79..c16cc04987 100644 --- a/gemfiles/rails_6.1_ruby_3.2.2.gemfile +++ b/gemfiles/rails_6.1_ruby_3.2.2.gemfile @@ -44,6 +44,7 @@ gem "pluggy", path: "../pluggy" gem "money-rails", "~> 1.12" gem "avo-money_field" gem "avo-record_link_field" +gem "pagy", "> 8" gem "psych", "< 4" group :development do @@ -80,6 +81,7 @@ group :development, :test do gem "faker", require: false gem "i18n-tasks", "~> 1.0.12" gem "erb-formatter" + gem "erb_lint" gem "solargraph" gem "solargraph-rails" gem "factory_bot_rails" diff --git a/gemfiles/rails_6.1_ruby_3.2.2.gemfile.lock b/gemfiles/rails_6.1_ruby_3.2.2.gemfile.lock index 62db7a76e3..db8d91dccc 100644 --- a/gemfiles/rails_6.1_ruby_3.2.2.gemfile.lock +++ b/gemfiles/rails_6.1_ruby_3.2.2.gemfile.lock @@ -220,6 +220,13 @@ GEM e2mmap (0.1.0) erb-formatter (0.7.1) syntax_tree (~> 6.0) + erb_lint (0.5.0) + activesupport + better_html (>= 2.0.1) + parser (>= 2.7.1.4) + rainbow + rubocop + smart_properties erubi (1.12.0) factory_bot (6.4.6) activesupport (>= 5.0.0) @@ -347,7 +354,7 @@ GEM nokogiri (1.16.5-x86_64-linux) racc (~> 1.4) orm_adapter (0.5.0) - pagy (7.0.6) + pagy (8.4.0) parallel (1.24.0) parser (3.3.0.5) ast (~> 2.4.1) @@ -616,6 +623,7 @@ DEPENDENCIES devise dotenv-rails erb-formatter + erb_lint factory_bot_rails faker friendly_id (~> 5.5.1) @@ -636,6 +644,7 @@ DEPENDENCIES meta-tags money-rails (~> 1.12) net-smtp + pagy (> 8) pg (>= 0.18, < 2.0) pluggy! prefixed_ids diff --git a/gemfiles/rails_6.1_ruby_3.3.0.gemfile b/gemfiles/rails_6.1_ruby_3.3.0.gemfile index 319693fd79..c16cc04987 100644 --- a/gemfiles/rails_6.1_ruby_3.3.0.gemfile +++ b/gemfiles/rails_6.1_ruby_3.3.0.gemfile @@ -44,6 +44,7 @@ gem "pluggy", path: "../pluggy" gem "money-rails", "~> 1.12" gem "avo-money_field" gem "avo-record_link_field" +gem "pagy", "> 8" gem "psych", "< 4" group :development do @@ -80,6 +81,7 @@ group :development, :test do gem "faker", require: false gem "i18n-tasks", "~> 1.0.12" gem "erb-formatter" + gem "erb_lint" gem "solargraph" gem "solargraph-rails" gem "factory_bot_rails" diff --git a/gemfiles/rails_6.1_ruby_3.3.0.gemfile.lock b/gemfiles/rails_6.1_ruby_3.3.0.gemfile.lock index ac0f378fdc..243ad0d446 100644 --- a/gemfiles/rails_6.1_ruby_3.3.0.gemfile.lock +++ b/gemfiles/rails_6.1_ruby_3.3.0.gemfile.lock @@ -220,6 +220,13 @@ GEM e2mmap (0.1.0) erb-formatter (0.7.1) syntax_tree (~> 6.0) + erb_lint (0.5.0) + activesupport + better_html (>= 2.0.1) + parser (>= 2.7.1.4) + rainbow + rubocop + smart_properties erubi (1.12.0) factory_bot (6.4.6) activesupport (>= 5.0.0) @@ -347,7 +354,7 @@ GEM nokogiri (1.16.5-x86_64-linux) racc (~> 1.4) orm_adapter (0.5.0) - pagy (7.0.6) + pagy (8.4.0) parallel (1.24.0) parser (3.3.0.5) ast (~> 2.4.1) @@ -616,6 +623,7 @@ DEPENDENCIES devise dotenv-rails erb-formatter + erb_lint factory_bot_rails faker friendly_id (~> 5.5.1) @@ -636,6 +644,7 @@ DEPENDENCIES meta-tags money-rails (~> 1.12) net-smtp + pagy (> 8) pg (>= 0.18, < 2.0) pluggy! prefixed_ids diff --git a/gemfiles/rails_7.1_ruby_3.1.4.gemfile b/gemfiles/rails_7.1_ruby_3.1.4.gemfile index 02ceccf188..136b84cf5d 100644 --- a/gemfiles/rails_7.1_ruby_3.1.4.gemfile +++ b/gemfiles/rails_7.1_ruby_3.1.4.gemfile @@ -44,6 +44,7 @@ gem "pluggy", path: "../pluggy" gem "money-rails", "~> 1.12" gem "avo-money_field" gem "avo-record_link_field" +gem "pagy", "> 8" gem "psych", "< 4" group :development do @@ -80,6 +81,7 @@ group :development, :test do gem "faker", require: false gem "i18n-tasks", "~> 1.0.12" gem "erb-formatter" + gem "erb_lint" gem "solargraph" gem "solargraph-rails" gem "factory_bot_rails" diff --git a/gemfiles/rails_7.1_ruby_3.1.4.gemfile.lock b/gemfiles/rails_7.1_ruby_3.1.4.gemfile.lock index 00c4c04251..62be7b5d13 100644 --- a/gemfiles/rails_7.1_ruby_3.1.4.gemfile.lock +++ b/gemfiles/rails_7.1_ruby_3.1.4.gemfile.lock @@ -238,6 +238,13 @@ GEM e2mmap (0.1.0) erb-formatter (0.7.1) syntax_tree (~> 6.0) + erb_lint (0.5.0) + activesupport + better_html (>= 2.0.1) + parser (>= 2.7.1.4) + rainbow + rubocop + smart_properties erubi (1.12.0) factory_bot (6.4.6) activesupport (>= 5.0.0) @@ -370,7 +377,7 @@ GEM nokogiri (1.16.5-x86_64-linux) racc (~> 1.4) orm_adapter (0.5.0) - pagy (7.0.6) + pagy (8.4.0) parallel (1.24.0) parser (3.3.0.5) ast (~> 2.4.1) @@ -649,6 +656,7 @@ DEPENDENCIES devise dotenv-rails erb-formatter + erb_lint factory_bot_rails faker friendly_id (~> 5.5.1) @@ -669,6 +677,7 @@ DEPENDENCIES meta-tags money-rails (~> 1.12) net-smtp + pagy (> 8) pg (>= 0.18, < 2.0) pluggy! prefixed_ids diff --git a/gemfiles/rails_7.1_ruby_3.2.2.gemfile b/gemfiles/rails_7.1_ruby_3.2.2.gemfile index 02ceccf188..136b84cf5d 100644 --- a/gemfiles/rails_7.1_ruby_3.2.2.gemfile +++ b/gemfiles/rails_7.1_ruby_3.2.2.gemfile @@ -44,6 +44,7 @@ gem "pluggy", path: "../pluggy" gem "money-rails", "~> 1.12" gem "avo-money_field" gem "avo-record_link_field" +gem "pagy", "> 8" gem "psych", "< 4" group :development do @@ -80,6 +81,7 @@ group :development, :test do gem "faker", require: false gem "i18n-tasks", "~> 1.0.12" gem "erb-formatter" + gem "erb_lint" gem "solargraph" gem "solargraph-rails" gem "factory_bot_rails" diff --git a/gemfiles/rails_7.1_ruby_3.2.2.gemfile.lock b/gemfiles/rails_7.1_ruby_3.2.2.gemfile.lock index 899588e8b9..e2ca90689a 100644 --- a/gemfiles/rails_7.1_ruby_3.2.2.gemfile.lock +++ b/gemfiles/rails_7.1_ruby_3.2.2.gemfile.lock @@ -238,6 +238,13 @@ GEM e2mmap (0.1.0) erb-formatter (0.7.1) syntax_tree (~> 6.0) + erb_lint (0.5.0) + activesupport + better_html (>= 2.0.1) + parser (>= 2.7.1.4) + rainbow + rubocop + smart_properties erubi (1.12.0) factory_bot (6.4.6) activesupport (>= 5.0.0) @@ -370,7 +377,7 @@ GEM nokogiri (1.16.5-x86_64-linux) racc (~> 1.4) orm_adapter (0.5.0) - pagy (7.0.6) + pagy (8.4.0) parallel (1.24.0) parser (3.3.0.5) ast (~> 2.4.1) @@ -649,6 +656,7 @@ DEPENDENCIES devise dotenv-rails erb-formatter + erb_lint factory_bot_rails faker friendly_id (~> 5.5.1) @@ -669,6 +677,7 @@ DEPENDENCIES meta-tags money-rails (~> 1.12) net-smtp + pagy (> 8) pg (>= 0.18, < 2.0) pluggy! prefixed_ids diff --git a/gemfiles/rails_7.1_ruby_3.3.0.gemfile b/gemfiles/rails_7.1_ruby_3.3.0.gemfile index 02ceccf188..136b84cf5d 100644 --- a/gemfiles/rails_7.1_ruby_3.3.0.gemfile +++ b/gemfiles/rails_7.1_ruby_3.3.0.gemfile @@ -44,6 +44,7 @@ gem "pluggy", path: "../pluggy" gem "money-rails", "~> 1.12" gem "avo-money_field" gem "avo-record_link_field" +gem "pagy", "> 8" gem "psych", "< 4" group :development do @@ -80,6 +81,7 @@ group :development, :test do gem "faker", require: false gem "i18n-tasks", "~> 1.0.12" gem "erb-formatter" + gem "erb_lint" gem "solargraph" gem "solargraph-rails" gem "factory_bot_rails" diff --git a/gemfiles/rails_7.1_ruby_3.3.0.gemfile.lock b/gemfiles/rails_7.1_ruby_3.3.0.gemfile.lock index 00c4c04251..62be7b5d13 100644 --- a/gemfiles/rails_7.1_ruby_3.3.0.gemfile.lock +++ b/gemfiles/rails_7.1_ruby_3.3.0.gemfile.lock @@ -238,6 +238,13 @@ GEM e2mmap (0.1.0) erb-formatter (0.7.1) syntax_tree (~> 6.0) + erb_lint (0.5.0) + activesupport + better_html (>= 2.0.1) + parser (>= 2.7.1.4) + rainbow + rubocop + smart_properties erubi (1.12.0) factory_bot (6.4.6) activesupport (>= 5.0.0) @@ -370,7 +377,7 @@ GEM nokogiri (1.16.5-x86_64-linux) racc (~> 1.4) orm_adapter (0.5.0) - pagy (7.0.6) + pagy (8.4.0) parallel (1.24.0) parser (3.3.0.5) ast (~> 2.4.1) @@ -649,6 +656,7 @@ DEPENDENCIES devise dotenv-rails erb-formatter + erb_lint factory_bot_rails faker friendly_id (~> 5.5.1) @@ -669,6 +677,7 @@ DEPENDENCIES meta-tags money-rails (~> 1.12) net-smtp + pagy (> 8) pg (>= 0.18, < 2.0) pluggy! prefixed_ids diff --git a/spec/system/avo/filters/filters_spec.rb b/spec/system/avo/filters/filters_spec.rb index 8c750a7daa..aa1450500d 100644 --- a/spec/system/avo/filters/filters_spec.rb +++ b/spec/system/avo/filters/filters_spec.rb @@ -342,10 +342,13 @@ wait_for_loaded check "Featured" - expect(page).to have_css ".page.next" - expect(page).to have_css ".page.active" - expect(find(".page.active")).to have_text "1" - expect(find(".page.active")).not_to have_text "2" + expect(page).to have_css "[data-turbo-frame][aria-label='Next']" + # expect to have the previous link disabled (no turbo-frame attached) + expect(page).to have_css "[data-turbo-frame][aria-label='Previous']" + expect(page).not_to have_css "[data-turbo-frame][aria-label='Previous']" + + expect(find(".current")).to have_text "1" + expect(find(".current")).not_to have_text "2" end end end diff --git a/spec/system/avo/filters_panel_open_spec.rb b/spec/system/avo/filters_panel_open_spec.rb index a7f8a0a052..450c0e29cc 100644 --- a/spec/system/avo/filters_panel_open_spec.rb +++ b/spec/system/avo/filters_panel_open_spec.rb @@ -30,7 +30,7 @@ toggle_filters_menu # Change the page - within ".pagy-nav" do + within ".pagy.nav" do click_on "2" end diff --git a/spec/system/avo/select_all_spec.rb b/spec/system/avo/select_all_spec.rb index 5405a1ac04..2b852067ce 100644 --- a/spec/system/avo/select_all_spec.rb +++ b/spec/system/avo/select_all_spec.rb @@ -111,9 +111,9 @@ visit url - within('nav.pagy-nav.pagination') do - expect(page).to have_css('span.page.active', text: '1') - expect(page).to have_css('span.page', text: '2') + within("nav.pagy.nav") do + expect(page).to have_css(".current", text: "1") + expect(page).to have_css("a[data-turbo-frame]", text: "2") end check_select_all @@ -131,9 +131,9 @@ visit url - within('nav.pagy-nav.pagination') do - expect(page).not_to have_css('span.page.active', text: '1') - expect(page).not_to have_css('span.page', text: '2') + within("nav.pagy.nav") do + expect(page).not_to have_css(".current", text: "1") + expect(page).not_to have_css("a[data-turbo-frame]", text: "2") end check_select_all