From e7c86da71cffd980af985452cd1355d14b960e59 Mon Sep 17 00:00:00 2001 From: Paul Bob Date: Fri, 27 Sep 2024 14:02:23 +0300 Subject: [PATCH 1/8] refactor: join attach and actions modal --- app/components/avo/actions_component.rb | 2 +- .../avo/fields/has_one_field/show_component.html.erb | 2 +- app/components/avo/resource_component.rb | 4 ++-- app/controllers/avo/actions_controller.rb | 3 +-- app/controllers/avo/base_controller.rb | 2 +- app/helpers/avo/turbo_stream_actions_helper.rb | 6 +++--- app/javascript/js/controllers/actions_picker_controller.js | 2 +- app/views/avo/actions/show.html.erb | 2 +- app/views/avo/associations/new.html.erb | 2 +- app/views/avo/partials/_attach_modal.html.erb | 1 - app/views/avo/partials/_javascript.html.erb | 1 + app/views/layouts/avo/application.html.erb | 3 +-- lib/avo.rb | 2 +- lib/avo/base_action.rb | 6 +----- spec/system/avo/actions_spec.rb | 4 ++-- 15 files changed, 18 insertions(+), 24 deletions(-) delete mode 100644 app/views/avo/partials/_attach_modal.html.erb diff --git a/app/components/avo/actions_component.rb b/app/components/avo/actions_component.rb index e5e5df698d..c2da208043 100644 --- a/app/components/avo/actions_component.rb +++ b/app/components/avo/actions_component.rb @@ -111,7 +111,7 @@ def render_action_link(action, icon: nil) def action_data_attributes(action) { action_name: action.action_name, - "turbo-frame": Avo::ACTIONS_TURBO_FRAME_ID, + "turbo-frame": Avo::MODAL_FRAME_ID, action: "click->actions-picker#visitAction", "actions-picker-target": action.standalone ? "standaloneAction" : "resourceAction", disabled: is_disabled?(action), diff --git a/app/components/avo/fields/has_one_field/show_component.html.erb b/app/components/avo/fields/has_one_field/show_component.html.erb index a6b936a852..df1605cdf9 100644 --- a/app/components/avo/fields/has_one_field/show_component.html.erb +++ b/app/components/avo/fields/has_one_field/show_component.html.erb @@ -10,7 +10,7 @@ icon: 'heroicons/outline/link', color: :primary, style: :text, - 'data-turbo-frame': 'attach_modal' do %> + data_turbo_frame: Avo::MODAL_FRAME_ID do %> <%= t('avo.attach_item', item: @field.name.humanize(capitalize: false)) %> <% end %> <% end %> diff --git a/app/components/avo/resource_component.rb b/app/components/avo/resource_component.rb index ee7668a300..540e1c14b9 100644 --- a/app/components/avo/resource_component.rb +++ b/app/components/avo/resource_component.rb @@ -246,7 +246,7 @@ def render_attach_button(control) color: :primary, style: :text, data: { - turbo_frame: :attach_modal, + turbo_frame: Avo::MODAL_FRAME_ID, target: :attach } do control.label @@ -282,7 +282,7 @@ def render_action(action) title: action.title, size: action.size, data: { - turbo_frame: Avo::ACTIONS_TURBO_FRAME_ID, + turbo_frame: Avo::MODAL_FRAME_ID, action_name: action.action.action_name, tippy: action.title ? :tooltip : nil, action: "click->actions-picker#visitAction", diff --git a/app/controllers/avo/actions_controller.rb b/app/controllers/avo/actions_controller.rb index a0b9a1aba9..ebef2ceca6 100644 --- a/app/controllers/avo/actions_controller.rb +++ b/app/controllers/avo/actions_controller.rb @@ -105,10 +105,9 @@ def respond turbo_stream.flash_alerts ] when :navigate_to_action - frame_id = Avo::ACTIONS_TURBO_FRAME_ID src, _ = @response[:action].link_arguments(resource: @action.resource, **@response[:navigate_to_action_args]) - turbo_stream.turbo_frame_set_src(frame_id, src) + turbo_stream.turbo_frame_set_src(Avo::MODAL_FRAME_ID, src) when :redirect turbo_stream.redirect_to( Avo::ExecutionContext.new(target: @response[:path]).handle, diff --git a/app/controllers/avo/base_controller.rb b/app/controllers/avo/base_controller.rb index 796ebbf463..90dc73f911 100644 --- a/app/controllers/avo/base_controller.rb +++ b/app/controllers/avo/base_controller.rb @@ -109,7 +109,7 @@ def new # Handle special cases when creating a new record via a belongs_to relationship if params[:via_belongs_to_resource_class].present? - return render turbo_stream: turbo_stream.append("attach_modal", partial: "avo/base/new_via_belongs_to") + return render turbo_stream: turbo_stream.append(Avo::MODAL_FRAME_ID, partial: "avo/base/new_via_belongs_to") end set_actions diff --git a/app/helpers/avo/turbo_stream_actions_helper.rb b/app/helpers/avo/turbo_stream_actions_helper.rb index e255d3a087..7dcd337909 100644 --- a/app/helpers/avo/turbo_stream_actions_helper.rb +++ b/app/helpers/avo/turbo_stream_actions_helper.rb @@ -10,10 +10,10 @@ def flash_alerts template: @view_context.render(Avo::FlashAlertsComponent.new(flashes: @view_context.flash.discard)) end - def close_action_modal + def close_modal turbo_stream_action_tag :replace, - target: Avo::ACTIONS_TURBO_FRAME_ID, - template: @view_context.turbo_frame_tag(Avo::ACTIONS_TURBO_FRAME_ID, data: {turbo_temporary: 1}) + target: Avo::MODAL_FRAME_ID, + template: @view_context.turbo_frame_tag(Avo::MODAL_FRAME_ID, data: {turbo_temporary: 1}) end end end diff --git a/app/javascript/js/controllers/actions_picker_controller.js b/app/javascript/js/controllers/actions_picker_controller.js index d1fe201897..f478ebc39d 100644 --- a/app/javascript/js/controllers/actions_picker_controller.js +++ b/app/javascript/js/controllers/actions_picker_controller.js @@ -12,7 +12,7 @@ export default class extends Controller { } get actionsShowTurboFrame() { - return document.querySelector('turbo-frame#actions_show') + return document.querySelector(`turbo-frame#${window.Avo.configuration.modal_frame_id}`) } enableTarget() { diff --git a/app/views/avo/actions/show.html.erb b/app/views/avo/actions/show.html.erb index ad4834aa5b..6e37ab3c4a 100644 --- a/app/views/avo/actions/show.html.erb +++ b/app/views/avo/actions/show.html.erb @@ -2,7 +2,7 @@ <%= render Avo::LoadingComponent.new(title: "...") %> <% end %> -<%= turbo_frame_tag Avo::ACTIONS_TURBO_FRAME_ID do %> +<%= turbo_frame_tag Avo::MODAL_FRAME_ID do %>
" data-action-no-confirmation-value="<%= @action.no_confirmation %>" diff --git a/app/views/avo/associations/new.html.erb b/app/views/avo/associations/new.html.erb index d14abe6284..ea515e79e0 100644 --- a/app/views/avo/associations/new.html.erb +++ b/app/views/avo/associations/new.html.erb @@ -1,4 +1,4 @@ -<%= turbo_frame_tag 'attach_modal' do %> +<%= turbo_frame_tag Avo::MODAL_FRAME_ID do %> <% url = Avo::Services::URIService.parse(avo.root_url.to_s) .append_paths('resources', params[:resource_name], params[:id], params[:related_name]) diff --git a/app/views/avo/partials/_attach_modal.html.erb b/app/views/avo/partials/_attach_modal.html.erb deleted file mode 100644 index df192cbdce..0000000000 --- a/app/views/avo/partials/_attach_modal.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= turbo_frame_tag 'attach_modal' %> diff --git a/app/views/avo/partials/_javascript.html.erb b/app/views/avo/partials/_javascript.html.erb index b6c19cfc34..006bc03db1 100644 --- a/app/views/avo/partials/_javascript.html.erb +++ b/app/views/avo/partials/_javascript.html.erb @@ -11,4 +11,5 @@ param_key: '<%= Avo::DynamicFilters.configuration.param_key %>' } <% end %> + Avo.configuration.modal_frame_id = '<%= ::Avo::MODAL_FRAME_ID %>' <% end %> diff --git a/app/views/layouts/avo/application.html.erb b/app/views/layouts/avo/application.html.erb index 92ffbd1135..5bc8a06c95 100644 --- a/app/views/layouts/avo/application.html.erb +++ b/app/views/layouts/avo/application.html.erb @@ -49,8 +49,7 @@
- <%= turbo_frame_tag Avo::ACTIONS_TURBO_FRAME_ID, data: {turbo_temporary: 1} %> - <%= render partial: "avo/partials/attach_modal" %> + <%= turbo_frame_tag Avo::MODAL_FRAME_ID, data: {turbo_temporary: 1} %> <%= render partial: "avo/partials/alerts" %> <%= render partial: "avo/partials/scripts" %> <%= render partial: "avo/partials/confirm_dialog" %> diff --git a/lib/avo.rb b/lib/avo.rb index b1753ac5bb..83ce55ccaa 100644 --- a/lib/avo.rb +++ b/lib/avo.rb @@ -20,7 +20,7 @@ module Avo IN_DEVELOPMENT = ENV["AVO_IN_DEVELOPMENT"] == "1" PACKED = !IN_DEVELOPMENT COOKIES_KEY = "avo" - ACTIONS_TURBO_FRAME_ID = :actions_show + MODAL_FRAME_ID = :modal_frame ACTIONS_BACKGROUND_FRAME = :actions_background class LicenseVerificationTemperedError < StandardError; end diff --git a/lib/avo/base_action.rb b/lib/avo/base_action.rb index 7a00ae05ab..d8df280f0b 100644 --- a/lib/avo/base_action.rb +++ b/lib/avo/base_action.rb @@ -61,11 +61,7 @@ def link_arguments(resource:, arguments: {}, **args) ) .to_s - data = { - turbo_frame: Avo::ACTIONS_TURBO_FRAME_ID, - } - - [path, data] + [path, {turbo_frame: Avo::MODAL_FRAME_ID}] end # Encrypt the arguments so we can pass sensible data as a query param. diff --git a/spec/system/avo/actions_spec.rb b/spec/system/avo/actions_spec.rb index f90e52e7e0..4bcff86f5a 100644 --- a/spec/system/avo/actions_spec.rb +++ b/spec/system/avo/actions_spec.rb @@ -192,7 +192,7 @@ click_on "Actions" click_on "Do Nothing" - expect(page).to have_css('turbo-frame#actions_show') + expect(page).to have_css("turbo-frame#modal_frame") expect(page).to have_selector(modal = "[role='dialog']") click_on "Run" expect(page).not_to have_selector(modal) @@ -214,7 +214,7 @@ click_on "Actions" click_on "Close modal" - expect(page).to have_css('turbo-frame#actions_show') + expect(page).to have_css("turbo-frame#modal_frame") expect(page).to have_selector(modal = "[role='dialog']") click_on "Run" expect(page).not_to have_selector(modal) From ab88a5b283193b59fed6dc55e6fbdd887bdd69c1 Mon Sep 17 00:00:00 2001 From: Paul Bob Date: Fri, 27 Sep 2024 14:17:13 +0300 Subject: [PATCH 2/8] fix method name --- app/controllers/avo/actions_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/avo/actions_controller.rb b/app/controllers/avo/actions_controller.rb index ebef2ceca6..1b192c1be3 100644 --- a/app/controllers/avo/actions_controller.rb +++ b/app/controllers/avo/actions_controller.rb @@ -101,7 +101,7 @@ def respond # Trigger download, removes modal and flash the messages [ turbo_stream.download(content: Base64.encode64(@response[:path]), filename: @response[:filename]), - turbo_stream.close_action_modal, + turbo_stream.close_modal, turbo_stream.flash_alerts ] when :navigate_to_action @@ -117,7 +117,7 @@ def respond when :close_modal # Close the modal and flash the messages [ - turbo_stream.close_action_modal, + turbo_stream.close_modal, turbo_stream.flash_alerts ] else From 0f3b569eb6589ff28c9ada74569b654c86a17549 Mon Sep 17 00:00:00 2001 From: Paul Bob Date: Sat, 28 Sep 2024 20:30:01 +0300 Subject: [PATCH 3/8] try 7.2 --- Gemfile | 5 +- Gemfile.lock | 195 +++++++++--------- gemfiles/rails_6.1_ruby_3.1.4.gemfile | 2 +- gemfiles/rails_6.1_ruby_3.3.0.gemfile | 2 +- gemfiles/rails_7.1_ruby_3.1.4.gemfile | 2 +- gemfiles/rails_7.1_ruby_3.3.0.gemfile | 2 +- gemfiles/rails_7.2.0.beta2_ruby_3.1.4.gemfile | 2 +- gemfiles/rails_7.2.0.beta2_ruby_3.3.0.gemfile | 2 +- gemfiles/rails_8.0_ruby_3.1.4.gemfile | 2 +- gemfiles/rails_8.0_ruby_3.3.0.gemfile | 2 +- spec/dummy/config/application.rb | 2 +- 11 files changed, 105 insertions(+), 113 deletions(-) diff --git a/Gemfile b/Gemfile index 2731d10d6a..0a0be86e88 100644 --- a/Gemfile +++ b/Gemfile @@ -22,11 +22,12 @@ gem 'cssbundling-rails' # # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' # gem "rails", "~> 7.1.0" -gem "rails", github: "rails/rails", branch: "main" +# gem "rails", github: "rails/rails", branch: "main" +gem 'rails', '~> 7.2', '>= 7.2.1' # Avo file filed requires this gem # gem "activestorage" -gem "activestorage", github: "rails/rails", branch: "main" +# gem "activestorage", github: "rails/rails", branch: "main" # Use postgresql as the database for Active Record gem "pg", ">= 0.18", "< 2.0" diff --git a/Gemfile.lock b/Gemfile.lock index 87e8843284..4b537f6697 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -5,105 +5,6 @@ GIT acts-as-taggable-on (10.0.0) activerecord (>= 6.1, < 8) -GIT - remote: https://github.com/rails/rails.git - revision: b88d9af34fbc1c84ce2769ba02584eab2c28ac6e - branch: main - specs: - actioncable (8.0.0.alpha) - actionpack (= 8.0.0.alpha) - activesupport (= 8.0.0.alpha) - nio4r (~> 2.0) - websocket-driver (>= 0.6.1) - zeitwerk (~> 2.6) - actionmailbox (8.0.0.alpha) - actionpack (= 8.0.0.alpha) - activejob (= 8.0.0.alpha) - activerecord (= 8.0.0.alpha) - activestorage (= 8.0.0.alpha) - activesupport (= 8.0.0.alpha) - mail (>= 2.8.0) - actionmailer (8.0.0.alpha) - actionpack (= 8.0.0.alpha) - actionview (= 8.0.0.alpha) - activejob (= 8.0.0.alpha) - activesupport (= 8.0.0.alpha) - mail (>= 2.8.0) - rails-dom-testing (~> 2.2) - actionpack (8.0.0.alpha) - actionview (= 8.0.0.alpha) - activesupport (= 8.0.0.alpha) - nokogiri (>= 1.8.5) - rack (>= 2.2.4) - rack-session (>= 1.0.1) - rack-test (>= 0.6.3) - rails-dom-testing (~> 2.2) - rails-html-sanitizer (~> 1.6) - useragent (~> 0.16) - actiontext (8.0.0.alpha) - actionpack (= 8.0.0.alpha) - activerecord (= 8.0.0.alpha) - activestorage (= 8.0.0.alpha) - activesupport (= 8.0.0.alpha) - globalid (>= 0.6.0) - nokogiri (>= 1.8.5) - actionview (8.0.0.alpha) - activesupport (= 8.0.0.alpha) - builder (~> 3.1) - erubi (~> 1.11) - rails-dom-testing (~> 2.2) - rails-html-sanitizer (~> 1.6) - activejob (8.0.0.alpha) - activesupport (= 8.0.0.alpha) - globalid (>= 0.3.6) - activemodel (8.0.0.alpha) - activesupport (= 8.0.0.alpha) - activerecord (8.0.0.alpha) - activemodel (= 8.0.0.alpha) - activesupport (= 8.0.0.alpha) - timeout (>= 0.4.0) - activestorage (8.0.0.alpha) - actionpack (= 8.0.0.alpha) - activejob (= 8.0.0.alpha) - activerecord (= 8.0.0.alpha) - activesupport (= 8.0.0.alpha) - marcel (~> 1.0) - activesupport (8.0.0.alpha) - base64 - benchmark (>= 0.3) - bigdecimal - concurrent-ruby (~> 1.0, >= 1.3.1) - connection_pool (>= 2.2.5) - drb - i18n (>= 1.6, < 2) - logger (>= 1.4.2) - minitest (>= 5.1) - securerandom (>= 0.3) - tzinfo (~> 2.0, >= 2.0.5) - uri (>= 0.13.1) - rails (8.0.0.alpha) - actioncable (= 8.0.0.alpha) - actionmailbox (= 8.0.0.alpha) - actionmailer (= 8.0.0.alpha) - actionpack (= 8.0.0.alpha) - actiontext (= 8.0.0.alpha) - actionview (= 8.0.0.alpha) - activejob (= 8.0.0.alpha) - activemodel (= 8.0.0.alpha) - activerecord (= 8.0.0.alpha) - activestorage (= 8.0.0.alpha) - activesupport (= 8.0.0.alpha) - bundler (>= 1.15.0) - railties (= 8.0.0.alpha) - railties (8.0.0.alpha) - actionpack (= 8.0.0.alpha) - activesupport (= 8.0.0.alpha) - irb (~> 1.13) - rackup (>= 1.0.0) - rake (>= 12.2) - thor (~> 1.0, >= 1.2.2) - zeitwerk (~> 2.6) - PATH remote: . specs: @@ -131,11 +32,81 @@ PATH GEM remote: https://rubygems.org/ specs: + actioncable (7.2.1) + actionpack (= 7.2.1) + activesupport (= 7.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) + mail (>= 2.8.0) + actionmailer (7.2.1) + actionpack (= 7.2.1) + actionview (= 7.2.1) + activejob (= 7.2.1) + activesupport (= 7.2.1) + mail (>= 2.8.0) + rails-dom-testing (~> 2.2) + actionpack (7.2.1) + actionview (= 7.2.1) + activesupport (= 7.2.1) + nokogiri (>= 1.8.5) + racc + 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) + useragent (~> 0.16) + actiontext (7.2.1) + actionpack (= 7.2.1) + activerecord (= 7.2.1) + activestorage (= 7.2.1) + activesupport (= 7.2.1) + globalid (>= 0.6.0) + nokogiri (>= 1.8.5) + actionview (7.2.1) + activesupport (= 7.2.1) + builder (~> 3.1) + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) active_link_to (1.0.5) actionpack addressable active_median (0.4.1) activesupport (>= 6.1) + activejob (7.2.1) + activesupport (= 7.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) + timeout (>= 0.4.0) + activestorage (7.2.1) + actionpack (= 7.2.1) + activejob (= 7.2.1) + activerecord (= 7.2.1) + activesupport (= 7.2.1) + marcel (~> 1.0) + activesupport (7.2.1) + base64 + bigdecimal + concurrent-ruby (~> 1.0, >= 1.3.1) + connection_pool (>= 2.2.5) + drb + i18n (>= 1.6, < 2) + logger (>= 1.4.2) + minitest (>= 5.1) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) acts_as_list (1.2.2) activerecord (>= 6.1) activesupport (>= 6.1) @@ -464,6 +435,20 @@ GEM rackup (2.1.0) 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) + bundler (>= 1.15.0) + railties (= 7.2.1) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) @@ -478,6 +463,14 @@ GEM rails-i18n (7.0.9) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 8) + railties (7.2.1) + actionpack (= 7.2.1) + activesupport (= 7.2.1) + irb (~> 1.13) + 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.1) @@ -640,7 +633,6 @@ GEM concurrent-ruby (~> 1.0) unaccent (0.4.0) unicode-display_width (2.6.0) - uri (0.13.1) useragent (0.16.10) view_component (3.14.0) activesupport (>= 5.2.0, < 8.0) @@ -677,7 +669,6 @@ PLATFORMS DEPENDENCIES active_link_to active_median - activestorage! acts-as-taggable-on! acts_as_list actual_db_schema @@ -730,7 +721,7 @@ DEPENDENCIES pluggy! prefixed_ids puma (~> 6.4) - rails! + rails (~> 7.2, >= 7.2.1) rails-controller-testing ransack (>= 4.2.0) redis (~> 5.0) diff --git a/gemfiles/rails_6.1_ruby_3.1.4.gemfile b/gemfiles/rails_6.1_ruby_3.1.4.gemfile index 570b31baea..e4004e5ae7 100644 --- a/gemfiles/rails_6.1_ruby_3.1.4.gemfile +++ b/gemfiles/rails_6.1_ruby_3.1.4.gemfile @@ -5,7 +5,6 @@ source "https://rubygems.org" gem "jsbundling-rails" gem "cssbundling-rails" gem "rails", "~> 6.1" -gem "activestorage" gem "pg", ">= 0.18", "< 2.0" gem "puma", "~> 6.4" gem "redis", "~> 5.0" @@ -46,6 +45,7 @@ gem "avo-record_link_field" gem "pagy", "> 8" gem "csv" gem "psych", "< 4" +gem "activestorage" group :development do gem "standard", require: false diff --git a/gemfiles/rails_6.1_ruby_3.3.0.gemfile b/gemfiles/rails_6.1_ruby_3.3.0.gemfile index 570b31baea..e4004e5ae7 100644 --- a/gemfiles/rails_6.1_ruby_3.3.0.gemfile +++ b/gemfiles/rails_6.1_ruby_3.3.0.gemfile @@ -5,7 +5,6 @@ source "https://rubygems.org" gem "jsbundling-rails" gem "cssbundling-rails" gem "rails", "~> 6.1" -gem "activestorage" gem "pg", ">= 0.18", "< 2.0" gem "puma", "~> 6.4" gem "redis", "~> 5.0" @@ -46,6 +45,7 @@ gem "avo-record_link_field" gem "pagy", "> 8" gem "csv" gem "psych", "< 4" +gem "activestorage" group :development do gem "standard", require: false diff --git a/gemfiles/rails_7.1_ruby_3.1.4.gemfile b/gemfiles/rails_7.1_ruby_3.1.4.gemfile index 759f8a33ef..88f5b0f019 100644 --- a/gemfiles/rails_7.1_ruby_3.1.4.gemfile +++ b/gemfiles/rails_7.1_ruby_3.1.4.gemfile @@ -5,7 +5,6 @@ source "https://rubygems.org" gem "jsbundling-rails" gem "cssbundling-rails" gem "rails", "~> 7.1" -gem "activestorage" gem "pg", ">= 0.18", "< 2.0" gem "puma", "~> 6.4" gem "redis", "~> 5.0" @@ -46,6 +45,7 @@ gem "avo-record_link_field" gem "pagy", "> 8" gem "csv" gem "psych", "< 4" +gem "activestorage" group :development do gem "standard", require: false diff --git a/gemfiles/rails_7.1_ruby_3.3.0.gemfile b/gemfiles/rails_7.1_ruby_3.3.0.gemfile index 759f8a33ef..88f5b0f019 100644 --- a/gemfiles/rails_7.1_ruby_3.3.0.gemfile +++ b/gemfiles/rails_7.1_ruby_3.3.0.gemfile @@ -5,7 +5,6 @@ source "https://rubygems.org" gem "jsbundling-rails" gem "cssbundling-rails" gem "rails", "~> 7.1" -gem "activestorage" gem "pg", ">= 0.18", "< 2.0" gem "puma", "~> 6.4" gem "redis", "~> 5.0" @@ -46,6 +45,7 @@ gem "avo-record_link_field" gem "pagy", "> 8" gem "csv" gem "psych", "< 4" +gem "activestorage" group :development do gem "standard", require: false diff --git a/gemfiles/rails_7.2.0.beta2_ruby_3.1.4.gemfile b/gemfiles/rails_7.2.0.beta2_ruby_3.1.4.gemfile index 68b5b0698a..ca0cf566b6 100644 --- a/gemfiles/rails_7.2.0.beta2_ruby_3.1.4.gemfile +++ b/gemfiles/rails_7.2.0.beta2_ruby_3.1.4.gemfile @@ -5,7 +5,6 @@ source "https://rubygems.org" gem "jsbundling-rails" gem "cssbundling-rails" gem "rails", "~> 7.2.0.beta2" -gem "activestorage" gem "pg", ">= 0.18", "< 2.0" gem "puma", "~> 6.4" gem "redis", "~> 5.0" @@ -46,6 +45,7 @@ gem "avo-record_link_field" gem "pagy", "> 8" gem "csv" gem "psych", "< 4" +gem "activestorage" group :development do gem "standard", require: false diff --git a/gemfiles/rails_7.2.0.beta2_ruby_3.3.0.gemfile b/gemfiles/rails_7.2.0.beta2_ruby_3.3.0.gemfile index 68b5b0698a..ca0cf566b6 100644 --- a/gemfiles/rails_7.2.0.beta2_ruby_3.3.0.gemfile +++ b/gemfiles/rails_7.2.0.beta2_ruby_3.3.0.gemfile @@ -5,7 +5,6 @@ source "https://rubygems.org" gem "jsbundling-rails" gem "cssbundling-rails" gem "rails", "~> 7.2.0.beta2" -gem "activestorage" gem "pg", ">= 0.18", "< 2.0" gem "puma", "~> 6.4" gem "redis", "~> 5.0" @@ -46,6 +45,7 @@ gem "avo-record_link_field" gem "pagy", "> 8" gem "csv" gem "psych", "< 4" +gem "activestorage" group :development do gem "standard", require: false diff --git a/gemfiles/rails_8.0_ruby_3.1.4.gemfile b/gemfiles/rails_8.0_ruby_3.1.4.gemfile index 5366e6ffaf..63df81a759 100644 --- a/gemfiles/rails_8.0_ruby_3.1.4.gemfile +++ b/gemfiles/rails_8.0_ruby_3.1.4.gemfile @@ -5,7 +5,6 @@ source "https://rubygems.org" gem "jsbundling-rails" gem "cssbundling-rails" gem "rails", branch: "main", git: "https://github.com/rails/rails.git" -gem "activestorage", branch: "main", git: "https://github.com/rails/rails.git" gem "pg", ">= 0.18", "< 2.0" gem "puma", "~> 6.4" gem "redis", "~> 5.0" @@ -46,6 +45,7 @@ gem "avo-record_link_field" gem "pagy", "> 8" gem "csv" gem "psych", "< 4" +gem "activestorage", branch: "main", git: "https://github.com/rails/rails.git" group :development do gem "standard", require: false diff --git a/gemfiles/rails_8.0_ruby_3.3.0.gemfile b/gemfiles/rails_8.0_ruby_3.3.0.gemfile index 5366e6ffaf..63df81a759 100644 --- a/gemfiles/rails_8.0_ruby_3.3.0.gemfile +++ b/gemfiles/rails_8.0_ruby_3.3.0.gemfile @@ -5,7 +5,6 @@ source "https://rubygems.org" gem "jsbundling-rails" gem "cssbundling-rails" gem "rails", branch: "main", git: "https://github.com/rails/rails.git" -gem "activestorage", branch: "main", git: "https://github.com/rails/rails.git" gem "pg", ">= 0.18", "< 2.0" gem "puma", "~> 6.4" gem "redis", "~> 5.0" @@ -46,6 +45,7 @@ gem "avo-record_link_field" gem "pagy", "> 8" gem "csv" gem "psych", "< 4" +gem "activestorage", branch: "main", git: "https://github.com/rails/rails.git" group :development do gem "standard", require: false diff --git a/spec/dummy/config/application.rb b/spec/dummy/config/application.rb index 516f1b56ca..186c729d88 100644 --- a/spec/dummy/config/application.rb +++ b/spec/dummy/config/application.rb @@ -22,7 +22,7 @@ module Avo3Dummy class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. # We're going to load the defaults from the env because we're using appraisal and differently versioned gems. - config.load_defaults ENV["RAILS_VERSION"] || 8.0 + config.load_defaults ENV["RAILS_VERSION"] || 7.2 # Settings in config/environments/* take precedence over those specified here. # Application configuration can go into files in config/initializers From 29f73dc6f504b29cc412a44068431bd63266ba86 Mon Sep 17 00:00:00 2001 From: Paul Bob Date: Sat, 28 Sep 2024 20:42:43 +0300 Subject: [PATCH 4/8] Revert "try 7.2" This reverts commit 0f3b569eb6589ff28c9ada74569b654c86a17549. --- Gemfile | 5 +- Gemfile.lock | 195 +++++++++--------- gemfiles/rails_6.1_ruby_3.1.4.gemfile | 2 +- gemfiles/rails_6.1_ruby_3.3.0.gemfile | 2 +- gemfiles/rails_7.1_ruby_3.1.4.gemfile | 2 +- gemfiles/rails_7.1_ruby_3.3.0.gemfile | 2 +- gemfiles/rails_7.2.0.beta2_ruby_3.1.4.gemfile | 2 +- gemfiles/rails_7.2.0.beta2_ruby_3.3.0.gemfile | 2 +- gemfiles/rails_8.0_ruby_3.1.4.gemfile | 2 +- gemfiles/rails_8.0_ruby_3.3.0.gemfile | 2 +- spec/dummy/config/application.rb | 2 +- 11 files changed, 113 insertions(+), 105 deletions(-) diff --git a/Gemfile b/Gemfile index 0a0be86e88..2731d10d6a 100644 --- a/Gemfile +++ b/Gemfile @@ -22,12 +22,11 @@ gem 'cssbundling-rails' # # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' # gem "rails", "~> 7.1.0" -# gem "rails", github: "rails/rails", branch: "main" -gem 'rails', '~> 7.2', '>= 7.2.1' +gem "rails", github: "rails/rails", branch: "main" # Avo file filed requires this gem # gem "activestorage" -# gem "activestorage", github: "rails/rails", branch: "main" +gem "activestorage", github: "rails/rails", branch: "main" # Use postgresql as the database for Active Record gem "pg", ">= 0.18", "< 2.0" diff --git a/Gemfile.lock b/Gemfile.lock index 4b537f6697..87e8843284 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -5,99 +5,72 @@ GIT acts-as-taggable-on (10.0.0) activerecord (>= 6.1, < 8) -PATH - remote: . - specs: - avo (3.12.0) - actionview (>= 6.1) - active_link_to - activerecord (>= 6.1) - activesupport (>= 6.1) - addressable - docile - inline_svg - literal (~> 0.2) - meta-tags - pagy (>= 7.0.0) - turbo-rails (>= 2.0.0) - turbo_power (>= 0.6.0) - view_component (>= 3.7.0) - zeitwerk (>= 2.6.12) - -PATH - remote: pluggy - specs: - pluggy (0.0.1) - -GEM - remote: https://rubygems.org/ +GIT + remote: https://github.com/rails/rails.git + revision: b88d9af34fbc1c84ce2769ba02584eab2c28ac6e + branch: main specs: - actioncable (7.2.1) - actionpack (= 7.2.1) - activesupport (= 7.2.1) + actioncable (8.0.0.alpha) + actionpack (= 8.0.0.alpha) + activesupport (= 8.0.0.alpha) 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 (8.0.0.alpha) + actionpack (= 8.0.0.alpha) + activejob (= 8.0.0.alpha) + activerecord (= 8.0.0.alpha) + activestorage (= 8.0.0.alpha) + activesupport (= 8.0.0.alpha) 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 (8.0.0.alpha) + actionpack (= 8.0.0.alpha) + actionview (= 8.0.0.alpha) + activejob (= 8.0.0.alpha) + activesupport (= 8.0.0.alpha) mail (>= 2.8.0) rails-dom-testing (~> 2.2) - actionpack (7.2.1) - actionview (= 7.2.1) - activesupport (= 7.2.1) + actionpack (8.0.0.alpha) + actionview (= 8.0.0.alpha) + activesupport (= 8.0.0.alpha) nokogiri (>= 1.8.5) - racc - rack (>= 2.2.4, < 3.2) + rack (>= 2.2.4) rack-session (>= 1.0.1) rack-test (>= 0.6.3) 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 (8.0.0.alpha) + actionpack (= 8.0.0.alpha) + activerecord (= 8.0.0.alpha) + activestorage (= 8.0.0.alpha) + activesupport (= 8.0.0.alpha) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.2.1) - activesupport (= 7.2.1) + actionview (8.0.0.alpha) + activesupport (= 8.0.0.alpha) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - active_link_to (1.0.5) - actionpack - addressable - active_median (0.4.1) - activesupport (>= 6.1) - activejob (7.2.1) - activesupport (= 7.2.1) + activejob (8.0.0.alpha) + activesupport (= 8.0.0.alpha) 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 (8.0.0.alpha) + activesupport (= 8.0.0.alpha) + activerecord (8.0.0.alpha) + activemodel (= 8.0.0.alpha) + activesupport (= 8.0.0.alpha) 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 (8.0.0.alpha) + actionpack (= 8.0.0.alpha) + activejob (= 8.0.0.alpha) + activerecord (= 8.0.0.alpha) + activesupport (= 8.0.0.alpha) marcel (~> 1.0) - activesupport (7.2.1) + activesupport (8.0.0.alpha) base64 + benchmark (>= 0.3) bigdecimal concurrent-ruby (~> 1.0, >= 1.3.1) connection_pool (>= 2.2.5) @@ -107,6 +80,62 @@ GEM minitest (>= 5.1) securerandom (>= 0.3) tzinfo (~> 2.0, >= 2.0.5) + uri (>= 0.13.1) + rails (8.0.0.alpha) + actioncable (= 8.0.0.alpha) + actionmailbox (= 8.0.0.alpha) + actionmailer (= 8.0.0.alpha) + actionpack (= 8.0.0.alpha) + actiontext (= 8.0.0.alpha) + actionview (= 8.0.0.alpha) + activejob (= 8.0.0.alpha) + activemodel (= 8.0.0.alpha) + activerecord (= 8.0.0.alpha) + activestorage (= 8.0.0.alpha) + activesupport (= 8.0.0.alpha) + bundler (>= 1.15.0) + railties (= 8.0.0.alpha) + railties (8.0.0.alpha) + actionpack (= 8.0.0.alpha) + activesupport (= 8.0.0.alpha) + irb (~> 1.13) + rackup (>= 1.0.0) + rake (>= 12.2) + thor (~> 1.0, >= 1.2.2) + zeitwerk (~> 2.6) + +PATH + remote: . + specs: + avo (3.12.0) + actionview (>= 6.1) + active_link_to + activerecord (>= 6.1) + activesupport (>= 6.1) + addressable + docile + inline_svg + literal (~> 0.2) + meta-tags + pagy (>= 7.0.0) + turbo-rails (>= 2.0.0) + turbo_power (>= 0.6.0) + view_component (>= 3.7.0) + zeitwerk (>= 2.6.12) + +PATH + remote: pluggy + specs: + pluggy (0.0.1) + +GEM + remote: https://rubygems.org/ + specs: + active_link_to (1.0.5) + actionpack + addressable + active_median (0.4.1) + activesupport (>= 6.1) acts_as_list (1.2.2) activerecord (>= 6.1) activesupport (>= 6.1) @@ -435,20 +464,6 @@ GEM rackup (2.1.0) 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) - bundler (>= 1.15.0) - railties (= 7.2.1) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) @@ -463,14 +478,6 @@ GEM rails-i18n (7.0.9) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 8) - railties (7.2.1) - actionpack (= 7.2.1) - activesupport (= 7.2.1) - irb (~> 1.13) - 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.1) @@ -633,6 +640,7 @@ GEM concurrent-ruby (~> 1.0) unaccent (0.4.0) unicode-display_width (2.6.0) + uri (0.13.1) useragent (0.16.10) view_component (3.14.0) activesupport (>= 5.2.0, < 8.0) @@ -669,6 +677,7 @@ PLATFORMS DEPENDENCIES active_link_to active_median + activestorage! acts-as-taggable-on! acts_as_list actual_db_schema @@ -721,7 +730,7 @@ DEPENDENCIES pluggy! prefixed_ids puma (~> 6.4) - rails (~> 7.2, >= 7.2.1) + rails! rails-controller-testing ransack (>= 4.2.0) redis (~> 5.0) diff --git a/gemfiles/rails_6.1_ruby_3.1.4.gemfile b/gemfiles/rails_6.1_ruby_3.1.4.gemfile index e4004e5ae7..570b31baea 100644 --- a/gemfiles/rails_6.1_ruby_3.1.4.gemfile +++ b/gemfiles/rails_6.1_ruby_3.1.4.gemfile @@ -5,6 +5,7 @@ source "https://rubygems.org" gem "jsbundling-rails" gem "cssbundling-rails" gem "rails", "~> 6.1" +gem "activestorage" gem "pg", ">= 0.18", "< 2.0" gem "puma", "~> 6.4" gem "redis", "~> 5.0" @@ -45,7 +46,6 @@ gem "avo-record_link_field" gem "pagy", "> 8" gem "csv" gem "psych", "< 4" -gem "activestorage" group :development do gem "standard", require: false diff --git a/gemfiles/rails_6.1_ruby_3.3.0.gemfile b/gemfiles/rails_6.1_ruby_3.3.0.gemfile index e4004e5ae7..570b31baea 100644 --- a/gemfiles/rails_6.1_ruby_3.3.0.gemfile +++ b/gemfiles/rails_6.1_ruby_3.3.0.gemfile @@ -5,6 +5,7 @@ source "https://rubygems.org" gem "jsbundling-rails" gem "cssbundling-rails" gem "rails", "~> 6.1" +gem "activestorage" gem "pg", ">= 0.18", "< 2.0" gem "puma", "~> 6.4" gem "redis", "~> 5.0" @@ -45,7 +46,6 @@ gem "avo-record_link_field" gem "pagy", "> 8" gem "csv" gem "psych", "< 4" -gem "activestorage" group :development do gem "standard", require: false diff --git a/gemfiles/rails_7.1_ruby_3.1.4.gemfile b/gemfiles/rails_7.1_ruby_3.1.4.gemfile index 88f5b0f019..759f8a33ef 100644 --- a/gemfiles/rails_7.1_ruby_3.1.4.gemfile +++ b/gemfiles/rails_7.1_ruby_3.1.4.gemfile @@ -5,6 +5,7 @@ source "https://rubygems.org" gem "jsbundling-rails" gem "cssbundling-rails" gem "rails", "~> 7.1" +gem "activestorage" gem "pg", ">= 0.18", "< 2.0" gem "puma", "~> 6.4" gem "redis", "~> 5.0" @@ -45,7 +46,6 @@ gem "avo-record_link_field" gem "pagy", "> 8" gem "csv" gem "psych", "< 4" -gem "activestorage" group :development do gem "standard", require: false diff --git a/gemfiles/rails_7.1_ruby_3.3.0.gemfile b/gemfiles/rails_7.1_ruby_3.3.0.gemfile index 88f5b0f019..759f8a33ef 100644 --- a/gemfiles/rails_7.1_ruby_3.3.0.gemfile +++ b/gemfiles/rails_7.1_ruby_3.3.0.gemfile @@ -5,6 +5,7 @@ source "https://rubygems.org" gem "jsbundling-rails" gem "cssbundling-rails" gem "rails", "~> 7.1" +gem "activestorage" gem "pg", ">= 0.18", "< 2.0" gem "puma", "~> 6.4" gem "redis", "~> 5.0" @@ -45,7 +46,6 @@ gem "avo-record_link_field" gem "pagy", "> 8" gem "csv" gem "psych", "< 4" -gem "activestorage" group :development do gem "standard", require: false diff --git a/gemfiles/rails_7.2.0.beta2_ruby_3.1.4.gemfile b/gemfiles/rails_7.2.0.beta2_ruby_3.1.4.gemfile index ca0cf566b6..68b5b0698a 100644 --- a/gemfiles/rails_7.2.0.beta2_ruby_3.1.4.gemfile +++ b/gemfiles/rails_7.2.0.beta2_ruby_3.1.4.gemfile @@ -5,6 +5,7 @@ source "https://rubygems.org" gem "jsbundling-rails" gem "cssbundling-rails" gem "rails", "~> 7.2.0.beta2" +gem "activestorage" gem "pg", ">= 0.18", "< 2.0" gem "puma", "~> 6.4" gem "redis", "~> 5.0" @@ -45,7 +46,6 @@ gem "avo-record_link_field" gem "pagy", "> 8" gem "csv" gem "psych", "< 4" -gem "activestorage" group :development do gem "standard", require: false diff --git a/gemfiles/rails_7.2.0.beta2_ruby_3.3.0.gemfile b/gemfiles/rails_7.2.0.beta2_ruby_3.3.0.gemfile index ca0cf566b6..68b5b0698a 100644 --- a/gemfiles/rails_7.2.0.beta2_ruby_3.3.0.gemfile +++ b/gemfiles/rails_7.2.0.beta2_ruby_3.3.0.gemfile @@ -5,6 +5,7 @@ source "https://rubygems.org" gem "jsbundling-rails" gem "cssbundling-rails" gem "rails", "~> 7.2.0.beta2" +gem "activestorage" gem "pg", ">= 0.18", "< 2.0" gem "puma", "~> 6.4" gem "redis", "~> 5.0" @@ -45,7 +46,6 @@ gem "avo-record_link_field" gem "pagy", "> 8" gem "csv" gem "psych", "< 4" -gem "activestorage" group :development do gem "standard", require: false diff --git a/gemfiles/rails_8.0_ruby_3.1.4.gemfile b/gemfiles/rails_8.0_ruby_3.1.4.gemfile index 63df81a759..5366e6ffaf 100644 --- a/gemfiles/rails_8.0_ruby_3.1.4.gemfile +++ b/gemfiles/rails_8.0_ruby_3.1.4.gemfile @@ -5,6 +5,7 @@ source "https://rubygems.org" gem "jsbundling-rails" gem "cssbundling-rails" gem "rails", branch: "main", git: "https://github.com/rails/rails.git" +gem "activestorage", branch: "main", git: "https://github.com/rails/rails.git" gem "pg", ">= 0.18", "< 2.0" gem "puma", "~> 6.4" gem "redis", "~> 5.0" @@ -45,7 +46,6 @@ gem "avo-record_link_field" gem "pagy", "> 8" gem "csv" gem "psych", "< 4" -gem "activestorage", branch: "main", git: "https://github.com/rails/rails.git" group :development do gem "standard", require: false diff --git a/gemfiles/rails_8.0_ruby_3.3.0.gemfile b/gemfiles/rails_8.0_ruby_3.3.0.gemfile index 63df81a759..5366e6ffaf 100644 --- a/gemfiles/rails_8.0_ruby_3.3.0.gemfile +++ b/gemfiles/rails_8.0_ruby_3.3.0.gemfile @@ -5,6 +5,7 @@ source "https://rubygems.org" gem "jsbundling-rails" gem "cssbundling-rails" gem "rails", branch: "main", git: "https://github.com/rails/rails.git" +gem "activestorage", branch: "main", git: "https://github.com/rails/rails.git" gem "pg", ">= 0.18", "< 2.0" gem "puma", "~> 6.4" gem "redis", "~> 5.0" @@ -45,7 +46,6 @@ gem "avo-record_link_field" gem "pagy", "> 8" gem "csv" gem "psych", "< 4" -gem "activestorage", branch: "main", git: "https://github.com/rails/rails.git" group :development do gem "standard", require: false diff --git a/spec/dummy/config/application.rb b/spec/dummy/config/application.rb index 186c729d88..516f1b56ca 100644 --- a/spec/dummy/config/application.rb +++ b/spec/dummy/config/application.rb @@ -22,7 +22,7 @@ module Avo3Dummy class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. # We're going to load the defaults from the env because we're using appraisal and differently versioned gems. - config.load_defaults ENV["RAILS_VERSION"] || 7.2 + config.load_defaults ENV["RAILS_VERSION"] || 8.0 # Settings in config/environments/* take precedence over those specified here. # Application configuration can go into files in config/initializers From 333592834c08531d9db0ba5ec5e468bc7ba3457f Mon Sep 17 00:00:00 2001 From: Paul Bob Date: Sat, 28 Sep 2024 20:59:21 +0300 Subject: [PATCH 5/8] fix attach modal to not clear the background --- app/views/avo/associations/new.html.erb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/avo/associations/new.html.erb b/app/views/avo/associations/new.html.erb index ea515e79e0..78459445e7 100644 --- a/app/views/avo/associations/new.html.erb +++ b/app/views/avo/associations/new.html.erb @@ -14,6 +14,7 @@ url: url, local: true, data: { + turbo: false, 'turbo-frame': '_top' } do |form| %> <%= render Avo::ModalComponent.new do |c| %> From 79bb17fbf1d514eb236488c407e44c25cfd586a9 Mon Sep 17 00:00:00 2001 From: Paul Bob Date: Sat, 28 Sep 2024 21:13:41 +0300 Subject: [PATCH 6/8] fix has one attach data --- .../avo/fields/has_one_field/show_component.html.erb | 5 ++++- app/views/avo/associations/new.html.erb | 3 +-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/components/avo/fields/has_one_field/show_component.html.erb b/app/components/avo/fields/has_one_field/show_component.html.erb index df1605cdf9..d9a3705a57 100644 --- a/app/components/avo/fields/has_one_field/show_component.html.erb +++ b/app/components/avo/fields/has_one_field/show_component.html.erb @@ -10,7 +10,10 @@ icon: 'heroicons/outline/link', color: :primary, style: :text, - data_turbo_frame: Avo::MODAL_FRAME_ID do %> + data: { + turbo_frame: Avo::MODAL_FRAME_ID, + target: :attach + } do %> <%= t('avo.attach_item', item: @field.name.humanize(capitalize: false)) %> <% end %> <% end %> diff --git a/app/views/avo/associations/new.html.erb b/app/views/avo/associations/new.html.erb index 78459445e7..7061b865cb 100644 --- a/app/views/avo/associations/new.html.erb +++ b/app/views/avo/associations/new.html.erb @@ -14,8 +14,7 @@ url: url, local: true, data: { - turbo: false, - 'turbo-frame': '_top' + turbo_frame: :_top } do |form| %> <%= render Avo::ModalComponent.new do |c| %> <% c.with_heading do %> From b85d951651088e86e548e875886ae99a48e2e061 Mon Sep 17 00:00:00 2001 From: Paul Bob Date: Sat, 28 Sep 2024 21:15:57 +0300 Subject: [PATCH 7/8] extract url from associations view to controller --- app/controllers/avo/associations_controller.rb | 10 ++++++++++ app/views/avo/associations/new.html.erb | 13 +------------ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/app/controllers/avo/associations_controller.rb b/app/controllers/avo/associations_controller.rb index 5b18007818..a0f2df2205 100644 --- a/app/controllers/avo/associations_controller.rb +++ b/app/controllers/avo/associations_controller.rb @@ -64,6 +64,16 @@ def new [@attachment_resource.new(record: record).record_title, record.to_param] end end + + @url = Avo::Services::URIService.parse(avo.root_url.to_s) + .append_paths('resources', params[:resource_name], params[:id], params[:related_name]) + .append_query( + { + view: @resource&.view&.to_s, + for_attribute: @field&.try(:for_attribute) + }.compact + ) + .to_s end def create diff --git a/app/views/avo/associations/new.html.erb b/app/views/avo/associations/new.html.erb index 7061b865cb..bffa165a75 100644 --- a/app/views/avo/associations/new.html.erb +++ b/app/views/avo/associations/new.html.erb @@ -1,17 +1,6 @@ <%= turbo_frame_tag Avo::MODAL_FRAME_ID do %> - <% - url = Avo::Services::URIService.parse(avo.root_url.to_s) - .append_paths('resources', params[:resource_name], params[:id], params[:related_name]) - .append_query( - { - view: @resource&.view&.to_s, - for_attribute: @field&.try(:for_attribute) - }.compact - ) - .to_s - %> <%= form_with scope: 'fields', - url: url, + url: @url, local: true, data: { turbo_frame: :_top From 6ddca9eb8bd460bfe6da004f33775972eb1df530 Mon Sep 17 00:00:00 2001 From: Paul Bob Date: Sat, 28 Sep 2024 21:28:12 +0300 Subject: [PATCH 8/8] lint --- app/controllers/avo/associations_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/avo/associations_controller.rb b/app/controllers/avo/associations_controller.rb index a0f2df2205..fad9c69965 100644 --- a/app/controllers/avo/associations_controller.rb +++ b/app/controllers/avo/associations_controller.rb @@ -66,7 +66,7 @@ def new end @url = Avo::Services::URIService.parse(avo.root_url.to_s) - .append_paths('resources', params[:resource_name], params[:id], params[:related_name]) + .append_paths("resources", params[:resource_name], params[:id], params[:related_name]) .append_query( { view: @resource&.view&.to_s,