diff --git a/.gitignore b/.gitignore index 9dc2298a..cd03318c 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,7 @@ coverage/ podman.sh template.dev.rb tailwind-maglev-pro.config.js +plugins # Vite Ruby /public/vite* @@ -38,4 +39,4 @@ node_modules bin/test spec/dummy/db/*.sqlite3 -spec/legacy_dummy/db/*.sqlite3 \ No newline at end of file +spec/legacy_dummy/db/*.sqlite3 diff --git a/.ruby-version b/.ruby-version index 0163af7e..8cf6caf5 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.3.5 \ No newline at end of file +3.4.1 \ No newline at end of file diff --git a/.yarn/install-state.gz b/.yarn/install-state.gz index fc7cfe94..01b6f805 100644 Binary files a/.yarn/install-state.gz and b/.yarn/install-state.gz differ diff --git a/Gemfile.lock b/Gemfile.lock index ce1817f8..dd6dea2f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -106,16 +106,16 @@ GEM factory_bot_rails (6.2.0) factory_bot (~> 6.2.0) railties (>= 5.0.0) - ffi (1.17.0-aarch64-linux-gnu) - ffi (1.17.0-aarch64-linux-musl) - ffi (1.17.0-arm-linux-gnu) - ffi (1.17.0-arm-linux-musl) - ffi (1.17.0-arm64-darwin) - ffi (1.17.0-x86-linux-gnu) - ffi (1.17.0-x86-linux-musl) - ffi (1.17.0-x86_64-darwin) - ffi (1.17.0-x86_64-linux-gnu) - ffi (1.17.0-x86_64-linux-musl) + ffi (1.17.1-aarch64-linux-gnu) + ffi (1.17.1-aarch64-linux-musl) + ffi (1.17.1-arm-linux-gnu) + ffi (1.17.1-arm-linux-musl) + ffi (1.17.1-arm64-darwin) + ffi (1.17.1-x86-linux-gnu) + ffi (1.17.1-x86-linux-musl) + ffi (1.17.1-x86_64-darwin) + ffi (1.17.1-x86_64-linux-gnu) + ffi (1.17.1-x86_64-linux-musl) generator_spec (0.10.0) activesupport (>= 3.0.0) railties (>= 3.0.0) @@ -160,6 +160,7 @@ GEM marcel (1.0.4) mini_magick (4.13.2) mini_mime (1.1.5) + mini_portile2 (2.8.8) minitest (5.25.2) mutex_m (0.3.0) net-imap (0.5.1) @@ -172,17 +173,24 @@ GEM net-smtp (0.5.0) net-protocol nio4r (2.7.4) - nokogiri (1.16.7-aarch64-linux) + nokogiri (1.18.6) + mini_portile2 (~> 2.8.2) racc (~> 1.4) - nokogiri (1.16.7-arm-linux) + nokogiri (1.18.6-aarch64-linux-gnu) racc (~> 1.4) - nokogiri (1.16.7-arm64-darwin) + nokogiri (1.18.6-aarch64-linux-musl) racc (~> 1.4) - nokogiri (1.16.7-x86-linux) + nokogiri (1.18.6-arm-linux-gnu) racc (~> 1.4) - nokogiri (1.16.7-x86_64-darwin) + nokogiri (1.18.6-arm-linux-musl) racc (~> 1.4) - nokogiri (1.16.7-x86_64-linux) + nokogiri (1.18.6-arm64-darwin) + racc (~> 1.4) + nokogiri (1.18.6-x86_64-darwin) + racc (~> 1.4) + nokogiri (1.18.6-x86_64-linux-gnu) + racc (~> 1.4) + nokogiri (1.18.6-x86_64-linux-musl) racc (~> 1.4) observer (0.1.2) ostruct (0.6.1) diff --git a/Gemfile.rails_7_0 b/Gemfile.rails_7_0 index dbb5d106..9a7352ed 100644 --- a/Gemfile.rails_7_0 +++ b/Gemfile.rails_7_0 @@ -8,7 +8,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" } # development dependencies will be added by default to the :development group. gemspec -gem 'rails', '7.0.8' +gem 'rails', '~> 7.0', '< 7.1' # Active Storage analyser gem 'mini_magick', '~> 4.11' @@ -45,6 +45,8 @@ gem 'bigdecimal' gem 'mutex_m' gem 'drb' gem 'fiddle' +gem 'benchmark' +gem 'concurrent-ruby', '1.3.4' group :development, :test do # Use SCSS for stylesheets @@ -59,6 +61,8 @@ group :development, :test do gem 'generator_spec' + gem 'annotate' + gem 'nokogiri', '>= 1.13.10' end diff --git a/Gemfile.rails_7_0.lock b/Gemfile.rails_7_0.lock index 9f2b1dca..66e0f197 100644 --- a/Gemfile.rails_7_0.lock +++ b/Gemfile.rails_7_0.lock @@ -12,110 +12,110 @@ PATH GEM remote: https://rubygems.org/ specs: - actioncable (7.0.8) - actionpack (= 7.0.8) - activesupport (= 7.0.8) + actioncable (7.0.8.7) + actionpack (= 7.0.8.7) + activesupport (= 7.0.8.7) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.8) - actionpack (= 7.0.8) - activejob (= 7.0.8) - activerecord (= 7.0.8) - activestorage (= 7.0.8) - activesupport (= 7.0.8) + actionmailbox (7.0.8.7) + actionpack (= 7.0.8.7) + activejob (= 7.0.8.7) + activerecord (= 7.0.8.7) + activestorage (= 7.0.8.7) + activesupport (= 7.0.8.7) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.0.8) - actionpack (= 7.0.8) - actionview (= 7.0.8) - activejob (= 7.0.8) - activesupport (= 7.0.8) + actionmailer (7.0.8.7) + actionpack (= 7.0.8.7) + actionview (= 7.0.8.7) + activejob (= 7.0.8.7) + activesupport (= 7.0.8.7) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.0) - actionpack (7.0.8) - actionview (= 7.0.8) - activesupport (= 7.0.8) + actionpack (7.0.8.7) + actionview (= 7.0.8.7) + activesupport (= 7.0.8.7) rack (~> 2.0, >= 2.2.4) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.8) - actionpack (= 7.0.8) - activerecord (= 7.0.8) - activestorage (= 7.0.8) - activesupport (= 7.0.8) + actiontext (7.0.8.7) + actionpack (= 7.0.8.7) + activerecord (= 7.0.8.7) + activestorage (= 7.0.8.7) + activesupport (= 7.0.8.7) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.8) - activesupport (= 7.0.8) + actionview (7.0.8.7) + activesupport (= 7.0.8.7) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (7.0.8) - activesupport (= 7.0.8) + activejob (7.0.8.7) + activesupport (= 7.0.8.7) globalid (>= 0.3.6) - activemodel (7.0.8) - activesupport (= 7.0.8) - activerecord (7.0.8) - activemodel (= 7.0.8) - activesupport (= 7.0.8) - activestorage (7.0.8) - actionpack (= 7.0.8) - activejob (= 7.0.8) - activerecord (= 7.0.8) - activesupport (= 7.0.8) + activemodel (7.0.8.7) + activesupport (= 7.0.8.7) + activerecord (7.0.8.7) + activemodel (= 7.0.8.7) + activesupport (= 7.0.8.7) + activestorage (7.0.8.7) + actionpack (= 7.0.8.7) + activejob (= 7.0.8.7) + activerecord (= 7.0.8.7) + activesupport (= 7.0.8.7) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (7.0.8) + activesupport (7.0.8.7) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) - ast (2.4.2) + annotate (3.2.0) + activerecord (>= 3.2, < 8.0) + rake (>= 10.4, < 14.0) + ast (2.4.3) base64 (0.2.0) bcrypt (3.1.20) + benchmark (0.4.0) bigdecimal (3.1.9) builder (3.3.0) concurrent-ruby (1.3.4) crass (1.0.6) - date (3.4.0) - diff-lcs (1.5.1) + date (3.4.1) + diff-lcs (1.6.1) docile (1.4.1) drb (2.2.1) dry-cli (1.2.0) - erubi (1.13.0) + erubi (1.13.1) factory_bot (6.2.1) activesupport (>= 5.0.0) factory_bot_rails (6.2.0) factory_bot (~> 6.2.0) railties (>= 5.0.0) - ffi (1.17.0-aarch64-linux-gnu) - ffi (1.17.0-arm-linux-gnu) - ffi (1.17.0-arm64-darwin) - ffi (1.17.0-x86-linux-gnu) - ffi (1.17.0-x86_64-darwin) - ffi (1.17.0-x86_64-linux-gnu) - fiddle (1.1.6) + ffi (1.17.2) + ffi (1.17.2-arm64-darwin) + fiddle (1.1.7) generator_spec (0.10.0) activesupport (>= 3.0.0) railties (>= 3.0.0) globalid (1.2.1) activesupport (>= 6.1) - i18n (1.14.6) + i18n (1.14.7) concurrent-ruby (~> 1.0) image_processing (1.12.2) mini_magick (>= 4.9.5, < 5) ruby-vips (>= 2.0.17, < 3) - jbuilder (2.12.0) + jbuilder (2.13.0) actionview (>= 5.0.0) activesupport (>= 5.0.0) - json (2.8.1) + json (2.11.2) kaminari (1.2.2) activesupport (>= 4.1.0) kaminari-actionview (= 1.2.2) @@ -128,9 +128,10 @@ GEM activerecord kaminari-core (= 1.2.2) kaminari-core (1.2.2) - language_server-protocol (3.17.0.3) - logger (1.6.1) - loofah (2.23.1) + language_server-protocol (3.17.0.4) + lint_roller (1.1.0) + logger (1.7.0) + loofah (2.24.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) maglev-injectable (2.1.1) @@ -143,77 +144,72 @@ GEM method_source (1.1.0) mini_magick (4.13.2) mini_mime (1.1.5) - minitest (5.25.1) + mini_portile2 (2.8.8) + minitest (5.25.5) mutex_m (0.3.0) - net-imap (0.5.1) + net-imap (0.5.7) 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.4) - nokogiri (1.16.7-aarch64-linux) + nokogiri (1.18.8) + mini_portile2 (~> 2.8.2) racc (~> 1.4) - nokogiri (1.16.7-arm-linux) - racc (~> 1.4) - nokogiri (1.16.7-arm64-darwin) - racc (~> 1.4) - nokogiri (1.16.7-x86-linux) - racc (~> 1.4) - nokogiri (1.16.7-x86_64-darwin) - racc (~> 1.4) - nokogiri (1.16.7-x86_64-linux) + nokogiri (1.18.8-arm64-darwin) racc (~> 1.4) observer (0.1.2) ostruct (0.6.1) - parallel (1.26.3) - parser (3.3.6.0) + parallel (1.27.0) + parser (3.3.8.0) ast (~> 2.4.1) racc pg (1.5.9) - puma (6.5.0) + prism (1.4.0) + puma (6.6.0) nio4r (~> 2.0) racc (1.8.1) - rack (2.2.10) + rack (2.2.13) rack-proxy (0.7.7) rack - rack-test (2.1.0) + rack-test (2.2.0) rack (>= 1.3) - rails (7.0.8) - actioncable (= 7.0.8) - actionmailbox (= 7.0.8) - actionmailer (= 7.0.8) - actionpack (= 7.0.8) - actiontext (= 7.0.8) - actionview (= 7.0.8) - activejob (= 7.0.8) - activemodel (= 7.0.8) - activerecord (= 7.0.8) - activestorage (= 7.0.8) - activesupport (= 7.0.8) + rails (7.0.8.7) + actioncable (= 7.0.8.7) + actionmailbox (= 7.0.8.7) + actionmailer (= 7.0.8.7) + actionpack (= 7.0.8.7) + actiontext (= 7.0.8.7) + actionview (= 7.0.8.7) + activejob (= 7.0.8.7) + activemodel (= 7.0.8.7) + activerecord (= 7.0.8.7) + activestorage (= 7.0.8.7) + activesupport (= 7.0.8.7) bundler (>= 1.15.0) - railties (= 7.0.8) + railties (= 7.0.8.7) 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.0.8) - actionpack (= 7.0.8) - activesupport (= 7.0.8) + 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.0.8.7) + actionpack (= 7.0.8.7) + activesupport (= 7.0.8.7) method_source rake (>= 12.2) thor (~> 1.0) zeitwerk (~> 2.5) rainbow (3.1.1) rake (13.2.1) - regexp_parser (2.9.2) - rspec-core (3.13.2) + regexp_parser (2.10.0) + rspec-core (3.13.3) rspec-support (~> 3.13.0) rspec-expectations (3.13.3) diff-lcs (>= 1.2.0, < 2.0) @@ -221,7 +217,7 @@ GEM rspec-mocks (3.13.2) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-rails (7.1.0) + rspec-rails (7.1.1) actionpack (>= 7.0) activesupport (>= 7.0) railties (>= 7.0) @@ -229,46 +225,54 @@ GEM rspec-expectations (~> 3.13) rspec-mocks (~> 3.13) rspec-support (~> 3.13) - rspec-support (3.13.1) - rubocop (1.68.0) + rspec-support (3.13.2) + rubocop (1.75.3) json (~> 2.3) - language_server-protocol (>= 3.17.0) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.1.0) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 2.4, < 3.0) - rubocop-ast (>= 1.32.2, < 2.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.44.0, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.35.0) - parser (>= 3.3.1.0) - rubocop-md (1.2.4) - rubocop (>= 1.45) - rubocop-minitest (0.36.0) - rubocop (>= 1.61, < 2.0) - rubocop-ast (>= 1.31.1, < 2.0) - rubocop-packaging (0.5.2) - rubocop (>= 1.33, < 2.0) - rubocop-performance (1.22.1) - rubocop (>= 1.48.1, < 2.0) - rubocop-ast (>= 1.31.1, < 2.0) - rubocop-rails (2.27.0) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.44.1) + parser (>= 3.3.7.2) + prism (~> 1.4) + rubocop-md (2.0.1) + lint_roller (~> 1.1) + rubocop (>= 1.72.1) + rubocop-minitest (0.38.0) + lint_roller (~> 1.1) + rubocop (>= 1.75.0, < 2.0) + rubocop-ast (>= 1.38.0, < 2.0) + rubocop-packaging (0.6.0) + lint_roller (~> 1.1.0) + rubocop (>= 1.72.1, < 2.0) + rubocop-performance (1.25.0) + lint_roller (~> 1.1) + rubocop (>= 1.75.0, < 2.0) + rubocop-ast (>= 1.38.0, < 2.0) + rubocop-rails (2.31.0) activesupport (>= 4.2.0) + lint_roller (~> 1.1) rack (>= 1.1) - rubocop (>= 1.52.0, < 2.0) - rubocop-ast (>= 1.31.1, < 2.0) - rubocop-rails_config (1.16.0) - rubocop (>= 1.57.0) - rubocop-ast (>= 1.26.0) + rubocop (>= 1.75.0, < 2.0) + rubocop-ast (>= 1.38.0, < 2.0) + rubocop-rails_config (1.17.1) + rubocop (>= 1.72.2) + rubocop-ast (>= 1.38.0) rubocop-md - rubocop-minitest (~> 0.22) - rubocop-packaging (~> 0.5) - rubocop-performance (~> 1.11) - rubocop-rails (~> 2.0) - rubocop-rspec (3.2.0) - rubocop (~> 1.61) + rubocop-minitest (~> 0.37) + rubocop-packaging (~> 0.6) + rubocop-performance (~> 1.24) + rubocop-rails (~> 2.30) + rubocop-rspec (3.6.0) + lint_roller (~> 1.1) + rubocop (~> 1.72, >= 1.72.1) ruby-progressbar (1.13.0) - ruby-vips (2.2.2) + ruby-vips (2.2.3) ffi (~> 1.12) logger simplecov (0.22.0) @@ -277,49 +281,49 @@ GEM simplecov_json_formatter (~> 0.1) simplecov-html (0.13.1) simplecov_json_formatter (0.1.4) - sprockets (4.2.1) + sprockets (4.2.2) concurrent-ruby (~> 1.0) + logger rack (>= 2.2.4, < 4) sprockets-rails (3.5.2) actionpack (>= 6.1) activesupport (>= 6.1) sprockets (>= 3.0.0) - sqlite3 (1.7.3-aarch64-linux) - sqlite3 (1.7.3-arm-linux) - sqlite3 (1.7.3-arm64-darwin) - sqlite3 (1.7.3-x86-linux) - sqlite3 (1.7.3-x86_64-darwin) - sqlite3 (1.7.3-x86_64-linux) + sqlite3 (1.7.3) + mini_portile2 (~> 2.8.0) thor (1.3.2) - timeout (0.4.2) + timeout (0.4.3) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (2.6.0) + unicode-display_width (3.1.4) + unicode-emoji (~> 4.0, >= 4.0.4) + unicode-emoji (4.0.4) vite_rails (3.0.19) railties (>= 5.1, < 9) vite_ruby (~> 3.0, >= 3.2.2) - vite_ruby (3.9.0) + vite_ruby (3.9.2) dry-cli (>= 0.7, < 2) logger (~> 1.6) + mutex_m rack-proxy (~> 0.6, >= 0.6.1) zeitwerk (~> 2.2) - websocket-driver (0.7.6) + websocket-driver (0.7.7) + base64 websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - zeitwerk (2.7.1) + zeitwerk (2.7.2) PLATFORMS - aarch64-linux - arm-linux - arm64-darwin - x86-linux - x86_64-darwin - x86_64-linux + arm64-darwin-24 + ruby DEPENDENCIES + annotate base64 bcrypt + benchmark bigdecimal + concurrent-ruby (= 1.3.4) drb factory_bot_rails (~> 6.2.0) fiddle @@ -333,7 +337,7 @@ DEPENDENCIES ostruct pg (~> 1.5.9) puma - rails (= 7.0.8) + rails (~> 7.0, < 7.1) rspec-rails rubocop rubocop-rails_config @@ -343,4 +347,4 @@ DEPENDENCIES sqlite3 (~> 1.4) BUNDLED WITH - 2.5.4 + 2.6.2 diff --git a/Gemfile.rails_7_2 b/Gemfile.rails_7_2 index 6039f4f8..5109cbba 100644 --- a/Gemfile.rails_7_2 +++ b/Gemfile.rails_7_2 @@ -33,6 +33,10 @@ gem 'puma' # Git. Remember to move these dependencies to your gemspec before releasing # your gem to rubygems.org. +# Gems not part of the standard library anymore +gem 'observer' +gem 'ostruct' + # To use a debugger # gem 'byebug', group: [:development, :test] @@ -40,10 +44,6 @@ gem 'puma' gem 'pg', '~> 1.5.9' gem 'sqlite3' -# Gems no longer be part of the default gems from Ruby 3.5.0 -gem 'observer' -gem 'ostruct' - group :development, :test do # Use SCSS for stylesheets gem 'bcrypt' diff --git a/Gemfile.rails_7_2.lock b/Gemfile.rails_7_2.lock index c37a1236..1aed1162 100644 --- a/Gemfile.rails_7_2.lock +++ b/Gemfile.rails_7_2.lock @@ -106,16 +106,16 @@ GEM factory_bot_rails (6.2.0) factory_bot (~> 6.2.0) railties (>= 5.0.0) - ffi (1.17.0-aarch64-linux-gnu) - ffi (1.17.0-aarch64-linux-musl) - ffi (1.17.0-arm-linux-gnu) - ffi (1.17.0-arm-linux-musl) - ffi (1.17.0-arm64-darwin) - ffi (1.17.0-x86-linux-gnu) - ffi (1.17.0-x86-linux-musl) - ffi (1.17.0-x86_64-darwin) - ffi (1.17.0-x86_64-linux-gnu) - ffi (1.17.0-x86_64-linux-musl) + ffi (1.17.1-aarch64-linux-gnu) + ffi (1.17.1-aarch64-linux-musl) + ffi (1.17.1-arm-linux-gnu) + ffi (1.17.1-arm-linux-musl) + ffi (1.17.1-arm64-darwin) + ffi (1.17.1-x86-linux-gnu) + ffi (1.17.1-x86-linux-musl) + ffi (1.17.1-x86_64-darwin) + ffi (1.17.1-x86_64-linux-gnu) + ffi (1.17.1-x86_64-linux-musl) generator_spec (0.10.0) activesupport (>= 3.0.0) railties (>= 3.0.0) @@ -160,6 +160,7 @@ GEM marcel (1.0.4) mini_magick (4.13.2) mini_mime (1.1.5) + mini_portile2 (2.8.8) minitest (5.25.2) mutex_m (0.3.0) net-imap (0.5.1) @@ -172,17 +173,24 @@ GEM net-smtp (0.5.0) net-protocol nio4r (2.7.4) - nokogiri (1.16.7-aarch64-linux) + nokogiri (1.18.7) + mini_portile2 (~> 2.8.2) racc (~> 1.4) - nokogiri (1.16.7-arm-linux) + nokogiri (1.18.7-aarch64-linux-gnu) racc (~> 1.4) - nokogiri (1.16.7-arm64-darwin) + nokogiri (1.18.7-aarch64-linux-musl) racc (~> 1.4) - nokogiri (1.16.7-x86-linux) + nokogiri (1.18.7-arm-linux-gnu) racc (~> 1.4) - nokogiri (1.16.7-x86_64-darwin) + nokogiri (1.18.7-arm-linux-musl) racc (~> 1.4) - nokogiri (1.16.7-x86_64-linux) + nokogiri (1.18.7-arm64-darwin) + racc (~> 1.4) + nokogiri (1.18.7-x86_64-darwin) + racc (~> 1.4) + nokogiri (1.18.7-x86_64-linux-gnu) + racc (~> 1.4) + nokogiri (1.18.7-x86_64-linux-musl) racc (~> 1.4) observer (0.1.2) ostruct (0.6.1) diff --git a/app/controllers/concerns/maglev/fetchers_concern.rb b/app/controllers/concerns/maglev/fetchers_concern.rb index 5a866be5..efb21518 100644 --- a/app/controllers/concerns/maglev/fetchers_concern.rb +++ b/app/controllers/concerns/maglev/fetchers_concern.rb @@ -35,11 +35,12 @@ def fetch_maglev_page ) end - def fetch_maglev_page_sections(page_sections = nil) + def fetch_maglev_page_sections(sections_content = nil) @fetch_maglev_page_sections ||= maglev_services.get_page_sections.call( page: fetch_maglev_page, - page_sections: page_sections, - locale: content_locale + sections_content: sections_content, + locale: content_locale, + include_deleted: maglev_include_deleted_sections? ) end @@ -92,6 +93,10 @@ def maglev_page_sections fetch_maglev_page_sections end + def maglev_site_scoped_sections + maglev_services.get_site_scoped_sections.call + end + def maglev_sections_path fetch_maglev_sections_path end @@ -120,5 +125,9 @@ def maglev_style theme: maglev_theme ) end + + def maglev_include_deleted_sections? + false + end end end diff --git a/app/controllers/concerns/maglev/standalone_sections_concern.rb b/app/controllers/concerns/maglev/in_app_rendering_concern.rb similarity index 63% rename from app/controllers/concerns/maglev/standalone_sections_concern.rb rename to app/controllers/concerns/maglev/in_app_rendering_concern.rb index d38a0cc3..786e19ea 100644 --- a/app/controllers/concerns/maglev/standalone_sections_concern.rb +++ b/app/controllers/concerns/maglev/in_app_rendering_concern.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module Maglev - module StandaloneSectionsConcern + module InAppRenderingConcern extend ActiveSupport::Concern included do @@ -20,21 +20,28 @@ def maglev_rendering_mode private - def fetch_maglev_site_scoped_sections + def fetch_maglev_sections_content(layout_id: nil) return if within_maglev_engine? fetch_maglev_site fetch_maglev_theme - fetch_maglev_dummy_page + fetch_maglev_dummy_page(layout_id) fetch_maglev_page_sections end - def fetch_maglev_dummy_page - @fetch_maglev_page = ::Maglev::Page.new(title: 'DummyPage', sections: fetch_maglev_site.sections) + def fetch_maglev_dummy_page(layout_id = nil) + @fetch_maglev_page = ::Maglev::Page.new( + title: 'DummyPage', + layout_id: layout_id || maglev_layout_id + ) end def within_maglev_engine? controller_path.starts_with?('maglev/') end + + def maglev_layout_id + nil + end end end diff --git a/app/controllers/maglev/admin/sections/previews_controller.rb b/app/controllers/maglev/admin/sections/previews_controller.rb index f403c7e7..265337dc 100644 --- a/app/controllers/maglev/admin/sections/previews_controller.rb +++ b/app/controllers/maglev/admin/sections/previews_controller.rb @@ -23,10 +23,14 @@ def fetch_maglev_page Maglev::Page.new( title: 'Preview section', path: 'preview', - sections: [fetch_section!.build_default_content] + layout_id: 'preview' ) end + def fetch_maglev_page_sections + [fetch_section!.build_default_content.with_indifferent_access] + end + def fetch_section! fetch_section || (raise ::Maglev::Errors::UnknownSection, "Unknown section #{params[:id]}") end diff --git a/app/controllers/maglev/api/pages_controller.rb b/app/controllers/maglev/api/pages_controller.rb index fe0b0ac3..691c3c06 100644 --- a/app/controllers/maglev/api/pages_controller.rb +++ b/app/controllers/maglev/api/pages_controller.rb @@ -15,46 +15,28 @@ def show end def create - page = persist!(resources.new) + page = resources.create!(page_params) head :created, location: api_page_path(page) end - def destroy - resources.destroy(params[:id]) - head :no_content - end - def update page = resources.find(params[:id]) - persist!(page) + page.update!(page_params) head :ok, page_lock_version: page.lock_version end + def destroy + resources.destroy(params[:id]) + head :no_content + end + private def page_params - params.require(:page).permit(:title, :path, + params.require(:page).permit(:title, :path, :layout_id, :seo_title, :meta_description, :og_title, :og_description, :og_image_url, - :visible, :lock_version).tap do |whitelisted| - whitelisted[:sections] = params[:page].to_unsafe_hash[:sections] unless params.dig(:page, :sections).nil? - end - end - - def site_params - lock_version = params.dig(:site, :lock_version) - sections = params[:site].to_unsafe_hash[:sections] unless params.dig(:site, :sections).nil? - style = params.dig(:site, :style) - (lock_version && sections ? { lock_version: lock_version, sections: sections } : {}).merge(style: style) - end - - def persist!(page) - services.persist_page.call( - page: page, - page_attributes: page_params, - site: maglev_site, - site_attributes: site_params - ) + :visible, :lock_version) end def resources diff --git a/app/controllers/maglev/api/sections_content_controller.rb b/app/controllers/maglev/api/sections_content_controller.rb new file mode 100644 index 00000000..60d27ba5 --- /dev/null +++ b/app/controllers/maglev/api/sections_content_controller.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +module Maglev + module Api + class SectionsContentController < ::Maglev::ApiController + before_action :set_page + + def show + @sections_content = maglev_services.get_page_sections.call( + page: @page, + locale: content_locale, + include_deleted: true + ) + end + + def update + @stores = services.persist_sections_content.call( + site: maglev_site, + page: @page, + sections_content: sections_content_params + ) + end + + private + + def set_page + @page = resources.find(params[:page_id]) + end + + def sections_content_params + params.to_unsafe_hash[:sections_content] + end + + def resources + ::Maglev::Page + end + end + end +end diff --git a/app/controllers/maglev/api/sites_controller.rb b/app/controllers/maglev/api/sites_controller.rb index 66086490..879c4b2c 100644 --- a/app/controllers/maglev/api/sites_controller.rb +++ b/app/controllers/maglev/api/sites_controller.rb @@ -6,6 +6,7 @@ class SitesController < ::Maglev::ApiController def show if (@site = maglev_site).present? @home_page_id = maglev_page_collection.home.pick(:id) + @number_of_pages = maglev_page_collection.count else head :not_found end diff --git a/app/controllers/maglev/api/styles_controller.rb b/app/controllers/maglev/api/styles_controller.rb new file mode 100644 index 00000000..01c87ee9 --- /dev/null +++ b/app/controllers/maglev/api/styles_controller.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Maglev + module Api + class StylesController < ::Maglev::ApiController + def update + @site = maglev_site + @site.update(style: style_params) + head :ok + end + + private + + def style_params + params.to_unsafe_hash[:style] + end + end + end +end diff --git a/app/controllers/maglev/api_controller.rb b/app/controllers/maglev/api_controller.rb index fa32e137..d1d0ea03 100644 --- a/app/controllers/maglev/api_controller.rb +++ b/app/controllers/maglev/api_controller.rb @@ -38,6 +38,10 @@ def maglev_theme @maglev_theme ||= maglev_services.fetch_theme.call end + def maglev_rendering_mode + params[:rendering_mode] || :editor + end + def record_errors(exception) render(json: { errors: exception.record.errors }, status: :bad_request) end diff --git a/app/controllers/maglev/editor_controller.rb b/app/controllers/maglev/editor_controller.rb index 7ac37259..0a04116c 100644 --- a/app/controllers/maglev/editor_controller.rb +++ b/app/controllers/maglev/editor_controller.rb @@ -12,7 +12,7 @@ class EditorController < ApplicationController before_action :ensure_path_and_content_locale, only: :show before_action :set_content_locale, only: :show - helper_method :maglev_home_page_id + helper_method :maglev_home_page_id, :maglev_pages_count, :maglev_site_scoped_sections def show fetch_maglev_page_content @@ -37,6 +37,10 @@ def maglev_home_page_id maglev_pages_collection.home(default_content_locale).pick(:id) end + def maglev_pages_count + @maglev_pages_count ||= maglev_pages_collection.count + end + def maglev_pages_collection ::Maglev::Page end @@ -49,6 +53,10 @@ def maglev_rendering_mode :editor end + def maglev_include_deleted_sections? + true + end + def default_maglev_editor_path editor_path( params[:path] || 'index', diff --git a/app/controllers/maglev/page_preview_controller.rb b/app/controllers/maglev/page_preview_controller.rb index 52ed7bec..b53c5a21 100644 --- a/app/controllers/maglev/page_preview_controller.rb +++ b/app/controllers/maglev/page_preview_controller.rb @@ -32,7 +32,7 @@ def fetch_maglev_site def fetch_maglev_page_sections return super if action_name == 'index' - super(JSON.parse(params[:page_sections])) + super(JSON.parse(params[:sections_content])) end def maglev_rendering_mode diff --git a/app/frontend/editor/assets/remixicons/ri-links-line.svg b/app/frontend/editor/assets/remixicons/ri-links-line.svg new file mode 100644 index 00000000..b4fd9602 --- /dev/null +++ b/app/frontend/editor/assets/remixicons/ri-links-line.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/app/frontend/editor/components/header-nav/save-button.vue b/app/frontend/editor/components/header-nav/save-button.vue index 675996ae..3f9e3699 100644 --- a/app/frontend/editor/components/header-nav/save-button.vue +++ b/app/frontend/editor/components/header-nav/save-button.vue @@ -26,7 +26,7 @@ export default { }, methods: { async save() { - await this.$store.dispatch('persistPage') + await this.$store.dispatch('persistSectionsContent') }, }, } diff --git a/app/frontend/editor/components/kit/accordion.vue b/app/frontend/editor/components/kit/accordion.vue index a842cc71..7fa5bfb0 100644 --- a/app/frontend/editor/components/kit/accordion.vue +++ b/app/frontend/editor/components/kit/accordion.vue @@ -8,16 +8,9 @@ HINT @@ -64,5 +57,10 @@ export default { el.style.height = '0' }, }, + computed: { + iconName() { + return this.show ? 'arrow-up-s-line' : 'arrow-down-s-line' + }, + } } diff --git a/app/frontend/editor/components/kit/icon.vue b/app/frontend/editor/components/kit/icon.vue index 2acbf25f..353e467f 100644 --- a/app/frontend/editor/components/kit/icon.vue +++ b/app/frontend/editor/components/kit/icon.vue @@ -29,8 +29,8 @@ export default { computed: { icon() { const path = `../../assets/${this.library}/${this.name}.svg` - return defineAsyncComponent(() => this.icons[path]()) + return defineAsyncComponent(() => this.icons[path]()) }, - }, + } } diff --git a/app/frontend/editor/components/kit/select-input.vue b/app/frontend/editor/components/kit/select-input.vue index 6832fb8f..049e984a 100644 --- a/app/frontend/editor/components/kit/select-input.vue +++ b/app/frontend/editor/components/kit/select-input.vue @@ -65,7 +65,7 @@ {{ emptyLabel }} -
+
{{ item.name }} + + {{ item.layoutGroupLabel }} +
@@ -76,7 +82,7 @@ export default { }, hasPageSections() { return !this.isBlank(this.page?.sectionNames) - }, + } }, methods: { async fetchPageSectionNames() { diff --git a/app/frontend/editor/components/page/edit.vue b/app/frontend/editor/components/page/edit.vue index a80b419b..8e422cbc 100644 --- a/app/frontend/editor/components/page/edit.vue +++ b/app/frontend/editor/components/page/edit.vue @@ -58,6 +58,9 @@ export default { }, ] }, + hasLayoutIdChanged() { + return this.editedPage.layoutId !== this.page.layoutId + } }, methods: { updatePage() { @@ -74,6 +77,9 @@ export default { ...attributes, lockVersion: headers['page-lock-version'], }) + + if (this.hasLayoutIdChanged) + this.$store.dispatch('reloadPage', { id: pageId }) }) .catch(({ response: { status, data } }) => { console.log('[Maglev] could not update the page', status) diff --git a/app/frontend/editor/components/page/form/main.vue b/app/frontend/editor/components/page/form/main.vue index ec62b71b..c71bb1d0 100644 --- a/app/frontend/editor/components/page/form/main.vue +++ b/app/frontend/editor/components/page/form/main.vue @@ -15,6 +15,15 @@ v-if="!isPageIndex || !page.id" /> + + 1 + } }, } diff --git a/app/frontend/editor/components/page/list/index.vue b/app/frontend/editor/components/page/list/index.vue index 2b3ce867..58333878 100644 --- a/app/frontend/editor/components/page/list/index.vue +++ b/app/frontend/editor/components/page/list/index.vue @@ -27,6 +27,7 @@ diff --git a/app/frontend/editor/components/section-list/index.vue b/app/frontend/editor/components/section-list/index.vue deleted file mode 100644 index 5d37e601..00000000 --- a/app/frontend/editor/components/section-list/index.vue +++ /dev/null @@ -1,64 +0,0 @@ - - - - - diff --git a/app/frontend/editor/components/section-mirror-setup/actions.vue b/app/frontend/editor/components/section-mirror-setup/actions.vue new file mode 100644 index 00000000..bee44666 --- /dev/null +++ b/app/frontend/editor/components/section-mirror-setup/actions.vue @@ -0,0 +1,25 @@ + + + \ No newline at end of file diff --git a/app/frontend/editor/components/section-mirror-setup/index.vue b/app/frontend/editor/components/section-mirror-setup/index.vue new file mode 100644 index 00000000..d5b4f474 --- /dev/null +++ b/app/frontend/editor/components/section-mirror-setup/index.vue @@ -0,0 +1,66 @@ + + + + diff --git a/app/frontend/editor/components/section-mirror-setup/selector.vue b/app/frontend/editor/components/section-mirror-setup/selector.vue new file mode 100644 index 00000000..4379e918 --- /dev/null +++ b/app/frontend/editor/components/section-mirror-setup/selector.vue @@ -0,0 +1,84 @@ + + + \ No newline at end of file diff --git a/app/frontend/editor/components/section-pane/index.vue b/app/frontend/editor/components/section-pane/index.vue index bb026af5..270dec71 100644 --- a/app/frontend/editor/components/section-pane/index.vue +++ b/app/frontend/editor/components/section-pane/index.vue @@ -11,6 +11,7 @@ diff --git a/app/frontend/editor/components/section-pane/mirror-input.vue b/app/frontend/editor/components/section-pane/mirror-input.vue new file mode 100644 index 00000000..c5e03378 --- /dev/null +++ b/app/frontend/editor/components/section-pane/mirror-input.vue @@ -0,0 +1,49 @@ + + + diff --git a/app/frontend/editor/components/section-pane/setting-list.vue b/app/frontend/editor/components/section-pane/setting-list.vue index 3a4827de..9ec9aa68 100644 --- a/app/frontend/editor/components/section-pane/setting-list.vue +++ b/app/frontend/editor/components/section-pane/setting-list.vue @@ -1,27 +1,32 @@ diff --git a/app/frontend/editor/components/sections-content/index.vue b/app/frontend/editor/components/sections-content/index.vue new file mode 100644 index 00000000..bc6a34b2 --- /dev/null +++ b/app/frontend/editor/components/sections-content/index.vue @@ -0,0 +1,24 @@ + + + \ No newline at end of file diff --git a/app/frontend/editor/components/section-list/list-item.vue b/app/frontend/editor/components/sections-content/list-item.vue similarity index 52% rename from app/frontend/editor/components/section-list/list-item.vue rename to app/frontend/editor/components/sections-content/list-item.vue index 81475773..0d1024d3 100644 --- a/app/frontend/editor/components/section-list/list-item.vue +++ b/app/frontend/editor/components/sections-content/list-item.vue @@ -1,13 +1,22 @@ + + + + diff --git a/app/frontend/editor/components/sidebar-nav.vue b/app/frontend/editor/components/sidebar-nav.vue index 568e8914..9d36d785 100644 --- a/app/frontend/editor/components/sidebar-nav.vue +++ b/app/frontend/editor/components/sidebar-nav.vue @@ -7,19 +7,6 @@
    -
  1. - - - -
+
+ + {{ $t('style.edit.submitButton') }} + +
@@ -20,7 +32,7 @@ export default { name: 'StylePane', components: { DynamicForm }, data() { - return { style: [] } + return { style: [], submitState: 'default' } }, mounted() { this.style = this.currentStyle @@ -34,7 +46,7 @@ export default { }, }, methods: { - ...mapActions(['previewStyle']), + ...mapActions(['previewStyle', 'updateSite']), onChange(change) { this.style = this.style.map((value) => { const newValue = { ...value } @@ -43,6 +55,13 @@ export default { }) this.previewStyle(this.style) }, + updatePage() { + this.submitState = 'inProgress' + this.services.site + .updateStyle(this.style) + .then(() => this.submitState = 'success') + .catch(() => this.submitState = 'fail') + } }, } diff --git a/app/frontend/editor/components/theme-section-list/index.vue b/app/frontend/editor/components/theme-section-list/index.vue index affbb509..3c0b8260 100644 --- a/app/frontend/editor/components/theme-section-list/index.vue +++ b/app/frontend/editor/components/theme-section-list/index.vue @@ -1,12 +1,12 @@ diff --git a/app/frontend/editor/components/theme-section-list/list-item.vue b/app/frontend/editor/components/theme-section-list/list-item.vue index f38c1ec3..fba712be 100644 --- a/app/frontend/editor/components/theme-section-list/list-item.vue +++ b/app/frontend/editor/components/theme-section-list/list-item.vue @@ -1,10 +1,6 @@ diff --git a/app/frontend/editor/views/sections/list-pane.vue b/app/frontend/editor/views/sections/list-pane.vue index b4db7b39..f8af9f6e 100644 --- a/app/frontend/editor/views/sections/list-pane.vue +++ b/app/frontend/editor/views/sections/list-pane.vue @@ -1,6 +1,6 @@