From 09b4270595baa9b273710999dffa9bac4b2a57e3 Mon Sep 17 00:00:00 2001 From: Szymon Newel <128865635+Nevelito@users.noreply.github.com> Date: Fri, 17 Jan 2025 09:21:42 +0100 Subject: [PATCH 01/63] enhancement: access to the `query` on all action blocks (#3581) * Append the record id's to the action link as params * fix bug * Add spec * Fix code for rubocop preferences * Delete empty line * Request changes and set query in base services to have access * small change * add action to test & adjustments * lint * test * test * extend query access to name --------- Co-authored-by: Paul Bob Co-authored-by: Paul Bob <69730720+Paul-Bob@users.noreply.github.com> --- app/controllers/avo/actions_controller.rb | 14 +++--- .../controllers/item_select_all_controller.js | 39 +++++++++++++++ lib/avo/base_action.rb | 16 ++++-- spec/dummy/app/avo/actions/test/query.rb | 23 +++++++++ spec/dummy/app/avo/resources/user.rb | 1 + spec/system/avo/actions_spec.rb | 50 +++++++++++++++++++ 6 files changed, 131 insertions(+), 12 deletions(-) create mode 100644 spec/dummy/app/avo/actions/test/query.rb diff --git a/app/controllers/avo/actions_controller.rb b/app/controllers/avo/actions_controller.rb index 71389fe746..256449902f 100644 --- a/app/controllers/avo/actions_controller.rb +++ b/app/controllers/avo/actions_controller.rb @@ -9,9 +9,8 @@ class ActionsController < ApplicationController # set_record will fail if it's tried to be used from the Index page. request.params[:id].present? end - before_action :set_action, only: [:show, :handle] - before_action :verify_authorization, only: [:show, :handle] - before_action :set_query, :set_fields, only: :handle + before_action :set_query, :set_action, :verify_authorization, only: [:show, :handle] + before_action :set_fields, only: :handle layout :choose_layout @@ -62,7 +61,7 @@ def handle private def set_query - resource_ids = action_params[:fields][:avo_resource_ids].split(",") + resource_ids = action_params[:fields]&.dig(:avo_resource_ids)&.split(",") || [] @query = decrypted_query || (resource_ids.any? ? @resource.find_record(resource_ids, params: params) : []) end @@ -72,7 +71,7 @@ def set_fields end def action_params - @action_params ||= params.permit(:id, :authenticity_token, :resource_name, :action_id, :button, fields: {}) + @action_params ||= params.permit(:id, :authenticity_token, :resource_name, :action_id, :button, :arguments, fields: {}) end def set_action @@ -82,7 +81,8 @@ def set_action user: _current_user, # force the action view to in order to render new-related fields (hidden field) view: Avo::ViewInquirer.new(:new), - arguments: BaseAction.decode_arguments(params[:arguments] || params.dig(:fields, :arguments)) || {} + arguments: BaseAction.decode_arguments(params[:arguments] || params.dig(:fields, :arguments)) || {}, + query: @query ) # Fetch action's fields @@ -171,7 +171,7 @@ def get_messages end def decrypted_query - return if (encrypted_query = action_params[:fields][:avo_selected_query]).blank? + return if (encrypted_query = action_params[:fields]&.dig(:avo_selected_query)).blank? Avo::Services::EncryptionService.decrypt(message: encrypted_query, purpose: :select_all, serializer: Marshal) end diff --git a/app/javascript/js/controllers/item_select_all_controller.js b/app/javascript/js/controllers/item_select_all_controller.js index 2fac63cd4d..32164bfacc 100644 --- a/app/javascript/js/controllers/item_select_all_controller.js +++ b/app/javascript/js/controllers/item_select_all_controller.js @@ -69,6 +69,8 @@ export default class extends Controller { this.selectAllOverlay(allSelected) this.resetUnselected() } + + this.updateLinks('resourceIds') } selectAll(event) { @@ -77,6 +79,43 @@ export default class extends Controller { this.selectedAllValue = !this.selectedAllValue this.unselectedMessageTarget.classList.toggle('hidden') this.selectedMessageTarget.classList.toggle('hidden') + + if (this.selectedAllValue) { + this.updateLinks('selectedQuery') + } else { + this.updateLinks('resourceIds') + } + } + + updateLinks(param) { + let resourceIds = '' + let selectedQuery = '' + + if (param === 'resourceIds') { + resourceIds = JSON.parse(this.element.dataset.selectedResources).join(',') + } else if (param === 'selectedQuery') { + selectedQuery = this.element.dataset.itemSelectAllSelectedAllQueryValue + } + + document.querySelectorAll('[data-target="actions-list"] > a').forEach((link) => { + try { + const url = new URL(link.href) + + Array.from(url.searchParams.keys()) + .filter((key) => key.startsWith('fields[')) + .forEach((key) => url.searchParams.delete(key)) + + if (param === 'resourceIds') { + url.searchParams.set('fields[avo_resource_ids]', resourceIds) + } else if (param === 'selectedQuery') { + url.searchParams.set('fields[avo_selected_query]', selectedQuery) + } + + link.href = url.toString() + } catch (error) { + console.error('Error updating link:', link, error) + } + }) } resetUnselected() { diff --git a/lib/avo/base_action.rb b/lib/avo/base_action.rb index 53641a6b8b..a444c9567c 100644 --- a/lib/avo/base_action.rb +++ b/lib/avo/base_action.rb @@ -25,6 +25,7 @@ class BaseAction attr_reader :icon attr_reader :appended_turbo_streams attr_reader :records_to_reload + attr_reader :query # TODO: find a differnet way to delegate this to the uninitialized Current variable delegate :context, to: Avo::Current @@ -96,14 +97,15 @@ def action_name resource: @resource, record: @record, view: @view, - arguments: @arguments + arguments: @arguments, + query: @query ).handle end self.class.to_s.demodulize.underscore.humanize(keep_id_suffix: true) end - def initialize(record: nil, resource: nil, user: nil, view: nil, arguments: {}, icon: :play) + def initialize(record: nil, resource: nil, user: nil, view: nil, arguments: {}, icon: :play, query: nil) @record = record @resource = resource @user = user @@ -114,6 +116,7 @@ def initialize(record: nil, resource: nil, user: nil, view: nil, arguments: {}, resource: resource, record: record ).handle.with_indifferent_access + @query = query self.class.message ||= I18n.t("avo.are_you_sure_you_want_to_run_this_option") self.class.confirm_button_label ||= I18n.t("avo.run") @@ -139,7 +142,8 @@ def get_message resource: @resource, record: @record, view: @view, - arguments: @arguments + arguments: @arguments, + query: @query ).handle end @@ -149,7 +153,8 @@ def cancel_button_label resource: @resource, record: @record, view: @view, - arguments: @arguments + arguments: @arguments, + query: @query ).handle end @@ -159,7 +164,8 @@ def confirm_button_label resource: @resource, record: @record, view: @view, - arguments: @arguments + arguments: @arguments, + query: @query ).handle end diff --git a/spec/dummy/app/avo/actions/test/query.rb b/spec/dummy/app/avo/actions/test/query.rb new file mode 100644 index 0000000000..564e6fce63 --- /dev/null +++ b/spec/dummy/app/avo/actions/test/query.rb @@ -0,0 +1,23 @@ +class Avo::Actions::Test::Query < Avo::BaseAction + self.name = -> { + "Test query access #{query&.count}" + } + self.message = -> { + "message #{query.count} selected" + } + self.cancel_button_label = -> { + "cancel_button_label #{query.count} selected" + } + self.confirm_button_label = -> { + "confirm_button_label #{query.count} selected" + } + self.standalone = true + + def fields + field :selected, default: "#{query.count} selected def fields" + end + + def handle(**args) + succeed "succeed #{query.count} selected" + end +end diff --git a/spec/dummy/app/avo/resources/user.rb b/spec/dummy/app/avo/resources/user.rb index a475a9300b..82d0fe4e4d 100644 --- a/spec/dummy/app/avo/resources/user.rb +++ b/spec/dummy/app/avo/resources/user.rb @@ -71,6 +71,7 @@ def actions divider label: "Other actions" action Avo::Actions::Sub::DummyAction action Avo::Actions::DownloadFile, icon: "heroicons/outline/arrow-left" + action Avo::Actions::Test::Query divider action Avo::Actions::Test::NoConfirmationPostsRedirect action Avo::Actions::Test::NoConfirmationRedirect diff --git a/spec/system/avo/actions_spec.rb b/spec/system/avo/actions_spec.rb index 384db2e34f..549c1cbaf6 100644 --- a/spec/system/avo/actions_spec.rb +++ b/spec/system/avo/actions_spec.rb @@ -304,6 +304,56 @@ end end + describe "query" do + let!(:users) { create_list :user, 6 } + + it "access query action show" do + visit avo.resources_users_path(per_page: 3) + + open_panel_action(action_name: "Test query access ") + + expect(page).to have_text("message 0 selected") + expect(page).to have_field("fields_selected", with: "0 selected def fields") + expect(page).to have_text("cancel_button_label 0 selected") + expect(page).to have_text("confirm_button_label 0 selected") + expect(page).to have_text("Test query access 0") + + run_action + + expect(page).to have_text("succeed 0 selected") + + check_select_all + open_panel_action(action_name: "Test query access ") + + expect(page).to have_text("message 3 selected") + expect(page).to have_field("fields_selected", with: "3 selected def fields") + expect(page).to have_text("cancel_button_label 3 selected") + expect(page).to have_text("confirm_button_label 3 selected") + expect(page).to have_text("Test query access 3") + + run_action + + expect(page).to have_text("succeed 3 selected") + + check_select_all + click_on "Select all matching" + + open_panel_action(action_name: "Test query access ") + + user_count = User.count + + expect(page).to have_text("message #{user_count} selected") + expect(page).to have_field("fields_selected", with: "#{user_count} selected def fields") + expect(page).to have_text("cancel_button_label #{user_count} selected") + expect(page).to have_text("confirm_button_label #{user_count} selected") + expect(page).to have_text("Test query access #{user_count}") + + run_action + + expect(page).to have_text("succeed #{user_count} selected") + end + end + describe "fields" do context "boolean group fields" do it "pass through fields params" do From 475e6d8fb671d83778e4580d5dcc1f4f0c92751d Mon Sep 17 00:00:00 2001 From: "depfu[bot]" <23717796+depfu[bot]@users.noreply.github.com> Date: Fri, 17 Jan 2025 12:32:41 +0200 Subject: [PATCH 02/63] [ruby] Update all Bundler dependencies (2025-01-16) (#3588) * Update all Bundler dependencies (2025-01-16) * lock 'concurrent-ruby' on '1.3.4' for rails 6.1 --------- Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com> Co-authored-by: Paul Bob <69730720+Paul-Bob@users.noreply.github.com> Co-authored-by: Paul Bob --- Appraisals | 6 ++++ Gemfile.lock | 33 +++++++++++----------- gemfiles/rails_6.1_ruby_3.1.4.gemfile | 1 + gemfiles/rails_6.1_ruby_3.1.4.gemfile.lock | 32 +++++++++++---------- gemfiles/rails_6.1_ruby_3.3.0.gemfile | 1 + gemfiles/rails_6.1_ruby_3.3.0.gemfile.lock | 23 +++++++-------- gemfiles/rails_7.1_ruby_3.1.4.gemfile.lock | 33 +++++++++++----------- gemfiles/rails_7.1_ruby_3.3.0.gemfile.lock | 24 ++++++++-------- gemfiles/rails_8.0_ruby_3.3.0.gemfile.lock | 24 ++++++++-------- 9 files changed, 95 insertions(+), 82 deletions(-) diff --git a/Appraisals b/Appraisals index d68c9d12ae..b8ba507b1e 100644 --- a/Appraisals +++ b/Appraisals @@ -9,6 +9,12 @@ gem "activestorage", "~> #{rails_version}" gem "activestorage" gem "acts-as-taggable-on" + + if rails_version == "6.1" + # Fix `': uninitialized constant ActiveSupport::LoggerThreadSafeLevel::Logger (NameError) + # https://stackoverflow.com/questions/79360526/uninitialized-constant-activesupportloggerthreadsafelevellogger-nameerror + gem "concurrent-ruby", "1.3.4" + end end end end diff --git a/Gemfile.lock b/Gemfile.lock index 8a0fa2569f..9cb42ac9b8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -107,7 +107,7 @@ GEM acts_as_list (1.2.4) activerecord (>= 6.1) activesupport (>= 6.1) - actual_db_schema (0.8.0) + actual_db_schema (0.8.1) activerecord activesupport csv @@ -126,20 +126,20 @@ GEM money-rails (~> 1.12) avo-record_link_field (0.0.2) aws-eventstream (1.3.0) - aws-partitions (1.1033.0) - aws-sdk-core (3.214.1) + aws-partitions (1.1038.0) + aws-sdk-core (3.216.0) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.992.0) aws-sigv4 (~> 1.9) jmespath (~> 1, >= 1.6.1) - aws-sdk-kms (1.96.0) - aws-sdk-core (~> 3, >= 3.210.0) + aws-sdk-kms (1.97.0) + aws-sdk-core (~> 3, >= 3.216.0) aws-sigv4 (~> 1.5) - aws-sdk-s3 (1.177.0) - aws-sdk-core (~> 3, >= 3.210.0) + aws-sdk-s3 (1.178.0) + aws-sdk-core (~> 3, >= 3.216.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.5) - aws-sigv4 (1.10.1) + aws-sigv4 (1.11.0) aws-eventstream (~> 1, >= 1.0.2) axiom-types (0.1.1) descendants_tracker (~> 0.0.4) @@ -178,7 +178,7 @@ GEM logger (~> 1.5) coercible (1.0.0) descendants_tracker (~> 0.0.1) - concurrent-ruby (1.3.4) + concurrent-ruby (1.3.5) connection_pool (2.5.0) countries (7.1.0) unaccent (~> 0.3) @@ -370,7 +370,7 @@ GEM listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - logger (1.6.4) + logger (1.6.5) loofah (2.24.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) @@ -496,10 +496,11 @@ GEM psych (>= 4.0.0) redis (5.3.0) redis-client (>= 0.22.0) - redis-client (0.23.0) + redis-client (0.23.1) connection_pool - reek (6.3.0) + reek (6.4.0) dry-schema (~> 1.13.0) + logger (~> 1.6) parser (~> 3.3.0) rainbow (>= 2.0, < 4.0) rexml (~> 3.1) @@ -532,7 +533,7 @@ GEM rspec-retry (0.6.2) rspec-core (> 3.3) rspec-support (3.13.2) - rubocop (1.69.2) + rubocop (1.70.0) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) @@ -615,10 +616,10 @@ GEM actionpack (>= 6.1) activesupport (>= 6.1) sprockets (>= 3.0.0) - standard (1.43.0) + standard (1.44.0) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.0) - rubocop (~> 1.69.1) + rubocop (~> 1.70.0) standard-custom (~> 1.0.0) standard-performance (~> 1.6) standard-custom (1.0.2) @@ -635,7 +636,7 @@ GEM test-prof (1.4.4) thor (1.3.2) thread_safe (0.3.6) - tilt (2.5.0) + tilt (2.6.0) timeout (0.4.3) tty-which (0.5.0) turbo-rails (2.0.11) diff --git a/gemfiles/rails_6.1_ruby_3.1.4.gemfile b/gemfiles/rails_6.1_ruby_3.1.4.gemfile index 3efa925762..b31e8a466c 100644 --- a/gemfiles/rails_6.1_ruby_3.1.4.gemfile +++ b/gemfiles/rails_6.1_ruby_3.1.4.gemfile @@ -46,6 +46,7 @@ gem "avo-record_link_field" gem "pagy", "> 8" gem "csv" gem "psych", "< 4" +gem "concurrent-ruby", "1.3.4" group :development do gem "standard", require: false 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 ff5b510e1d..11e1d3551a 100644 --- a/gemfiles/rails_6.1_ruby_3.1.4.gemfile.lock +++ b/gemfiles/rails_6.1_ruby_3.1.4.gemfile.lock @@ -94,7 +94,7 @@ GEM acts_as_list (1.2.4) activerecord (>= 6.1) activesupport (>= 6.1) - actual_db_schema (0.8.0) + actual_db_schema (0.8.1) activerecord activesupport csv @@ -113,20 +113,20 @@ GEM money-rails (~> 1.12) avo-record_link_field (0.0.2) aws-eventstream (1.3.0) - aws-partitions (1.1033.0) - aws-sdk-core (3.214.1) + aws-partitions (1.1038.0) + aws-sdk-core (3.216.0) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.992.0) aws-sigv4 (~> 1.9) jmespath (~> 1, >= 1.6.1) - aws-sdk-kms (1.96.0) - aws-sdk-core (~> 3, >= 3.210.0) + aws-sdk-kms (1.97.0) + aws-sdk-core (~> 3, >= 3.216.0) aws-sigv4 (~> 1.5) - aws-sdk-s3 (1.177.0) - aws-sdk-core (~> 3, >= 3.210.0) + aws-sdk-s3 (1.178.0) + aws-sdk-core (~> 3, >= 3.216.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.5) - aws-sigv4 (1.10.1) + aws-sigv4 (1.11.0) aws-eventstream (~> 1, >= 1.0.2) axiom-types (0.1.1) descendants_tracker (~> 0.0.4) @@ -356,7 +356,7 @@ GEM listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - logger (1.6.4) + logger (1.6.5) loofah (2.24.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) @@ -473,10 +473,11 @@ GEM rdoc (6.3.4.1) redis (5.3.0) redis-client (>= 0.22.0) - redis-client (0.23.0) + redis-client (0.23.1) connection_pool - reek (6.3.0) + reek (6.4.0) dry-schema (~> 1.13.0) + logger (~> 1.6) parser (~> 3.3.0) rainbow (>= 2.0, < 4.0) rexml (~> 3.1) @@ -509,7 +510,7 @@ GEM rspec-retry (0.6.2) rspec-core (> 3.3) rspec-support (3.13.2) - rubocop (1.69.2) + rubocop (1.70.0) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) @@ -591,10 +592,10 @@ GEM actionpack (>= 6.1) activesupport (>= 6.1) sprockets (>= 3.0.0) - standard (1.43.0) + standard (1.44.0) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.0) - rubocop (~> 1.69.1) + rubocop (~> 1.70.0) standard-custom (~> 1.0.0) standard-performance (~> 1.6) standard-custom (1.0.2) @@ -610,7 +611,7 @@ GEM test-prof (1.4.4) thor (1.3.2) thread_safe (0.3.6) - tilt (2.5.0) + tilt (2.6.0) timeout (0.4.3) tty-which (0.5.0) turbo-rails (2.0.11) @@ -676,6 +677,7 @@ DEPENDENCIES bundler-integrity (~> 1.0) capybara chartkick + concurrent-ruby (= 1.3.4) countries cssbundling-rails csv diff --git a/gemfiles/rails_6.1_ruby_3.3.0.gemfile b/gemfiles/rails_6.1_ruby_3.3.0.gemfile index 3efa925762..b31e8a466c 100644 --- a/gemfiles/rails_6.1_ruby_3.3.0.gemfile +++ b/gemfiles/rails_6.1_ruby_3.3.0.gemfile @@ -46,6 +46,7 @@ gem "avo-record_link_field" gem "pagy", "> 8" gem "csv" gem "psych", "< 4" +gem "concurrent-ruby", "1.3.4" group :development do gem "standard", require: false 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 cdb920bd98..db251dfd56 100644 --- a/gemfiles/rails_6.1_ruby_3.3.0.gemfile.lock +++ b/gemfiles/rails_6.1_ruby_3.3.0.gemfile.lock @@ -94,7 +94,7 @@ GEM acts_as_list (1.2.4) activerecord (>= 6.1) activesupport (>= 6.1) - actual_db_schema (0.8.0) + actual_db_schema (0.8.1) activerecord activesupport csv @@ -113,20 +113,20 @@ GEM money-rails (~> 1.12) avo-record_link_field (0.0.2) aws-eventstream (1.3.0) - aws-partitions (1.1033.0) - aws-sdk-core (3.214.1) + aws-partitions (1.1038.0) + aws-sdk-core (3.216.0) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.992.0) aws-sigv4 (~> 1.9) jmespath (~> 1, >= 1.6.1) - aws-sdk-kms (1.96.0) - aws-sdk-core (~> 3, >= 3.210.0) + aws-sdk-kms (1.97.0) + aws-sdk-core (~> 3, >= 3.216.0) aws-sigv4 (~> 1.5) - aws-sdk-s3 (1.177.0) - aws-sdk-core (~> 3, >= 3.210.0) + aws-sdk-s3 (1.178.0) + aws-sdk-core (~> 3, >= 3.216.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.5) - aws-sigv4 (1.10.1) + aws-sigv4 (1.11.0) aws-eventstream (~> 1, >= 1.0.2) axiom-types (0.1.1) descendants_tracker (~> 0.0.4) @@ -328,7 +328,7 @@ GEM listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - logger (1.6.4) + logger (1.6.5) loofah (2.24.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) @@ -445,7 +445,7 @@ GEM rdoc (6.3.4.1) redis (5.3.0) redis-client (>= 0.22.0) - redis-client (0.23.0) + redis-client (0.23.1) connection_pool reek (6.1.4) kwalify (~> 0.7.0) @@ -582,7 +582,7 @@ GEM test-prof (1.4.4) thor (1.3.2) thread_safe (0.3.6) - tilt (2.5.0) + tilt (2.6.0) timeout (0.4.3) tty-which (0.5.0) turbo-rails (2.0.11) @@ -648,6 +648,7 @@ DEPENDENCIES bundler-integrity (~> 1.0) capybara chartkick + concurrent-ruby (= 1.3.4) countries cssbundling-rails csv 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 11e68b0520..e5b3932d97 100644 --- a/gemfiles/rails_7.1_ruby_3.1.4.gemfile.lock +++ b/gemfiles/rails_7.1_ruby_3.1.4.gemfile.lock @@ -107,7 +107,7 @@ GEM acts_as_list (1.2.4) activerecord (>= 6.1) activesupport (>= 6.1) - actual_db_schema (0.8.0) + actual_db_schema (0.8.1) activerecord activesupport csv @@ -126,20 +126,20 @@ GEM money-rails (~> 1.12) avo-record_link_field (0.0.2) aws-eventstream (1.3.0) - aws-partitions (1.1033.0) - aws-sdk-core (3.214.1) + aws-partitions (1.1038.0) + aws-sdk-core (3.216.0) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.992.0) aws-sigv4 (~> 1.9) jmespath (~> 1, >= 1.6.1) - aws-sdk-kms (1.96.0) - aws-sdk-core (~> 3, >= 3.210.0) + aws-sdk-kms (1.97.0) + aws-sdk-core (~> 3, >= 3.216.0) aws-sigv4 (~> 1.5) - aws-sdk-s3 (1.177.0) - aws-sdk-core (~> 3, >= 3.210.0) + aws-sdk-s3 (1.178.0) + aws-sdk-core (~> 3, >= 3.216.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.5) - aws-sigv4 (1.10.1) + aws-sigv4 (1.11.0) aws-eventstream (~> 1, >= 1.0.2) axiom-types (0.1.1) descendants_tracker (~> 0.0.4) @@ -178,7 +178,7 @@ GEM logger (~> 1.5) coercible (1.0.0) descendants_tracker (~> 0.0.1) - concurrent-ruby (1.3.4) + concurrent-ruby (1.3.5) connection_pool (2.5.0) countries (7.1.0) unaccent (~> 0.3) @@ -370,7 +370,7 @@ GEM listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - logger (1.6.4) + logger (1.6.5) loofah (2.24.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) @@ -493,10 +493,11 @@ GEM rdoc (6.3.4.1) redis (5.3.0) redis-client (>= 0.22.0) - redis-client (0.23.0) + redis-client (0.23.1) connection_pool - reek (6.3.0) + reek (6.4.0) dry-schema (~> 1.13.0) + logger (~> 1.6) parser (~> 3.3.0) rainbow (>= 2.0, < 4.0) rexml (~> 3.1) @@ -529,7 +530,7 @@ GEM rspec-retry (0.6.2) rspec-core (> 3.3) rspec-support (3.13.2) - rubocop (1.69.2) + rubocop (1.70.0) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) @@ -612,10 +613,10 @@ GEM actionpack (>= 6.1) activesupport (>= 6.1) sprockets (>= 3.0.0) - standard (1.43.0) + standard (1.44.0) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.0) - rubocop (~> 1.69.1) + rubocop (~> 1.70.0) standard-custom (~> 1.0.0) standard-performance (~> 1.6) standard-custom (1.0.2) @@ -631,7 +632,7 @@ GEM test-prof (1.4.4) thor (1.3.2) thread_safe (0.3.6) - tilt (2.5.0) + tilt (2.6.0) timeout (0.4.3) tty-which (0.5.0) turbo-rails (2.0.11) 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 c2049a0fb0..39b47ba54d 100644 --- a/gemfiles/rails_7.1_ruby_3.3.0.gemfile.lock +++ b/gemfiles/rails_7.1_ruby_3.3.0.gemfile.lock @@ -107,7 +107,7 @@ GEM acts_as_list (1.2.4) activerecord (>= 6.1) activesupport (>= 6.1) - actual_db_schema (0.8.0) + actual_db_schema (0.8.1) activerecord activesupport csv @@ -126,20 +126,20 @@ GEM money-rails (~> 1.12) avo-record_link_field (0.0.2) aws-eventstream (1.3.0) - aws-partitions (1.1033.0) - aws-sdk-core (3.214.1) + aws-partitions (1.1038.0) + aws-sdk-core (3.216.0) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.992.0) aws-sigv4 (~> 1.9) jmespath (~> 1, >= 1.6.1) - aws-sdk-kms (1.96.0) - aws-sdk-core (~> 3, >= 3.210.0) + aws-sdk-kms (1.97.0) + aws-sdk-core (~> 3, >= 3.216.0) aws-sigv4 (~> 1.5) - aws-sdk-s3 (1.177.0) - aws-sdk-core (~> 3, >= 3.210.0) + aws-sdk-s3 (1.178.0) + aws-sdk-core (~> 3, >= 3.216.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.5) - aws-sigv4 (1.10.1) + aws-sigv4 (1.11.0) aws-eventstream (~> 1, >= 1.0.2) axiom-types (0.1.1) descendants_tracker (~> 0.0.4) @@ -178,7 +178,7 @@ GEM logger (~> 1.5) coercible (1.0.0) descendants_tracker (~> 0.0.1) - concurrent-ruby (1.3.4) + concurrent-ruby (1.3.5) connection_pool (2.5.0) countries (7.1.0) unaccent (~> 0.3) @@ -342,7 +342,7 @@ GEM listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - logger (1.6.4) + logger (1.6.5) loofah (2.24.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) @@ -465,7 +465,7 @@ GEM rdoc (6.3.4.1) redis (5.3.0) redis-client (>= 0.22.0) - redis-client (0.23.0) + redis-client (0.23.1) connection_pool reek (6.1.4) kwalify (~> 0.7.0) @@ -603,7 +603,7 @@ GEM test-prof (1.4.4) thor (1.3.2) thread_safe (0.3.6) - tilt (2.5.0) + tilt (2.6.0) timeout (0.4.3) tty-which (0.5.0) turbo-rails (2.0.11) diff --git a/gemfiles/rails_8.0_ruby_3.3.0.gemfile.lock b/gemfiles/rails_8.0_ruby_3.3.0.gemfile.lock index b498df40e7..8fdb38e20a 100644 --- a/gemfiles/rails_8.0_ruby_3.3.0.gemfile.lock +++ b/gemfiles/rails_8.0_ruby_3.3.0.gemfile.lock @@ -107,7 +107,7 @@ GEM acts_as_list (1.2.4) activerecord (>= 6.1) activesupport (>= 6.1) - actual_db_schema (0.8.0) + actual_db_schema (0.8.1) activerecord activesupport csv @@ -126,20 +126,20 @@ GEM money-rails (~> 1.12) avo-record_link_field (0.0.2) aws-eventstream (1.3.0) - aws-partitions (1.1033.0) - aws-sdk-core (3.214.1) + aws-partitions (1.1038.0) + aws-sdk-core (3.216.0) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.992.0) aws-sigv4 (~> 1.9) jmespath (~> 1, >= 1.6.1) - aws-sdk-kms (1.96.0) - aws-sdk-core (~> 3, >= 3.210.0) + aws-sdk-kms (1.97.0) + aws-sdk-core (~> 3, >= 3.216.0) aws-sigv4 (~> 1.5) - aws-sdk-s3 (1.177.0) - aws-sdk-core (~> 3, >= 3.210.0) + aws-sdk-s3 (1.178.0) + aws-sdk-core (~> 3, >= 3.216.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.5) - aws-sigv4 (1.10.1) + aws-sigv4 (1.11.0) aws-eventstream (~> 1, >= 1.0.2) axiom-types (0.1.1) descendants_tracker (~> 0.0.4) @@ -178,7 +178,7 @@ GEM logger (~> 1.5) coercible (1.0.0) descendants_tracker (~> 0.0.1) - concurrent-ruby (1.3.4) + concurrent-ruby (1.3.5) connection_pool (2.5.0) countries (7.1.0) unaccent (~> 0.3) @@ -342,7 +342,7 @@ GEM listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - logger (1.6.4) + logger (1.6.5) loofah (2.24.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) @@ -465,7 +465,7 @@ GEM rdoc (6.3.4.1) redis (5.3.0) redis-client (>= 0.22.0) - redis-client (0.23.0) + redis-client (0.23.1) connection_pool reek (6.1.4) kwalify (~> 0.7.0) @@ -603,7 +603,7 @@ GEM test-prof (1.4.4) thor (1.3.2) thread_safe (0.3.6) - tilt (2.5.0) + tilt (2.6.0) timeout (0.4.3) tty-which (0.5.0) turbo-rails (2.0.11) From 1ec4e07ba8d76903aba1d98fd566e1618d06e6da Mon Sep 17 00:00:00 2001 From: Julian Rubisch Date: Mon, 20 Jan 2025 09:24:25 +0100 Subject: [PATCH 03/63] feat: Add disabled prop to ProfileItemComponent (#3589) --- app/components/avo/profile_item_component.html.erb | 1 + app/components/avo/profile_item_component.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/app/components/avo/profile_item_component.html.erb b/app/components/avo/profile_item_component.html.erb index bf093f6859..b97119becb 100644 --- a/app/components/avo/profile_item_component.html.erb +++ b/app/components/avo/profile_item_component.html.erb @@ -5,6 +5,7 @@ target: target, title: title, method: method, + disabled: disabled, params: params do %> <%= helpers.svg(icon, class: 'h-4 mr-1') if icon.present? %> <%= label %> <% end %> diff --git a/app/components/avo/profile_item_component.rb b/app/components/avo/profile_item_component.rb index 16567d40bc..a719345290 100644 --- a/app/components/avo/profile_item_component.rb +++ b/app/components/avo/profile_item_component.rb @@ -12,6 +12,7 @@ class Avo::ProfileItemComponent < Avo::BaseComponent end prop :title, reader: :public prop :method, reader: :public + prop :disabled, reader: :public prop :params, default: {}.freeze, reader: :public prop :classes, default: "", reader: :public From 3dfd9e7c5b58045cb58ab92423610e926452aeea Mon Sep 17 00:00:00 2001 From: Szymon Newel <128865635+Nevelito@users.noreply.github.com> Date: Mon, 20 Jan 2025 12:36:53 +0100 Subject: [PATCH 04/63] Add `mapkick_options` to location field (#3593) * Add mapkick options to location field * Delete spec * Fix alignment --- .../avo/fields/location_field/show_component.html.erb | 2 +- lib/avo/fields/location_field.rb | 2 ++ spec/dummy/app/avo/resources/city.rb | 9 ++++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/components/avo/fields/location_field/show_component.html.erb b/app/components/avo/fields/location_field/show_component.html.erb index acd773d788..e67862e231 100644 --- a/app/components/avo/fields/location_field/show_component.html.erb +++ b/app/components/avo/fields/location_field/show_component.html.erb @@ -1,6 +1,6 @@ <%= field_wrapper **field_wrapper_args do %> <% if field.value_present? %> - <%= js_map [{latitude: field.value[0], longitude: field.value[1]}], id: "location-map", zoom: field.zoom, controls: true %> + <%= js_map [{latitude: field.value[0], longitude: field.value[1]}], id: "location-map", zoom: field.zoom, controls: true, **field.mapkick_options %> <% else %> — <% end %> diff --git a/lib/avo/fields/location_field.rb b/lib/avo/fields/location_field.rb index e92954c1c0..45a492d125 100644 --- a/lib/avo/fields/location_field.rb +++ b/lib/avo/fields/location_field.rb @@ -3,6 +3,7 @@ module Avo module Fields class LocationField < BaseField + attr_reader :mapkick_options attr_reader :stored_as, :zoom def initialize(id, **args, &block) @@ -10,6 +11,7 @@ def initialize(id, **args, &block) super(id, **args, &block) @stored_as = args[:stored_as].present? ? args[:stored_as] : nil # You can pass it an array of db columns [:latitude, :longitude] + @mapkick_options = args[:mapkick_options].presence || {} @zoom = args[:zoom].present? ? args[:zoom].to_i : 15 end diff --git a/spec/dummy/app/avo/resources/city.rb b/spec/dummy/app/avo/resources/city.rb index b9fdc9087b..557e18faa9 100644 --- a/spec/dummy/app/avo/resources/city.rb +++ b/spec/dummy/app/avo/resources/city.rb @@ -36,7 +36,14 @@ class Avo::Resources::City < Avo::BaseResource def base_fields field :id, as: :id - field :coordinates, as: :location, stored_as: [:latitude, :longitude] + field :coordinates, + as: :location, + stored_as: [:latitude, :longitude], + mapkick_options: { + style: "mapbox://styles/mapbox/satellite-v9", + controls: true, + markers: {color: "#FFC0CB"} + } field :city_center_area, as: :area, geometry: :polygon, From 041d00fd5a5ad1141814ad4f5cf02fe1db11760a Mon Sep 17 00:00:00 2001 From: Paul Bob <69730720+Paul-Bob@users.noreply.github.com> Date: Mon, 20 Jan 2025 17:03:11 +0200 Subject: [PATCH 05/63] refactor: fields mapping refactor (#3595) * Add .ruby-version file * chore: Set up Avo Meta * test: Write system test for happy path of creating a new schema entry * chore: Extract Avo::Mappings module with constants * chore: Reflect changes from avo-meta (look up field type) * chore: Test meta default values * chore: Test backfilling meta default values * wip * schema * lint --------- Co-authored-by: Julian Rubisch --- .gitignore | 1 + db/factories.rb | 2 +- lib/avo/mappings.rb | 113 ++++++++++++++++++++++ lib/generators/avo/resource_generator.rb | 115 +---------------------- 4 files changed, 118 insertions(+), 113 deletions(-) create mode 100644 lib/avo/mappings.rb diff --git a/.gitignore b/.gitignore index 8e5fdcceb7..72c37ca3c3 100644 --- a/.gitignore +++ b/.gitignore @@ -77,3 +77,4 @@ brakeman_results.html .env .env.test +*~ diff --git a/db/factories.rb b/db/factories.rb index a9541adbd6..15cc6c10de 100644 --- a/db/factories.rb +++ b/db/factories.rb @@ -37,7 +37,7 @@ factory :project do name { Faker::App.name } - status { ['closed', :rejected, :failed, 'loading', :running, :waiting].sample } + status { ["closed", :rejected, :failed, "loading", :running, :waiting].sample } stage { ["Discovery", "Idea", "Done", "On hold", "Cancelled", "Drafting"].sample } budget { Faker::Number.decimal(l_digits: 4) } country { Faker::Address.country_code } diff --git a/lib/avo/mappings.rb b/lib/avo/mappings.rb new file mode 100644 index 0000000000..8723320b67 --- /dev/null +++ b/lib/avo/mappings.rb @@ -0,0 +1,113 @@ +module Avo + module Mappings + unless defined?(ASSOCIATIONS_MAPPING) + ASSOCIATIONS_MAPPING = { + ActiveRecord::Reflection::BelongsToReflection => { + field: "belongs_to" + }, + ActiveRecord::Reflection::HasOneReflection => { + field: "has_one" + }, + ActiveRecord::Reflection::HasManyReflection => { + field: "has_many" + }, + ActiveRecord::Reflection::HasAndBelongsToManyReflection => { + field: "has_and_belongs_to_many" + } + }.freeze + end + + unless defined?(ATTACHMENTS_MAPPING) + ATTACHMENTS_MAPPING = { + ActiveRecord::Reflection::HasOneReflection => { + field: "file" + }, + ActiveRecord::Reflection::HasManyReflection => { + field: "files" + } + }.freeze + end + + unless defined?(FIELDS_MAPPING) + FIELDS_MAPPING = { + primary_key: { + field: "id" + }, + string: { + field: "text" + }, + text: { + field: "textarea" + }, + integer: { + field: "number" + }, + float: { + field: "number" + }, + decimal: { + field: "number" + }, + datetime: { + field: "date_time" + }, + timestamp: { + field: "date_time" + }, + time: { + field: "date_time" + }, + date: { + field: "date" + }, + binary: { + field: "number" + }, + boolean: { + field: "boolean" + }, + references: { + field: "belongs_to" + }, + json: { + field: "code" + } + }.freeze + end + + unless defined?(NAMES_MAPPING) + NAMES_MAPPING = { + id: { + field: "id" + }, + description: { + field: "textarea" + }, + gravatar: { + field: "gravatar" + }, + email: { + field: "text" + }, + password: { + field: "password" + }, + password_confirmation: { + field: "password" + }, + stage: { + field: "select" + }, + budget: { + field: "currency" + }, + money: { + field: "currency" + }, + country: { + field: "country" + } + }.freeze + end + end +end diff --git a/lib/generators/avo/resource_generator.rb b/lib/generators/avo/resource_generator.rb index d67559bbf5..160aa1970f 100644 --- a/lib/generators/avo/resource_generator.rb +++ b/lib/generators/avo/resource_generator.rb @@ -175,7 +175,7 @@ def fields_from_model_associations fields[name] = if association.is_a? ActiveRecord::Reflection::ThroughReflection field_from_through_association(association) else - associations_mapping[association.class] + ::Avo::Mappings::ASSOCIATIONS_MAPPING[association.class] end end end @@ -198,7 +198,7 @@ def field_from_through_association(association) def fields_from_model_attachements attachments.each do |name, attachment| - fields[remove_last_word_from name] = attachments_mapping[attachment.class] + fields[remove_last_word_from name] = ::Avo::Mappings::ATTACHMENTS_MAPPING[attachment.class] end end @@ -228,115 +228,6 @@ def fields_from_model_db_columns end end - def associations_mapping - { - ActiveRecord::Reflection::BelongsToReflection => { - field: "belongs_to" - }, - ActiveRecord::Reflection::HasOneReflection => { - field: "has_one" - }, - ActiveRecord::Reflection::HasManyReflection => { - field: "has_many" - }, - ActiveRecord::Reflection::HasAndBelongsToManyReflection => { - field: "has_and_belongs_to_many" - } - } - end - - def attachments_mapping - { - ActiveRecord::Reflection::HasOneReflection => { - field: "file" - }, - ActiveRecord::Reflection::HasManyReflection => { - field: "files" - } - } - end - - def names_mapping - { - id: { - field: "id" - }, - description: { - field: "textarea" - }, - gravatar: { - field: "gravatar" - }, - email: { - field: "text" - }, - password: { - field: "password" - }, - password_confirmation: { - field: "password" - }, - stage: { - field: "select" - }, - budget: { - field: "currency" - }, - money: { - field: "currency" - }, - country: { - field: "country" - } - } - end - - def fields_mapping - { - primary_key: { - field: "id" - }, - string: { - field: "text" - }, - text: { - field: "textarea" - }, - integer: { - field: "number" - }, - float: { - field: "number" - }, - decimal: { - field: "number" - }, - datetime: { - field: "date_time" - }, - timestamp: { - field: "date_time" - }, - time: { - field: "date_time" - }, - date: { - field: "date" - }, - binary: { - field: "number" - }, - boolean: { - field: "boolean" - }, - references: { - field: "belongs_to" - }, - json: { - field: "code" - } - } - end def generate_fields return generate_fields_from_args if invoked_by_model_generator? return unless can_connect_to_the_database? @@ -385,7 +276,7 @@ def generate_fields_from_args end def field(name, type) - names_mapping[name.to_sym] || fields_mapping[type&.to_sym] || {field: "text"} + ::Avo::Mappings::NAMES_MAPPING[name.to_sym] || ::Avo::Mappings::FIELDS_MAPPING[type&.to_sym] || {field: "text"} end end end From 20a3646dab09046d57cb9aa93424ad8405035ded Mon Sep 17 00:00:00 2001 From: Iain Beeston Date: Tue, 21 Jan 2025 18:57:19 +0000 Subject: [PATCH 06/63] Fixed argument prefix warnings (#3594) If I run an app using avo with warnings enabled I get a LOT of warnings like this: avo-3.16.1/app/components/avo/fields/files_field/edit_component.html.erb:1: warning: `**' interpreted as argument prefix This is happening because a function is being called with `**` as the first argument but there are no brackets around the arguments. Adding brackets fixes the warning but it does not change the meaning, so I've done that for all field components. --- .../avo/fields/area_field/edit_component.html.erb | 2 +- .../avo/fields/area_field/show_component.html.erb | 2 +- .../avo/fields/badge_field/index_component.html.erb | 2 +- .../avo/fields/badge_field/show_component.html.erb | 2 +- .../avo/fields/belongs_to_field/edit_component.html.erb | 6 +++--- .../avo/fields/belongs_to_field/index_component.html.erb | 2 +- .../avo/fields/belongs_to_field/show_component.html.erb | 2 +- .../avo/fields/boolean_field/edit_component.html.erb | 2 +- .../avo/fields/boolean_field/index_component.html.erb | 2 +- .../avo/fields/boolean_field/show_component.html.erb | 2 +- .../avo/fields/boolean_group_field/edit_component.html.erb | 2 +- .../avo/fields/boolean_group_field/index_component.html.erb | 2 +- .../avo/fields/boolean_group_field/show_component.html.erb | 2 +- .../avo/fields/code_field/edit_component.html.erb | 2 +- .../avo/fields/code_field/show_component.html.erb | 2 +- .../avo/fields/country_field/edit_component.html.erb | 2 +- .../avo/fields/country_field/index_component.html.erb | 2 +- .../avo/fields/country_field/show_component.html.erb | 2 +- .../avo/fields/date_field/edit_component.html.erb | 2 +- .../avo/fields/date_field/index_component.html.erb | 2 +- .../avo/fields/date_field/show_component.html.erb | 2 +- .../avo/fields/date_time_field/edit_component.html.erb | 2 +- .../avo/fields/date_time_field/index_component.html.erb | 2 +- .../avo/fields/date_time_field/show_component.html.erb | 2 +- .../avo/fields/external_image_field/edit_component.html.erb | 2 +- .../fields/external_image_field/index_component.html.erb | 2 +- .../avo/fields/external_image_field/show_component.html.erb | 2 +- .../avo/fields/file_field/edit_component.html.erb | 2 +- .../avo/fields/file_field/index_component.html.erb | 2 +- .../avo/fields/file_field/show_component.html.erb | 2 +- .../avo/fields/files_field/edit_component.html.erb | 2 +- .../avo/fields/files_field/index_component.html.erb | 2 +- .../avo/fields/files_field/show_component.html.erb | 2 +- .../avo/fields/gravatar_field/index_component.html.erb | 2 +- .../avo/fields/gravatar_field/show_component.html.erb | 2 +- .../avo/fields/has_one_field/index_component.html.erb | 2 +- app/components/avo/fields/id_field/edit_component.html.erb | 2 +- app/components/avo/fields/id_field/index_component.html.erb | 2 +- app/components/avo/fields/id_field/show_component.html.erb | 2 +- .../avo/fields/key_value_field/edit_component.html.erb | 2 +- .../avo/fields/key_value_field/show_component.html.erb | 2 +- .../avo/fields/location_field/edit_component.html.erb | 2 +- .../avo/fields/location_field/show_component.html.erb | 2 +- .../avo/fields/markdown_field/edit_component.html.erb | 2 +- .../avo/fields/markdown_field/show_component.html.erb | 2 +- .../avo/fields/number_field/edit_component.html.erb | 2 +- .../avo/fields/number_field/index_component.html.erb | 2 +- .../avo/fields/number_field/show_component.html.erb | 2 +- .../avo/fields/password_field/edit_component.html.erb | 2 +- .../avo/fields/preview_field/index_component.html.erb | 2 +- .../avo/fields/progress_bar_field/edit_component.html.erb | 2 +- .../avo/fields/progress_bar_field/index_component.html.erb | 2 +- .../avo/fields/progress_bar_field/show_component.html.erb | 2 +- .../avo/fields/radio_field/edit_component.html.erb | 2 +- .../avo/fields/radio_field/index_component.html.erb | 2 +- .../avo/fields/radio_field/show_component.html.erb | 2 +- .../avo/fields/select_field/edit_component.html.erb | 2 +- .../avo/fields/select_field/index_component.html.erb | 2 +- .../avo/fields/select_field/show_component.html.erb | 2 +- .../avo/fields/status_field/edit_component.html.erb | 2 +- .../avo/fields/status_field/index_component.html.erb | 2 +- .../avo/fields/status_field/show_component.html.erb | 2 +- .../avo/fields/tags_field/edit_component.html.erb | 4 ++-- .../avo/fields/tags_field/index_component.html.erb | 2 +- .../avo/fields/tags_field/show_component.html.erb | 2 +- .../avo/fields/text_field/edit_component.html.erb | 2 +- .../avo/fields/text_field/index_component.html.erb | 2 +- .../avo/fields/text_field/show_component.html.erb | 2 +- .../avo/fields/textarea_field/edit_component.html.erb | 2 +- .../avo/fields/textarea_field/show_component.html.erb | 2 +- .../avo/fields/time_field/edit_component.html.erb | 2 +- .../avo/fields/time_field/index_component.html.erb | 2 +- .../avo/fields/time_field/show_component.html.erb | 2 +- .../avo/fields/tiptap_field/edit_component.html.erb | 2 +- .../avo/fields/tiptap_field/show_component.html.erb | 2 +- .../avo/fields/trix_field/edit_component.html.erb | 2 +- .../avo/fields/trix_field/show_component.html.erb | 2 +- 77 files changed, 80 insertions(+), 80 deletions(-) diff --git a/app/components/avo/fields/area_field/edit_component.html.erb b/app/components/avo/fields/area_field/edit_component.html.erb index 28ffcb87e8..5b410aa6d1 100644 --- a/app/components/avo/fields/area_field/edit_component.html.erb +++ b/app/components/avo/fields/area_field/edit_component.html.erb @@ -1,4 +1,4 @@ -<%= field_wrapper **field_wrapper_args do %> +<%= field_wrapper(**field_wrapper_args) do %> <%= @form.text_field field.id, value: field.value.to_s, class: classes("w-full"), diff --git a/app/components/avo/fields/area_field/show_component.html.erb b/app/components/avo/fields/area_field/show_component.html.erb index f4377507c7..0466bf9de5 100644 --- a/app/components/avo/fields/area_field/show_component.html.erb +++ b/app/components/avo/fields/area_field/show_component.html.erb @@ -1,4 +1,4 @@ -<%= field_wrapper **field_wrapper_args do %> +<%= field_wrapper(**field_wrapper_args) do %> <% if field.value.present? %> <%= area_map field.map_data, **field.mapkick_options %> <% else %> diff --git a/app/components/avo/fields/badge_field/index_component.html.erb b/app/components/avo/fields/badge_field/index_component.html.erb index 4fdf9e07b1..6d137ecb98 100644 --- a/app/components/avo/fields/badge_field/index_component.html.erb +++ b/app/components/avo/fields/badge_field/index_component.html.erb @@ -1,3 +1,3 @@ -<%= index_field_wrapper **field_wrapper_args, flush: true do %> +<%= index_field_wrapper(**field_wrapper_args, flush: true) do %> <%= render Avo::Fields::Common::BadgeViewerComponent.new value: @field.value, options: @field.options %> <% end %> diff --git a/app/components/avo/fields/badge_field/show_component.html.erb b/app/components/avo/fields/badge_field/show_component.html.erb index 461a7b8bbe..b18ed6fded 100644 --- a/app/components/avo/fields/badge_field/show_component.html.erb +++ b/app/components/avo/fields/badge_field/show_component.html.erb @@ -1,3 +1,3 @@ -<%= field_wrapper **field_wrapper_args do %> +<%= field_wrapper(**field_wrapper_args) do %> <%= render Avo::Fields::Common::BadgeViewerComponent.new value: @field.value, options: @field.options %> <% end %> diff --git a/app/components/avo/fields/belongs_to_field/edit_component.html.erb b/app/components/avo/fields/belongs_to_field/edit_component.html.erb index b38be635bd..5d7a30e362 100644 --- a/app/components/avo/fields/belongs_to_field/edit_component.html.erb +++ b/app/components/avo/fields/belongs_to_field/edit_component.html.erb @@ -5,7 +5,7 @@ data-association="<%= @field.id %>" data-association-class="<%= @field&.target_resource&.model_class || nil %>" > - <%= field_wrapper **field_wrapper_args, label_for: @field.polymorphic_form_field_label, help: @field.polymorphic_help || '' do %> + <%= field_wrapper(**field_wrapper_args, label_for: @field.polymorphic_form_field_label, help: @field.polymorphic_help || '') do %> <%= @form.select @field.type_input_foreign_key, @field.types.map { |type| [Avo.resource_manager.get_resource_by_model_class(type.to_s).name, type.to_s] }, { value: @field.value, @@ -32,7 +32,7 @@ <% @field.types.each do |type| %>