diff --git a/admin/app/components/solidus_admin/adjustment_reasons/edit/component.html.erb b/admin/app/components/solidus_admin/adjustment_reasons/edit/component.html.erb index 2ffda1726c3..e69772be33d 100644 --- a/admin/app/components/solidus_admin/adjustment_reasons/edit/component.html.erb +++ b/admin/app/components/solidus_admin/adjustment_reasons/edit/component.html.erb @@ -24,4 +24,3 @@ <% end %> <% end %> <% end %> -<%= render component("adjustment_reasons/index").new(page: @page) %> diff --git a/admin/app/components/solidus_admin/adjustment_reasons/edit/component.rb b/admin/app/components/solidus_admin/adjustment_reasons/edit/component.rb index e2005a5fb23..fed30701a0d 100644 --- a/admin/app/components/solidus_admin/adjustment_reasons/edit/component.rb +++ b/admin/app/components/solidus_admin/adjustment_reasons/edit/component.rb @@ -1,8 +1,7 @@ # frozen_string_literal: true class SolidusAdmin::AdjustmentReasons::Edit::Component < SolidusAdmin::BaseComponent - def initialize(page:, adjustment_reason:) - @page = page + def initialize(adjustment_reason:) @adjustment_reason = adjustment_reason end diff --git a/admin/app/components/solidus_admin/adjustment_reasons/index/component.rb b/admin/app/components/solidus_admin/adjustment_reasons/index/component.rb index 647d97ecc82..35b91f5cda6 100644 --- a/admin/app/components/solidus_admin/adjustment_reasons/index/component.rb +++ b/admin/app/components/solidus_admin/adjustment_reasons/index/component.rb @@ -17,7 +17,10 @@ def page_actions render component("ui/button").new( tag: :a, text: t('.add'), - href: solidus_admin.new_adjustment_reason_path, data: { turbo_frame: :new_adjustment_reason_modal }, + href: solidus_admin.new_adjustment_reason_path, data: { + turbo_frame: :new_adjustment_reason_modal, + turbo_prefetch: false + }, icon: "add-line", class: "align-self-end w-full", ) @@ -30,8 +33,8 @@ def turbo_frames ] end - def row_url(adjustment_reason) - spree.edit_admin_adjustment_reason_path(adjustment_reason, _turbo_frame: :edit_adjustment_reason_modal) + def edit_path(adjustment_reason) + spree.edit_admin_adjustment_reason_path(adjustment_reason) end def batch_actions @@ -47,8 +50,22 @@ def batch_actions def columns [ - :name, - :code, + { + header: :name, + data: ->(adjustment_reason) do + link_to adjustment_reason.name, edit_path(adjustment_reason), + class: 'body-link', + data: { turbo_frame: :edit_adjustment_reason_modal, turbo_prefetch: false } + end + }, + { + header: :code, + data: ->(adjustment_reason) do + link_to adjustment_reason.code, edit_path(adjustment_reason), + class: 'body-link', + data: { turbo_frame: :edit_adjustment_reason_modal, turbo_prefetch: false } + end + }, { header: :active, data: ->(adjustment_reason) do diff --git a/admin/app/components/solidus_admin/adjustment_reasons/new/component.html.erb b/admin/app/components/solidus_admin/adjustment_reasons/new/component.html.erb index f30e26730cd..28759d32c4a 100644 --- a/admin/app/components/solidus_admin/adjustment_reasons/new/component.html.erb +++ b/admin/app/components/solidus_admin/adjustment_reasons/new/component.html.erb @@ -24,5 +24,3 @@ <% end %> <% end %> <% end %> - -<%= render component("adjustment_reasons/index").new(page: @page) %> diff --git a/admin/app/components/solidus_admin/adjustment_reasons/new/component.rb b/admin/app/components/solidus_admin/adjustment_reasons/new/component.rb index dddf9ddb8a0..83239a00efa 100644 --- a/admin/app/components/solidus_admin/adjustment_reasons/new/component.rb +++ b/admin/app/components/solidus_admin/adjustment_reasons/new/component.rb @@ -1,8 +1,7 @@ # frozen_string_literal: true class SolidusAdmin::AdjustmentReasons::New::Component < SolidusAdmin::BaseComponent - def initialize(page:, adjustment_reason:) - @page = page + def initialize(adjustment_reason:) @adjustment_reason = adjustment_reason end diff --git a/admin/app/components/solidus_admin/refund_reasons/edit/component.html.erb b/admin/app/components/solidus_admin/refund_reasons/edit/component.html.erb index 4fab63b28f3..bb8f9bc1d9a 100644 --- a/admin/app/components/solidus_admin/refund_reasons/edit/component.html.erb +++ b/admin/app/components/solidus_admin/refund_reasons/edit/component.html.erb @@ -24,4 +24,3 @@ <% end %> <% end %> <% end %> -<%= render component("refund_reasons/index").new(page: @page) %> diff --git a/admin/app/components/solidus_admin/refund_reasons/edit/component.rb b/admin/app/components/solidus_admin/refund_reasons/edit/component.rb index 285847dc84d..690d81bfd37 100644 --- a/admin/app/components/solidus_admin/refund_reasons/edit/component.rb +++ b/admin/app/components/solidus_admin/refund_reasons/edit/component.rb @@ -1,8 +1,7 @@ # frozen_string_literal: true class SolidusAdmin::RefundReasons::Edit::Component < SolidusAdmin::BaseComponent - def initialize(page:, refund_reason:) - @page = page + def initialize(refund_reason:) @refund_reason = refund_reason end diff --git a/admin/app/components/solidus_admin/refund_reasons/index/component.rb b/admin/app/components/solidus_admin/refund_reasons/index/component.rb index 0cc0bf4f443..34bb225b391 100644 --- a/admin/app/components/solidus_admin/refund_reasons/index/component.rb +++ b/admin/app/components/solidus_admin/refund_reasons/index/component.rb @@ -13,8 +13,8 @@ def search_key :name_or_code_cont end - def row_url(refund_reason) - spree.edit_admin_refund_reason_path(refund_reason, _turbo_frame: :edit_refund_reason_modal) + def edit_path(refund_reason) + spree.edit_admin_refund_reason_path(refund_reason) end def turbo_frames @@ -28,7 +28,10 @@ def page_actions render component("ui/button").new( tag: :a, text: t('.add'), - href: solidus_admin.new_refund_reason_path, data: { turbo_frame: :new_refund_reason_modal }, + href: solidus_admin.new_refund_reason_path, data: { + turbo_frame: :new_refund_reason_modal, + turbo_prefetch: false + }, icon: "add-line", class: "align-self-end w-full", ) @@ -47,8 +50,22 @@ def batch_actions def columns [ - :name, - :code, + { + header: :name, + data: ->(refund_reason) do + link_to refund_reason.name, edit_path(refund_reason), + data: { turbo_frame: :edit_refund_reason_modal, turbo_prefetch: false }, + class: 'body-link' + end + }, + { + header: :code, + data: ->(refund_reason) do + link_to_if refund_reason.code, refund_reason.code, edit_path(refund_reason), + data: { turbo_frame: :edit_refund_reason_modal, turbo_prefetch: false }, + class: 'body-link' + end + }, { header: :active, data: ->(refund_reason) do diff --git a/admin/app/components/solidus_admin/refund_reasons/new/component.html.erb b/admin/app/components/solidus_admin/refund_reasons/new/component.html.erb index ef1a44999d2..fc9188b47b0 100644 --- a/admin/app/components/solidus_admin/refund_reasons/new/component.html.erb +++ b/admin/app/components/solidus_admin/refund_reasons/new/component.html.erb @@ -23,5 +23,3 @@ <% end %> <% end %> <% end %> - -<%= render component("refund_reasons/index").new(page: @page) %> diff --git a/admin/app/components/solidus_admin/refund_reasons/new/component.rb b/admin/app/components/solidus_admin/refund_reasons/new/component.rb index 686fc0e9ade..ca31915fa61 100644 --- a/admin/app/components/solidus_admin/refund_reasons/new/component.rb +++ b/admin/app/components/solidus_admin/refund_reasons/new/component.rb @@ -1,8 +1,7 @@ # frozen_string_literal: true class SolidusAdmin::RefundReasons::New::Component < SolidusAdmin::BaseComponent - def initialize(page:, refund_reason:) - @page = page + def initialize(refund_reason:) @refund_reason = refund_reason end diff --git a/admin/app/components/solidus_admin/return_reasons/edit/component.html.erb b/admin/app/components/solidus_admin/return_reasons/edit/component.html.erb index 8782aa23c43..5e14b95e423 100644 --- a/admin/app/components/solidus_admin/return_reasons/edit/component.html.erb +++ b/admin/app/components/solidus_admin/return_reasons/edit/component.html.erb @@ -23,4 +23,3 @@ <% end %> <% end %> <% end %> -<%= render component("return_reasons/index").new(page: @page) %> diff --git a/admin/app/components/solidus_admin/return_reasons/edit/component.rb b/admin/app/components/solidus_admin/return_reasons/edit/component.rb index 2ce5ed7f0bf..a73bca5670a 100644 --- a/admin/app/components/solidus_admin/return_reasons/edit/component.rb +++ b/admin/app/components/solidus_admin/return_reasons/edit/component.rb @@ -1,8 +1,7 @@ # frozen_string_literal: true class SolidusAdmin::ReturnReasons::Edit::Component < SolidusAdmin::BaseComponent - def initialize(page:, return_reason:) - @page = page + def initialize(return_reason:) @return_reason = return_reason end diff --git a/admin/app/components/solidus_admin/return_reasons/index/component.rb b/admin/app/components/solidus_admin/return_reasons/index/component.rb index 175d9575828..8a6ee9f80ef 100644 --- a/admin/app/components/solidus_admin/return_reasons/index/component.rb +++ b/admin/app/components/solidus_admin/return_reasons/index/component.rb @@ -13,8 +13,8 @@ def search_key :name_cont end - def row_url(return_reason) - spree.edit_admin_return_reason_path(return_reason, _turbo_frame: :edit_return_reason_modal) + def edit_path(return_reason) + spree.edit_admin_return_reason_path(return_reason) end def turbo_frames @@ -29,7 +29,7 @@ def page_actions tag: :a, text: t('.add'), href: solidus_admin.new_return_reason_path, - data: { turbo_frame: :new_return_reason_modal }, + data: { turbo_frame: :new_return_reason_modal, turbo_prefetch: false }, icon: "add-line", class: "align-self-end w-full", ) @@ -48,7 +48,14 @@ def batch_actions def columns [ - :name, + { + header: :name, + data: ->(return_reason) do + link_to return_reason.name, edit_path(return_reason), + data: { turbo_frame: :edit_return_reason_modal, turbo_prefetch: false }, + class: 'body-link' + end + }, { header: :active, data: ->(return_reason) do diff --git a/admin/app/components/solidus_admin/return_reasons/new/component.html.erb b/admin/app/components/solidus_admin/return_reasons/new/component.html.erb index 7a55ebbcacd..237315fb3e8 100644 --- a/admin/app/components/solidus_admin/return_reasons/new/component.html.erb +++ b/admin/app/components/solidus_admin/return_reasons/new/component.html.erb @@ -23,5 +23,3 @@ <% end %> <% end %> <% end %> - -<%= render component("return_reasons/index").new(page: @page) %> diff --git a/admin/app/components/solidus_admin/return_reasons/new/component.rb b/admin/app/components/solidus_admin/return_reasons/new/component.rb index 7efe494f634..35ae39d7dbe 100644 --- a/admin/app/components/solidus_admin/return_reasons/new/component.rb +++ b/admin/app/components/solidus_admin/return_reasons/new/component.rb @@ -1,8 +1,7 @@ # frozen_string_literal: true class SolidusAdmin::ReturnReasons::New::Component < SolidusAdmin::BaseComponent - def initialize(page:, return_reason:) - @page = page + def initialize(return_reason:) @return_reason = return_reason end diff --git a/admin/app/components/solidus_admin/roles/edit/component.html.erb b/admin/app/components/solidus_admin/roles/edit/component.html.erb index 9e6b674eb48..bf3ee61cb62 100644 --- a/admin/app/components/solidus_admin/roles/edit/component.html.erb +++ b/admin/app/components/solidus_admin/roles/edit/component.html.erb @@ -29,5 +29,3 @@ <% end %> <% end %> <% end %> - -<%= render component("roles/index").new(page: @page) %> diff --git a/admin/app/components/solidus_admin/roles/edit/component.rb b/admin/app/components/solidus_admin/roles/edit/component.rb index 67b1f47659f..cad11f9a258 100644 --- a/admin/app/components/solidus_admin/roles/edit/component.rb +++ b/admin/app/components/solidus_admin/roles/edit/component.rb @@ -3,8 +3,7 @@ class SolidusAdmin::Roles::Edit::Component < SolidusAdmin::BaseComponent include SolidusAdmin::PermissionSetsHelper - def initialize(page:, role:) - @page = page + def initialize(role:) @role = role end diff --git a/admin/app/components/solidus_admin/roles/index/component.rb b/admin/app/components/solidus_admin/roles/index/component.rb index c5c4e92e297..1b9195f62ab 100644 --- a/admin/app/components/solidus_admin/roles/index/component.rb +++ b/admin/app/components/solidus_admin/roles/index/component.rb @@ -13,15 +13,18 @@ def search_url solidus_admin.roles_path end - def row_url(role) - solidus_admin.edit_role_path(role, _turbo_frame: :edit_role_modal) + def edit_path(role) + solidus_admin.edit_role_path(role) end def page_actions render component("ui/button").new( tag: :a, text: t('.add'), - href: solidus_admin.new_role_path, data: { turbo_frame: :new_role_modal }, + href: solidus_admin.new_role_path, data: { + turbo_frame: :new_role_modal, + turbo_prefetch: false, + }, icon: "add-line", ) end @@ -59,11 +62,19 @@ def columns [ { header: :role, - data: :name, + data: ->(role) do + link_to role.name, edit_path(role), + data: { turbo_frame: :edit_role_modal, turbo_prefetch: false }, + class: "body-link" + end, }, { header: :description, - data: :description, + data: ->(role) do + link_to_if role.description, role.description, edit_path(role), + data: { turbo_frame: :edit_role_modal, turbo_prefetch: false }, + class: "body-link" + end } ] end diff --git a/admin/app/components/solidus_admin/roles/new/component.html.erb b/admin/app/components/solidus_admin/roles/new/component.html.erb index 92d44cd2d76..5bb47301b52 100644 --- a/admin/app/components/solidus_admin/roles/new/component.html.erb +++ b/admin/app/components/solidus_admin/roles/new/component.html.erb @@ -29,5 +29,3 @@ <% end %> <% end %> <% end %> - -<%= render component("roles/index").new(page: @page) %> diff --git a/admin/app/components/solidus_admin/roles/new/component.rb b/admin/app/components/solidus_admin/roles/new/component.rb index 3619452722e..cc328f1ba4d 100644 --- a/admin/app/components/solidus_admin/roles/new/component.rb +++ b/admin/app/components/solidus_admin/roles/new/component.rb @@ -3,8 +3,7 @@ class SolidusAdmin::Roles::New::Component < SolidusAdmin::BaseComponent include SolidusAdmin::PermissionSetsHelper - def initialize(page:, role:) - @page = page + def initialize(role:) @role = role end diff --git a/admin/app/components/solidus_admin/shipping_categories/edit/component.html.erb b/admin/app/components/solidus_admin/shipping_categories/edit/component.html.erb index 88185925b39..84c7a2aef54 100644 --- a/admin/app/components/solidus_admin/shipping_categories/edit/component.html.erb +++ b/admin/app/components/solidus_admin/shipping_categories/edit/component.html.erb @@ -13,4 +13,3 @@ <% end %> <% end %> <% end %> -<%= render component("shipping_categories/index").new(page: @page) %> diff --git a/admin/app/components/solidus_admin/shipping_categories/edit/component.rb b/admin/app/components/solidus_admin/shipping_categories/edit/component.rb index 6f2496e4af1..02ca53bfe93 100644 --- a/admin/app/components/solidus_admin/shipping_categories/edit/component.rb +++ b/admin/app/components/solidus_admin/shipping_categories/edit/component.rb @@ -1,8 +1,7 @@ # frozen_string_literal: true class SolidusAdmin::ShippingCategories::Edit::Component < SolidusAdmin::ShippingCategories::Index::Component - def initialize(page:, shipping_category:) - @page = page + def initialize(shipping_category:) @shipping_category = shipping_category end diff --git a/admin/app/components/solidus_admin/shipping_categories/index/component.rb b/admin/app/components/solidus_admin/shipping_categories/index/component.rb index 4253dcec01c..8b75bca012d 100644 --- a/admin/app/components/solidus_admin/shipping_categories/index/component.rb +++ b/admin/app/components/solidus_admin/shipping_categories/index/component.rb @@ -5,21 +5,14 @@ def model_class Spree::ShippingCategory end - def actions - render component("ui/button").new( - tag: :a, - text: t('.add'), - href: spree.new_admin_shipping_category_path, - icon: "add-line", - class: "align-self-end w-full", - ) - end - def page_actions render component("ui/button").new( tag: :a, text: t('.add'), - href: solidus_admin.new_shipping_category_path, data: { turbo_frame: :new_shipping_category_modal }, + href: solidus_admin.new_shipping_category_path, data: { + turbo_frame: :new_shipping_category_modal, + turbo_prefetch: false, + }, icon: "add-line", class: "align-self-end w-full", ) @@ -32,8 +25,8 @@ def turbo_frames ] end - def row_url(shipping_category) - spree.edit_admin_shipping_category_path(shipping_category, _turbo_frame: :edit_shipping_category_modal) + def edit_url(shipping_category) + spree.edit_admin_shipping_category_path(shipping_category) end def search_key @@ -57,7 +50,14 @@ def batch_actions def columns [ - :name + { + header: :name, + data: ->(shipping_category) do + link_to shipping_category.name, edit_url(shipping_category), + data: { turbo_frame: :edit_shipping_category_modal, turbo_prefetch: false }, + class: "body-link" + end + }, ] end end diff --git a/admin/app/components/solidus_admin/shipping_categories/new/component.html.erb b/admin/app/components/solidus_admin/shipping_categories/new/component.html.erb index e3cf3a75937..19821f8c97f 100644 --- a/admin/app/components/solidus_admin/shipping_categories/new/component.html.erb +++ b/admin/app/components/solidus_admin/shipping_categories/new/component.html.erb @@ -13,5 +13,3 @@ <% end %> <% end %> <% end %> - -<%= render component("shipping_categories/index").new(page: @page) %> diff --git a/admin/app/components/solidus_admin/shipping_categories/new/component.rb b/admin/app/components/solidus_admin/shipping_categories/new/component.rb index ec46b93ae3d..bdaf700111d 100644 --- a/admin/app/components/solidus_admin/shipping_categories/new/component.rb +++ b/admin/app/components/solidus_admin/shipping_categories/new/component.rb @@ -1,8 +1,7 @@ # frozen_string_literal: true class SolidusAdmin::ShippingCategories::New::Component < SolidusAdmin::ShippingCategories::Index::Component - def initialize(page:, shipping_category:) - @page = page + def initialize(shipping_category:) @shipping_category = shipping_category end diff --git a/admin/app/components/solidus_admin/stock_items/edit/component.html.erb b/admin/app/components/solidus_admin/stock_items/edit/component.html.erb index 64a8d7cc594..725bf505ae2 100644 --- a/admin/app/components/solidus_admin/stock_items/edit/component.html.erb +++ b/admin/app/components/solidus_admin/stock_items/edit/component.html.erb @@ -11,7 +11,9 @@ <%= link_to spree.edit_admin_product_variant_path( @stock_item.variant.product, @stock_item.variant, - ), class: 'hover:bg-gray-25 rounded p-1 w-1/2 border border-gray-100' do %> + ), + data: {turbo_frame: "_top"}, + class: 'hover:bg-gray-25 rounded p-1 w-1/2 border border-gray-100' do %> <%= render component("ui/resource_item").new( thumbnail: ( @@ -23,7 +25,9 @@ "#{@stock_item.variant.sku}#{@stock_item.variant.options_text.presence&.prepend(" - ")}", ) %> <% end %> - <%= link_to spree.edit_admin_stock_location_path(@stock_item.stock_location), class: 'hover:bg-gray-25 rounded p-1 w-1/2 border border-gray-100' do %> + <%= link_to spree.edit_admin_stock_location_path(@stock_item.stock_location), + data: {turbo_frame: "_top"}, + class: 'hover:bg-gray-25 rounded p-1 w-1/2 border border-gray-100' do %> <%= render component("ui/resource_item").new( title: @stock_item.stock_location.name, subtitle: "#{Spree::StockLocation.model_name.human} #{@stock_item.stock_location.code}", @@ -78,6 +82,4 @@ <% end %> <% end %> <% end %> - - <%= render component("stock_items/index").new(page: @page) %> diff --git a/admin/app/components/solidus_admin/stock_items/edit/component.rb b/admin/app/components/solidus_admin/stock_items/edit/component.rb index 3573444d413..bdb9e27f6d8 100644 --- a/admin/app/components/solidus_admin/stock_items/edit/component.rb +++ b/admin/app/components/solidus_admin/stock_items/edit/component.rb @@ -1,9 +1,8 @@ # frozen_string_literal: true class SolidusAdmin::StockItems::Edit::Component < SolidusAdmin::BaseComponent - def initialize(stock_item:, page:) + def initialize(stock_item:) @stock_item = stock_item - @page = page end def title diff --git a/admin/app/components/solidus_admin/stock_items/index/component.rb b/admin/app/components/solidus_admin/stock_items/index/component.rb index fc20bb93f71..d9d91d817a7 100644 --- a/admin/app/components/solidus_admin/stock_items/index/component.rb +++ b/admin/app/components/solidus_admin/stock_items/index/component.rb @@ -13,8 +13,8 @@ def search_url solidus_admin.stock_items_path end - def row_url(stock_item) - solidus_admin.edit_stock_item_path(stock_item, _turbo_frame: :edit_stock_item_modal) + def edit_path(stock_item) + solidus_admin.edit_stock_item_path(stock_item) end def scopes @@ -90,7 +90,9 @@ def name_column { header: :name, data: ->(stock_item) do - content_tag :div, stock_item.variant.name + link_to stock_item.variant.name, edit_path(stock_item), + data: { turbo_frame: :edit_stock_item_modal, turbo_prefetch: false }, + class: 'body-link' end } end @@ -99,7 +101,9 @@ def sku_column { header: :sku, data: ->(stock_item) do - content_tag :div, stock_item.variant.sku + link_to stock_item.variant.sku, edit_path(stock_item), + data: { turbo_frame: :edit_stock_item_modal, turbo_prefetch: false }, + class: 'body-link' end } end diff --git a/admin/app/components/solidus_admin/store_credit_reasons/edit/component.html.erb b/admin/app/components/solidus_admin/store_credit_reasons/edit/component.html.erb index d6e791c121f..895ba87a770 100644 --- a/admin/app/components/solidus_admin/store_credit_reasons/edit/component.html.erb +++ b/admin/app/components/solidus_admin/store_credit_reasons/edit/component.html.erb @@ -23,4 +23,3 @@ <% end %> <% end %> <% end %> -<%= render component("store_credit_reasons/index").new(page: @page) %> diff --git a/admin/app/components/solidus_admin/store_credit_reasons/edit/component.rb b/admin/app/components/solidus_admin/store_credit_reasons/edit/component.rb index 8a079ff9e96..afab08b3bec 100644 --- a/admin/app/components/solidus_admin/store_credit_reasons/edit/component.rb +++ b/admin/app/components/solidus_admin/store_credit_reasons/edit/component.rb @@ -1,8 +1,7 @@ # frozen_string_literal: true class SolidusAdmin::StoreCreditReasons::Edit::Component < SolidusAdmin::BaseComponent - def initialize(page:, store_credit_reason:) - @page = page + def initialize(store_credit_reason:) @store_credit_reason = store_credit_reason end diff --git a/admin/app/components/solidus_admin/store_credit_reasons/index/component.rb b/admin/app/components/solidus_admin/store_credit_reasons/index/component.rb index 744045ba2c6..94cd464fca5 100644 --- a/admin/app/components/solidus_admin/store_credit_reasons/index/component.rb +++ b/admin/app/components/solidus_admin/store_credit_reasons/index/component.rb @@ -9,7 +9,10 @@ def page_actions render component("ui/button").new( tag: :a, text: t('.add'), - href: solidus_admin.new_store_credit_reason_path, data: { turbo_frame: :new_store_credit_reason_modal }, + href: solidus_admin.new_store_credit_reason_path, data: { + turbo_frame: :new_store_credit_reason_modal, + turbo_prefetch: false, + }, icon: "add-line", class: "align-self-end w-full", ) @@ -22,8 +25,8 @@ def turbo_frames ] end - def row_url(store_credit_reason) - spree.edit_admin_store_credit_reason_path(store_credit_reason, _turbo_frame: :edit_store_credit_reason_modal) + def edit_path(store_credit_reason) + spree.edit_admin_store_credit_reason_path(store_credit_reason) end def search_url @@ -47,7 +50,14 @@ def batch_actions def columns [ - :name, + { + header: :name, + data: ->(store_credit_reason) do + link_to store_credit_reason.name, edit_path(store_credit_reason), + data: { turbo_frame: :edit_store_credit_reason_modal, turbo_prefetch: false }, + class: 'body-link' + end + }, { header: :active, data: ->(store_credit_reason) do diff --git a/admin/app/components/solidus_admin/store_credit_reasons/new/component.html.erb b/admin/app/components/solidus_admin/store_credit_reasons/new/component.html.erb index 1d8f9d8d22d..9209539edc8 100644 --- a/admin/app/components/solidus_admin/store_credit_reasons/new/component.html.erb +++ b/admin/app/components/solidus_admin/store_credit_reasons/new/component.html.erb @@ -23,5 +23,3 @@ <% end %> <% end %> <% end %> - -<%= render component("store_credit_reasons/index").new(page: @page) %> diff --git a/admin/app/components/solidus_admin/store_credit_reasons/new/component.rb b/admin/app/components/solidus_admin/store_credit_reasons/new/component.rb index 9fbeebbe21a..99cf4e5ac0e 100644 --- a/admin/app/components/solidus_admin/store_credit_reasons/new/component.rb +++ b/admin/app/components/solidus_admin/store_credit_reasons/new/component.rb @@ -1,8 +1,7 @@ # frozen_string_literal: true class SolidusAdmin::StoreCreditReasons::New::Component < SolidusAdmin::BaseComponent - def initialize(page:, store_credit_reason:) - @page = page + def initialize(store_credit_reason:) @store_credit_reason = store_credit_reason end diff --git a/admin/app/components/solidus_admin/tax_categories/edit/component.html.erb b/admin/app/components/solidus_admin/tax_categories/edit/component.html.erb index a5feeef7251..a02e97cb830 100644 --- a/admin/app/components/solidus_admin/tax_categories/edit/component.html.erb +++ b/admin/app/components/solidus_admin/tax_categories/edit/component.html.erb @@ -24,5 +24,3 @@ <% end %> <% end %> <% end %> - -<%= render component("tax_categories/index").new(page: @page) %> diff --git a/admin/app/components/solidus_admin/tax_categories/edit/component.rb b/admin/app/components/solidus_admin/tax_categories/edit/component.rb index 31ddbd13d72..abb9f83a5b5 100644 --- a/admin/app/components/solidus_admin/tax_categories/edit/component.rb +++ b/admin/app/components/solidus_admin/tax_categories/edit/component.rb @@ -1,8 +1,7 @@ # frozen_string_literal: true class SolidusAdmin::TaxCategories::Edit::Component < SolidusAdmin::TaxCategories::Index::Component - def initialize(page:, tax_category:) - @page = page + def initialize(tax_category:) @tax_category = tax_category end diff --git a/admin/app/components/solidus_admin/tax_categories/index/component.rb b/admin/app/components/solidus_admin/tax_categories/index/component.rb index c2ce2b16ca2..bb2b9ec8bae 100644 --- a/admin/app/components/solidus_admin/tax_categories/index/component.rb +++ b/admin/app/components/solidus_admin/tax_categories/index/component.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true class SolidusAdmin::TaxCategories::Index::Component < SolidusAdmin::Taxes::Component - def row_url(tax_category) - spree.edit_admin_tax_category_path(tax_category, _turbo_frame: :edit_tax_category_modal) + def edit_path(tax_category) + spree.edit_admin_tax_category_path(tax_category) end def model_class @@ -17,7 +17,10 @@ def page_actions render component("ui/button").new( tag: :a, text: t('.add'), - href: solidus_admin.new_tax_category_path, data: { turbo_frame: :new_tax_category_modal }, + href: solidus_admin.new_tax_category_path, data: { + turbo_frame: :new_tax_category_modal, + turbo_prefetch: false, + }, icon: "add-line", class: "align-self-end w-full", ) @@ -47,9 +50,30 @@ def batch_actions def columns [ - :name, - :tax_code, - :description, + { + header: :name, + data: ->(tax_category) do + link_to tax_category.name, edit_path(tax_category), + data: { turbo_frame: :edit_tax_category_modal, turbo_prefetch: false }, + class: 'body-link' + end + }, + { + header: :tax_code, + data: ->(tax_category) do + link_to_if tax_category.tax_code, tax_category.tax_code, edit_path(tax_category), + data: { turbo_frame: :edit_tax_category_modal, turbo_prefetch: false }, + class: 'body-link' + end + }, + { + header: :description, + data: ->(tax_category) do + link_to_if tax_category.description, tax_category.description, edit_path(tax_category), + data: { turbo_frame: :edit_tax_category_modal, turbo_prefetch: false }, + class: 'body-link' + end + }, { header: :is_default, data: ->(tax_category) { diff --git a/admin/app/components/solidus_admin/tax_categories/new/component.html.erb b/admin/app/components/solidus_admin/tax_categories/new/component.html.erb index b1a97dcc9be..f112dce4e7f 100644 --- a/admin/app/components/solidus_admin/tax_categories/new/component.html.erb +++ b/admin/app/components/solidus_admin/tax_categories/new/component.html.erb @@ -24,5 +24,3 @@ <% end %> <% end %> <% end %> - -<%= render component("tax_categories/index").new(page: @page) %> diff --git a/admin/app/components/solidus_admin/tax_categories/new/component.rb b/admin/app/components/solidus_admin/tax_categories/new/component.rb index d61ef1e3dd5..5bf598a3cd7 100644 --- a/admin/app/components/solidus_admin/tax_categories/new/component.rb +++ b/admin/app/components/solidus_admin/tax_categories/new/component.rb @@ -1,8 +1,7 @@ # frozen_string_literal: true class SolidusAdmin::TaxCategories::New::Component < SolidusAdmin::TaxCategories::Index::Component - def initialize(page:, tax_category:) - @page = page + def initialize(tax_category:) @tax_category = tax_category end diff --git a/admin/app/components/solidus_admin/ui/table/component.html.erb b/admin/app/components/solidus_admin/ui/table/component.html.erb index 69a155cd66d..4d8cc5345c1 100644 --- a/admin/app/components/solidus_admin/ui/table/component.html.erb +++ b/admin/app/components/solidus_admin/ui/table/component.html.erb @@ -137,11 +137,12 @@ <%= "data-sortable-animation-value=#{@sortable.animation}" if @sortable&.animation %> > <% @data.rows.each do |row| %> + <% rowUrl = @data.url&.call(row) %>