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..0aaec5a7d3f 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 @@ -1,6 +1,6 @@ -<%= turbo_frame_tag :edit_adjustment_reason_modal do %> - <%= render component("ui/modal").new(title: t(".title")) do |modal| %> - <%= form_for @adjustment_reason, url: solidus_admin.adjustment_reason_path(@adjustment_reason), html: { id: form_id } do |f| %> +<%= turbo_frame_tag :edit_adjustment_reason_modal, target: "_top" do %> + <%= render component("ui/modal").new(title: t(".title"), close_path: close_path) do |modal| %> + <%= form_for @adjustment_reason, url: solidus_admin.adjustment_reason_path(@adjustment_reason, **search_filter_params), html: { id: form_id } do |f| %>
<%= render component("ui/forms/field").text_field(f, :name, class: "required") %> <%= render component("ui/forms/field").text_field(f, :code, class: "required") %> @@ -17,7 +17,7 @@
<% modal.with_actions do %>
- <%= render component("ui/button").new(scheme: :secondary, text: t('.cancel')) %> + <%= render component("ui/button").new(scheme: :secondary, tag: :a, text: t('.cancel'), href: close_path) %>
<%= render component("ui/button").new(form: form_id, type: :submit, text: t('.submit')) %> <% end %> 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..2e3502a334f 100644 --- a/admin/app/components/solidus_admin/adjustment_reasons/edit/component.rb +++ b/admin/app/components/solidus_admin/adjustment_reasons/edit/component.rb @@ -9,4 +9,8 @@ def initialize(page:, adjustment_reason:) def form_id dom_id(@adjustment_reason, "#{stimulus_id}_edit_adjustment_reason_form") end + + def close_path + solidus_admin.adjustment_reasons_path(**search_filter_params) + end 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..d4b314462ce 100644 --- a/admin/app/components/solidus_admin/adjustment_reasons/index/component.rb +++ b/admin/app/components/solidus_admin/adjustment_reasons/index/component.rb @@ -31,7 +31,11 @@ def turbo_frames end def row_url(adjustment_reason) - spree.edit_admin_adjustment_reason_path(adjustment_reason, _turbo_frame: :edit_adjustment_reason_modal) + edit_path(adjustment_reason) + end + + def edit_path(adjustment_reason) + spree.edit_admin_adjustment_reason_path(adjustment_reason, **search_filter_params) end def batch_actions @@ -47,8 +51,18 @@ 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" + end + }, + { + header: :code, + data: ->(adjustment_reason) do + link_to adjustment_reason.code, edit_path(adjustment_reason), class: "body-link" + end + }, { header: :active, data: ->(adjustment_reason) do diff --git a/admin/app/components/solidus_admin/option_types/index/component.rb b/admin/app/components/solidus_admin/option_types/index/component.rb index 24f6b24e4cf..f01a2d41d39 100644 --- a/admin/app/components/solidus_admin/option_types/index/component.rb +++ b/admin/app/components/solidus_admin/option_types/index/component.rb @@ -6,7 +6,11 @@ def model_class end def row_url(option_type) - spree.edit_admin_option_type_path(option_type) + edit_path(option_type) + end + + def edit_path(option_type) + spree.edit_admin_option_type_path(option_type, **search_filter_params) end def sortable_options @@ -25,14 +29,6 @@ def page_actions ) end - def prev_page_path - solidus_admin.url_for(**request.params, page: @page.number - 1, only_path: true) unless @page.first? - end - - def next_page_path - solidus_admin.url_for(**request.params, page: @page.next_param, only_path: true) unless @page.last? - end - def batch_actions [ { @@ -55,7 +51,7 @@ def name_column { header: :name, data: ->(option_type) do - content_tag :div, option_type.name + link_to option_type.name, edit_path(option_type), class: "body-link" end } end @@ -64,7 +60,7 @@ def presentation_column { header: :presentation, data: ->(option_type) do - content_tag :div, option_type.presentation + link_to option_type.presentation, edit_path(option_type), class: "body-link" end } end diff --git a/admin/app/components/solidus_admin/orders/index/component.rb b/admin/app/components/solidus_admin/orders/index/component.rb index f90e25653b3..e6904f911eb 100644 --- a/admin/app/components/solidus_admin/orders/index/component.rb +++ b/admin/app/components/solidus_admin/orders/index/component.rb @@ -14,7 +14,11 @@ def search_url end def row_url(order) - spree.edit_admin_order_path(order) + edit_path(order) + end + + def edit_path(order) + spree.edit_admin_order_path(order, **search_filter_params) end def row_fade(order) @@ -105,11 +109,7 @@ def number_column { header: :order, data: ->(order) do - if !row_fade(order) - content_tag :div, order.number, class: 'font-semibold' - else - content_tag :div, order.number - end + link_to order.number, edit_path(order), class: row_fade(order) ? 'body-link' : 'body-link font-semibold' end } end diff --git a/admin/app/components/solidus_admin/payment_methods/index/component.rb b/admin/app/components/solidus_admin/payment_methods/index/component.rb index 7bf64ffa63f..8912b47ba8a 100644 --- a/admin/app/components/solidus_admin/payment_methods/index/component.rb +++ b/admin/app/components/solidus_admin/payment_methods/index/component.rb @@ -14,7 +14,11 @@ def search_url end def row_url(payment_method) - spree.edit_admin_payment_method_path(payment_method) + edit_path(payment_method) + end + + def edit_path(payment_method) + spree.edit_admin_payment_method_path(payment_method, **search_filter_params) end def sortable_options @@ -59,7 +63,7 @@ def columns { header: :name, data: ->(payment_method) do - content_tag :div, payment_method.name + link_to payment_method.name, edit_path(payment_method), class: "body-link" end }, { diff --git a/admin/app/components/solidus_admin/products/index/component.rb b/admin/app/components/solidus_admin/products/index/component.rb index 6a015ebcbd2..35793cb4f54 100644 --- a/admin/app/components/solidus_admin/products/index/component.rb +++ b/admin/app/components/solidus_admin/products/index/component.rb @@ -14,7 +14,11 @@ def search_url end def row_url(product) - solidus_admin.product_path(product) + edit_path(product) + end + + def edit_path(product) + solidus_admin.edit_product_path(product, **search_filter_params) end def page_actions @@ -106,7 +110,7 @@ def name_column { header: :name, data: ->(product) do - content_tag :div, product.name + link_to product.name, edit_path(product), class: "body-link" end } end diff --git a/admin/app/components/solidus_admin/properties/index/component.rb b/admin/app/components/solidus_admin/properties/index/component.rb index e8289365922..d1b6bd0f3cb 100644 --- a/admin/app/components/solidus_admin/properties/index/component.rb +++ b/admin/app/components/solidus_admin/properties/index/component.rb @@ -14,7 +14,11 @@ def search_url end def row_url(property) - spree.admin_property_path(property) + edit_path(property) + end + + def edit_path(property) + spree.admin_property_path(property, **search_filter_params) end def page_actions @@ -48,7 +52,7 @@ def name_column { header: :name, data: ->(property) do - content_tag :div, property.name + link_to property.name, edit_path(property), class: "body-link" end } end @@ -57,7 +61,7 @@ def presentation_column { header: :presentation, data: ->(property) do - content_tag :div, property.presentation + link_to property.presentation, edit_path(property), class: "body-link" end } 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..d9b119aa5e0 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 @@ -1,6 +1,6 @@ -<%= turbo_frame_tag :edit_refund_reason_modal do %> - <%= render component("ui/modal").new(title: t(".title")) do |modal| %> - <%= form_for @refund_reason, url: solidus_admin.refund_reason_path(@refund_reason), html: { id: form_id } do |f| %> +<%= turbo_frame_tag :edit_refund_reason_modal, target: "_top" do %> + <%= render component("ui/modal").new(title: t(".title"), close_path: close_path) do |modal| %> + <%= form_for @refund_reason, url: solidus_admin.refund_reason_path(@refund_reason, **search_filter_params), html: { id: form_id } do |f| %>
<%= render component("ui/forms/field").text_field(f, :name, class: "required") %> <%= render component("ui/forms/field").text_field(f, :code, class: "required") %> @@ -17,7 +17,7 @@
<% modal.with_actions do %>
- <%= render component("ui/button").new(scheme: :secondary, text: t('.cancel')) %> + <%= render component("ui/button").new(scheme: :secondary, tag: :a, href: close_path, text: t('.cancel')) %>
<%= render component("ui/button").new(form: form_id, type: :submit, text: t('.submit')) %> <% end %> 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..ca64565f6cd 100644 --- a/admin/app/components/solidus_admin/refund_reasons/edit/component.rb +++ b/admin/app/components/solidus_admin/refund_reasons/edit/component.rb @@ -9,4 +9,8 @@ def initialize(page:, refund_reason:) def form_id dom_id(@refund_reason, "#{stimulus_id}_edit_refund_reason_form") end + + def close_path + solidus_admin.refund_reasons_path(**search_filter_params) + end 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..8e5f8516ef5 100644 --- a/admin/app/components/solidus_admin/refund_reasons/index/component.rb +++ b/admin/app/components/solidus_admin/refund_reasons/index/component.rb @@ -14,7 +14,11 @@ def search_key end def row_url(refund_reason) - spree.edit_admin_refund_reason_path(refund_reason, _turbo_frame: :edit_refund_reason_modal) + edit_path(refund_reason) + end + + def edit_path(refund_reason) + spree.edit_admin_refund_reason_path(refund_reason, **search_filter_params) end def turbo_frames @@ -47,7 +51,12 @@ def batch_actions def columns [ - :name, + { + header: :name, + data: ->(refund_reason) do + link_to refund_reason.name, edit_path(refund_reason), class: "body-link" + end + }, :code, { header: :active, 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..44c6a8f5afd 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 @@ -1,6 +1,6 @@ -<%= turbo_frame_tag :edit_return_reason_modal do %> - <%= render component("ui/modal").new(title: t(".title")) do |modal| %> - <%= form_for @return_reason, url: solidus_admin.return_reason_path(@return_reason), html: { id: form_id } do |f| %> +<%= turbo_frame_tag :edit_return_reason_modal, target: "_top" do %> + <%= render component("ui/modal").new(title: t(".title"), close_path: close_path) do |modal| %> + <%= form_for @return_reason, url: solidus_admin.return_reason_path(@return_reason, **search_filter_params), html: { id: form_id } do |f| %>
<%= render component("ui/forms/field").text_field(f, :name, class: "required") %>
<% modal.with_actions do %>
- <%= render component("ui/button").new(scheme: :secondary, text: t('.cancel')) %> + <%= render component("ui/button").new(scheme: :secondary, tag: :a, text: t('.cancel'), href: close_path) %>
<%= render component("ui/button").new(form: form_id, type: :submit, text: t('.submit')) %> <% end %> 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..5af58f7aa1a 100644 --- a/admin/app/components/solidus_admin/return_reasons/edit/component.rb +++ b/admin/app/components/solidus_admin/return_reasons/edit/component.rb @@ -9,4 +9,8 @@ def initialize(page:, return_reason:) def form_id dom_id(@return_reason, "#{stimulus_id}_edit_return_reason_form") end + + def close_path + solidus_admin.return_reasons_path(**search_filter_params) + end 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..d62fadb1da8 100644 --- a/admin/app/components/solidus_admin/return_reasons/index/component.rb +++ b/admin/app/components/solidus_admin/return_reasons/index/component.rb @@ -14,7 +14,11 @@ def search_key end def row_url(return_reason) - spree.edit_admin_return_reason_path(return_reason, _turbo_frame: :edit_return_reason_modal) + edit_path(return_reason) + end + + def edit_path(return_reason) + spree.edit_admin_return_reason_path(return_reason, **search_filter_params) end def turbo_frames @@ -48,7 +52,12 @@ def batch_actions def columns [ - :name, + { + header: :name, + data: ->(return_reason) do + link_to return_reason.name, edit_path(return_reason), class: "body-link" + end + }, { header: :active, data: ->(return_reason) do 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..575d7079664 100644 --- a/admin/app/components/solidus_admin/roles/edit/component.html.erb +++ b/admin/app/components/solidus_admin/roles/edit/component.html.erb @@ -1,6 +1,6 @@ -<%= turbo_frame_tag :edit_role_modal do %> - <%= render component("ui/modal").new(title: t(".title")) do |modal| %> - <%= form_for @role, url: solidus_admin.role_path(@role), html: { id: form_id } do |f| %> +<%= turbo_frame_tag :edit_role_modal, target: "_top" do %> + <%= render component("ui/modal").new(title: t(".title"), close_path: close_path) do |modal| %> + <%= form_for @role, url: solidus_admin.role_path(@role, **search_filter_params), html: { id: form_id } do |f| %>
<%= render component("ui/forms/field").text_field(f, :name, class: "required") %> <%= render component("ui/forms/field").text_field(f, :description) %> @@ -22,7 +22,7 @@ <% modal.with_actions do %>
- <%= render component("ui/button").new(scheme: :secondary, text: t('.cancel')) %> + <%= render component("ui/button").new(scheme: :secondary, tag: :a, href: close_path, text: t('.cancel')) %>
<%= render component("ui/button").new(form: form_id, type: :submit, text: t('.submit')) %> <% end %> diff --git a/admin/app/components/solidus_admin/roles/edit/component.rb b/admin/app/components/solidus_admin/roles/edit/component.rb index 67b1f47659f..b4d05eb3f50 100644 --- a/admin/app/components/solidus_admin/roles/edit/component.rb +++ b/admin/app/components/solidus_admin/roles/edit/component.rb @@ -12,6 +12,10 @@ def form_id dom_id(@role, "#{stimulus_id}_edit_role_form") end + def close_path + solidus_admin.roles_path(**search_filter_params) + end + private def permission_set_options diff --git a/admin/app/components/solidus_admin/roles/index/component.rb b/admin/app/components/solidus_admin/roles/index/component.rb index c5c4e92e297..90da2c076d9 100644 --- a/admin/app/components/solidus_admin/roles/index/component.rb +++ b/admin/app/components/solidus_admin/roles/index/component.rb @@ -14,7 +14,11 @@ def search_url end def row_url(role) - solidus_admin.edit_role_path(role, _turbo_frame: :edit_role_modal) + edit_path(role) + end + + def edit_path(role) + solidus_admin.edit_role_path(role, **search_filter_params) end def page_actions @@ -58,8 +62,10 @@ def filters def columns [ { - header: :role, - data: :name, + header: :name, + data: ->(role) do + link_to role.name, edit_path(role), class: "body-link" + end }, { header: :description, 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..716d7045268 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 @@ -1,12 +1,12 @@ -<%= turbo_frame_tag :edit_shipping_category_modal do %> - <%= render component("ui/modal").new(title: t(".title")) do |modal| %> - <%= form_for @shipping_category, url: solidus_admin.shipping_category_path(@shipping_category), html: { id: form_id } do |f| %> +<%= turbo_frame_tag :edit_shipping_category_modal, target: "_top" do %> + <%= render component("ui/modal").new(title: t(".title"), close_path: close_path) do |modal| %> + <%= form_for @shipping_category, url: solidus_admin.shipping_category_path(@shipping_category, **search_filter_params), html: { id: form_id } do |f| %>
<%= render component("ui/forms/field").text_field(f, :name) %>
<% modal.with_actions do %>
- <%= render component("ui/button").new(scheme: :secondary, text: t('.cancel')) %> + <%= render component("ui/button").new(scheme: :secondary, tag: :a, href: close_path, text: t('.cancel')) %>
<%= render component("ui/button").new(form: form_id, type: :submit, text: t('.submit')) %> <% end %> 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..18d78c470a6 100644 --- a/admin/app/components/solidus_admin/shipping_categories/edit/component.rb +++ b/admin/app/components/solidus_admin/shipping_categories/edit/component.rb @@ -9,4 +9,8 @@ def initialize(page:, shipping_category:) def form_id dom_id(@shipping_category, "#{stimulus_id}_edit_shipping_category_form") end + + def close_path + solidus_admin.shipping_categories_path(**search_filter_params) + end 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..4e66c296ab4 100644 --- a/admin/app/components/solidus_admin/shipping_categories/index/component.rb +++ b/admin/app/components/solidus_admin/shipping_categories/index/component.rb @@ -33,7 +33,11 @@ def turbo_frames end def row_url(shipping_category) - spree.edit_admin_shipping_category_path(shipping_category, _turbo_frame: :edit_shipping_category_modal) + edit_path(shipping_category) + end + + def edit_path(shipping_category) + spree.edit_admin_shipping_category_path(shipping_category, **search_filter_params) end def search_key @@ -57,7 +61,12 @@ def batch_actions def columns [ - :name + { + header: :name, + data: ->(shipping_category) do + link_to shipping_category.name, edit_path(shipping_category), class: "body-link" + end + } ] end end diff --git a/admin/app/components/solidus_admin/shipping_methods/index/component.rb b/admin/app/components/solidus_admin/shipping_methods/index/component.rb index 69a3f3fbe3f..81675278087 100644 --- a/admin/app/components/solidus_admin/shipping_methods/index/component.rb +++ b/admin/app/components/solidus_admin/shipping_methods/index/component.rb @@ -6,6 +6,10 @@ def model_class end def row_url(shipping_method) + edit_path(shipping_method) + end + + def edit_path(shipping_method) spree.edit_admin_shipping_method_path(shipping_method) end @@ -42,7 +46,11 @@ def columns [ { header: :name, - data: -> { [_1.admin_name.presence, _1.name].compact.join(' / ') }, + data: ->(shipping_method) do + link_to edit_path(shipping_method), class: "body-link" do + [shipping_method.admin_name.presence, shipping_method.name].compact.join(' / ') + end + end }, { header: :zone, 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..847f614ada5 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 @@ -3,8 +3,8 @@ data-<%= stimulus_id %>-initial-count-on-hand-value="<%= @stock_item.count_on_hand_was || @stock_item.count_on_hand %>" data-action="input-><%= stimulus_id %>#updateCountOnHand" > - <%= turbo_frame_tag :edit_stock_item_modal do %> - <%= render component("ui/modal").new(title: t(".title")) do |modal| %> + <%= turbo_frame_tag :edit_stock_item_modal, target: "_top" do %> + <%= render component("ui/modal").new(title: t(".title"), close_path: close_path) do |modal| %> <%= form_for @stock_item, url: solidus_admin.stock_item_path(@stock_item), html: { id: form_id } do |f| %>
@@ -65,6 +65,8 @@ <% modal.with_actions do %>
<%= render component("ui/button").new( + tag: :a, + href: close_path, scheme: :secondary, text: t(".cancel"), ) %> 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..21371b8bb2a 100644 --- a/admin/app/components/solidus_admin/stock_items/edit/component.rb +++ b/admin/app/components/solidus_admin/stock_items/edit/component.rb @@ -15,4 +15,8 @@ def title def form_id "#{stimulus_id}-#{dom_id(@stock_item)}" end + + def close_path + solidus_admin.stock_items_path(**search_filter_params) + end end 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..5e37f1abdd7 100644 --- a/admin/app/components/solidus_admin/stock_items/index/component.rb +++ b/admin/app/components/solidus_admin/stock_items/index/component.rb @@ -14,7 +14,11 @@ def search_url end def row_url(stock_item) - solidus_admin.edit_stock_item_path(stock_item, _turbo_frame: :edit_stock_item_modal) + edit_path(stock_item) + end + + def edit_path(stock_item) + solidus_admin.edit_stock_item_path(stock_item) end def scopes @@ -90,7 +94,7 @@ 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), class: "body-link" end } end @@ -99,7 +103,7 @@ 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), class: "body-link" end } end diff --git a/admin/app/components/solidus_admin/stock_locations/index/component.rb b/admin/app/components/solidus_admin/stock_locations/index/component.rb index f6324732666..41b956f9e60 100644 --- a/admin/app/components/solidus_admin/stock_locations/index/component.rb +++ b/admin/app/components/solidus_admin/stock_locations/index/component.rb @@ -16,6 +16,10 @@ def actions end def row_url(stock_location) + edit_path(stock_location) + end + + def edit_path(stock_location) spree.edit_admin_stock_location_path(stock_location) end @@ -48,7 +52,12 @@ def filters def columns [ - :name, + { + header: :name, + data: ->(stock_location) do + link_to stock_location.name, edit_path(stock_location), class: "body-link" + end + }, :code, :admin_name, { 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..207a28df974 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 @@ -1,6 +1,6 @@ -<%= turbo_frame_tag :edit_store_credit_reason_modal do %> - <%= render component("ui/modal").new(title: t(".title")) do |modal| %> - <%= form_for @store_credit_reason, url: solidus_admin.store_credit_reason_path(@store_credit_reason), html: { id: form_id } do |f| %> +<%= turbo_frame_tag :edit_store_credit_reason_modal, target: "_top" do %> + <%= render component("ui/modal").new(title: t(".title"), close_path: close_path) do |modal| %> + <%= form_for @store_credit_reason, url: solidus_admin.store_credit_reason_path(@store_credit_reason, **search_filter_params), html: { id: form_id } do |f| %>
<%= render component("ui/forms/field").text_field(f, :name, class: "required") %>
<% modal.with_actions do %> - <%= render component("ui/button").new(scheme: :secondary, text: t('.cancel')) %> + <%= render component("ui/button").new(scheme: :secondary, tag: :a, href: close_path, text: t('.cancel')) %>
<%= render component("ui/button").new(form: form_id, type: :submit, text: t('.submit')) %> <% end %> 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..5b95956b8d1 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 @@ -9,4 +9,8 @@ def initialize(page:, store_credit_reason:) def form_id dom_id(@store_credit_reason, "#{stimulus_id}_edit_store_credit_reason_form") end + + def close_path + solidus_admin.store_credit_reasons_path(**search_filter_params) + end 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..f6cdb0ab1b4 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 @@ -23,7 +23,11 @@ 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) + edit_path(store_credit_reason) + end + + def edit_path(store_credit_reason) + spree.edit_admin_store_credit_reason_path(store_credit_reason, **search_filter_params) end def search_url @@ -47,7 +51,12 @@ def batch_actions def columns [ - :name, + { + header: :name, + data: ->(store_credit_reason) do + link_to store_credit_reason.name, edit_path(store_credit_reason), class: "body-link" + end + }, { header: :active, data: ->(store_credit_reason) do diff --git a/admin/app/components/solidus_admin/stores/index/component.rb b/admin/app/components/solidus_admin/stores/index/component.rb index 5df8aa80005..af8fc0f9778 100644 --- a/admin/app/components/solidus_admin/stores/index/component.rb +++ b/admin/app/components/solidus_admin/stores/index/component.rb @@ -14,6 +14,10 @@ def search_url end def row_url(store) + edit_path(store) + end + + def edit_path(store) spree.edit_admin_store_path(store) end @@ -39,12 +43,22 @@ def batch_actions def columns [ - :name, - :url, + { + header: :name, + data: ->(store) do + link_to store.name, edit_path(store), class: "body-link" + end + }, + { + header: :url, + data: ->(store) do + link_to store.url, edit_path(store), class: "body-link" + end + }, { header: :slug, data: ->(store) do - content_tag :div, store.code + link_to store.code, edit_path(store), class: "body-link" 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..ac927aa20bb 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 @@ -1,4 +1,4 @@ -<%= turbo_frame_tag :edit_tax_category_modal do %> +<%= turbo_frame_tag :edit_tax_category_modal, target: "_top" do %> <%= render component("ui/modal").new(title: t(".title")) do |modal| %> <%= form_for @tax_category, url: solidus_admin.tax_category_path(@tax_category), html: { id: form_id } do |f| %>
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..9b0e7f107ae 100644 --- a/admin/app/components/solidus_admin/tax_categories/index/component.rb +++ b/admin/app/components/solidus_admin/tax_categories/index/component.rb @@ -2,7 +2,11 @@ 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) + edit_path(tax_category) + end + + def edit_path(tax_category) + spree.edit_admin_tax_category_path(tax_category) end def model_class @@ -47,9 +51,24 @@ def batch_actions def columns [ - :name, - :tax_code, - :description, + { + header: :name, + data: ->(tax_category) do + link_to tax_category.name, edit_path(tax_category), 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), class: "body-link" + end + }, + { + header: :description, + data: ->(tax_category) do + link_to tax_category.description, edit_path(tax_category), class: "body-link" + end + }, { header: :is_default, data: ->(tax_category) { diff --git a/admin/app/components/solidus_admin/tax_rates/index/component.rb b/admin/app/components/solidus_admin/tax_rates/index/component.rb index 148d280a682..5c326ed8238 100644 --- a/admin/app/components/solidus_admin/tax_rates/index/component.rb +++ b/admin/app/components/solidus_admin/tax_rates/index/component.rb @@ -2,6 +2,10 @@ class SolidusAdmin::TaxRates::Index::Component < SolidusAdmin::Taxes::Component def row_url(tax_rate) + edit_path(tax_rate) + end + + def edit_path(tax_rate) spree.edit_admin_tax_rate_path(tax_rate) end @@ -61,7 +65,12 @@ def columns header: :zone, data: -> { _1.zone&.name }, }, - :name, + { + header: :name, + data: ->(tax_rate) do + link_to tax_rate.name, edit_path(tax_rate), class: "body-link" + end + }, { header: :tax_categories, data: -> { _1.tax_categories.map(&:name).join(', ') }, diff --git a/admin/app/components/solidus_admin/taxonomies/index/component.rb b/admin/app/components/solidus_admin/taxonomies/index/component.rb index e1a47ae8f60..276b18d73e8 100644 --- a/admin/app/components/solidus_admin/taxonomies/index/component.rb +++ b/admin/app/components/solidus_admin/taxonomies/index/component.rb @@ -6,6 +6,10 @@ def model_class end def row_url(taxonomy) + edit_path(taxonomy) + end + + def edit_path(taxonomy) spree.edit_admin_taxonomy_path(taxonomy) end @@ -46,7 +50,7 @@ def name_column { header: :name, data: ->(taxonomy) do - content_tag :div, taxonomy.name + link_to taxonomy.name, edit_path(taxonomy), class: "body-link" end } end diff --git a/admin/app/components/solidus_admin/ui/modal/component.html.erb b/admin/app/components/solidus_admin/ui/modal/component.html.erb index 8b408161258..8a7697dd05e 100644 --- a/admin/app/components/solidus_admin/ui/modal/component.html.erb +++ b/admin/app/components/solidus_admin/ui/modal/component.html.erb @@ -14,13 +14,13 @@

<%= @title %>

-
- <%= render component('ui/button').new( - icon: 'close-line', - scheme: :ghost, - title: t('.close'), - ) %> -
+ <%= render component('ui/button').new( + tag: 'a', + icon: 'close-line', + scheme: :ghost, + title: t('.close'), + href: @close_path + ) %>
diff --git a/admin/app/controllers/solidus_admin/adjustment_reasons_controller.rb b/admin/app/controllers/solidus_admin/adjustment_reasons_controller.rb index 64793387604..739992efe6a 100644 --- a/admin/app/controllers/solidus_admin/adjustment_reasons_controller.rb +++ b/admin/app/controllers/solidus_admin/adjustment_reasons_controller.rb @@ -61,17 +61,8 @@ def edit def update if @adjustment_reason.update(adjustment_reason_params) - respond_to do |format| - flash[:notice] = t('.success') - - format.html do - redirect_to solidus_admin.adjustment_reasons_path, status: :see_other - end - - format.turbo_stream do - render turbo_stream: '' - end - end + flash[:notice] = t('.success') + redirect_to solidus_admin.adjustment_reasons_path(**search_filter_params), status: :see_other else set_index_page diff --git a/admin/app/controllers/solidus_admin/refund_reasons_controller.rb b/admin/app/controllers/solidus_admin/refund_reasons_controller.rb index 92e8c5b2195..161d82d19b9 100644 --- a/admin/app/controllers/solidus_admin/refund_reasons_controller.rb +++ b/admin/app/controllers/solidus_admin/refund_reasons_controller.rb @@ -61,17 +61,8 @@ def edit def update if @refund_reason.update(refund_reason_params) - respond_to do |format| - flash[:notice] = t('.success') - - format.html do - redirect_to solidus_admin.refund_reasons_path, status: :see_other - end - - format.turbo_stream do - render turbo_stream: '' - end - end + flash[:notice] = t('.success') + redirect_to solidus_admin.refund_reasons_path(**search_filter_params), status: :see_other else set_index_page diff --git a/admin/app/controllers/solidus_admin/return_reasons_controller.rb b/admin/app/controllers/solidus_admin/return_reasons_controller.rb index 892603806ca..ac6ef69ae55 100644 --- a/admin/app/controllers/solidus_admin/return_reasons_controller.rb +++ b/admin/app/controllers/solidus_admin/return_reasons_controller.rb @@ -61,17 +61,8 @@ def edit def update if @return_reason.update(return_reason_params) - respond_to do |format| - flash[:notice] = t('.success') - - format.html do - redirect_to solidus_admin.return_reasons_path, status: :see_other - end - - format.turbo_stream do - render turbo_stream: '' - end - end + flash[:notice] = t('.success') + redirect_to solidus_admin.return_reasons_path(**search_filter_params), status: :see_other else set_index_page diff --git a/admin/app/controllers/solidus_admin/roles_controller.rb b/admin/app/controllers/solidus_admin/roles_controller.rb index fea6e2f5b0f..76d08380ffe 100644 --- a/admin/app/controllers/solidus_admin/roles_controller.rb +++ b/admin/app/controllers/solidus_admin/roles_controller.rb @@ -64,17 +64,8 @@ def edit def update if @role.update(role_params) - respond_to do |format| - flash[:notice] = t('.success') - - format.html do - redirect_to solidus_admin.roles_path, status: :see_other - end - - format.turbo_stream do - render turbo_stream: '' - end - end + flash[:notice] = t('.success') + redirect_to solidus_admin.roles_path(**search_filter_params), status: :see_other else set_index_page diff --git a/admin/app/controllers/solidus_admin/shipping_categories_controller.rb b/admin/app/controllers/solidus_admin/shipping_categories_controller.rb index a7a58686da7..6e686ee3b4c 100644 --- a/admin/app/controllers/solidus_admin/shipping_categories_controller.rb +++ b/admin/app/controllers/solidus_admin/shipping_categories_controller.rb @@ -63,17 +63,8 @@ def edit def update if @shipping_category.update(shipping_category_params) - respond_to do |format| - flash[:notice] = t('.success') - - format.html do - redirect_to solidus_admin.shipping_categories_path, status: :see_other - end - - format.turbo_stream do - render turbo_stream: '' - end - end + flash[:notice] = t('.success') + redirect_to solidus_admin.shipping_categories_path(**search_filter_params), status: :see_other else set_index_page diff --git a/admin/app/controllers/solidus_admin/stock_items_controller.rb b/admin/app/controllers/solidus_admin/stock_items_controller.rb index 1333dbe672c..76c32b8743c 100644 --- a/admin/app/controllers/solidus_admin/stock_items_controller.rb +++ b/admin/app/controllers/solidus_admin/stock_items_controller.rb @@ -30,10 +30,8 @@ def update @stock_item.stock_movements.build(quantity: quantity_adjustment, originator: current_solidus_admin_user) if @stock_item.save - respond_to do |format| - format.html { redirect_to solidus_admin.stock_items_path, status: :see_other } - format.turbo_stream { render turbo_stream: '' } - end + flash[:notice] = t('.success') + redirect_to solidus_admin.stock_items_path, status: :see_other else respond_to do |format| format.html { render component('stock_items/edit').new(stock_item: @stock_item, page: @page), status: :unprocessable_entity } diff --git a/admin/app/controllers/solidus_admin/store_credit_reasons_controller.rb b/admin/app/controllers/solidus_admin/store_credit_reasons_controller.rb index 98bbd0615bf..749371ad83b 100644 --- a/admin/app/controllers/solidus_admin/store_credit_reasons_controller.rb +++ b/admin/app/controllers/solidus_admin/store_credit_reasons_controller.rb @@ -61,17 +61,8 @@ def edit def update if @store_credit_reason.update(store_credit_reason_params) - respond_to do |format| - flash[:notice] = t('.success') - - format.html do - redirect_to solidus_admin.store_credit_reasons_path, status: :see_other - end - - format.turbo_stream do - render turbo_stream: '' - end - end + flash[:notice] = t('.success') + redirect_to solidus_admin.store_credit_reasons_path(**search_filter_params), status: :see_other else set_index_page diff --git a/admin/app/controllers/solidus_admin/tax_categories_controller.rb b/admin/app/controllers/solidus_admin/tax_categories_controller.rb index 96a7d96a750..e591fac5090 100644 --- a/admin/app/controllers/solidus_admin/tax_categories_controller.rb +++ b/admin/app/controllers/solidus_admin/tax_categories_controller.rb @@ -57,17 +57,8 @@ def create def update if @tax_category.update(tax_category_params) - respond_to do |format| - flash[:notice] = t('.success') - - format.html do - redirect_to solidus_admin.tax_categories_path, status: :see_other - end - - format.turbo_stream do - render turbo_stream: '' - end - end + flash[:notice] = t('.success') + redirect_to solidus_admin.tax_categories_path, status: :see_other else set_index_page diff --git a/admin/app/helpers/solidus_admin/components_helper.rb b/admin/app/helpers/solidus_admin/components_helper.rb index c57adba7b6d..855de7ddd26 100644 --- a/admin/app/helpers/solidus_admin/components_helper.rb +++ b/admin/app/helpers/solidus_admin/components_helper.rb @@ -5,5 +5,9 @@ module ComponentsHelper def component(name) SolidusAdmin::Config.components[name] end + + def search_filter_params + request.params.slice(:q, :page) + end end end diff --git a/admin/config/locales/stock_items.en.yml b/admin/config/locales/stock_items.en.yml index b1ad9f018e2..46a9ef81fd2 100644 --- a/admin/config/locales/stock_items.en.yml +++ b/admin/config/locales/stock_items.en.yml @@ -2,3 +2,5 @@ en: solidus_admin: stock_items: title: "Stock Items" + update: + success: "Stock item was successfully updated." diff --git a/legacy_promotions/lib/components/admin/solidus_admin/promotion_categories/index/component.rb b/legacy_promotions/lib/components/admin/solidus_admin/promotion_categories/index/component.rb index b52b1a0f3d2..cbb15d5d810 100644 --- a/legacy_promotions/lib/components/admin/solidus_admin/promotion_categories/index/component.rb +++ b/legacy_promotions/lib/components/admin/solidus_admin/promotion_categories/index/component.rb @@ -6,7 +6,11 @@ def model_class end def row_url(promotion_category) - spree.edit_admin_promotion_category_path(promotion_category) + edit_path(promotion_category) + end + + def edit_path(promotion_category) + spree.edit_admin_promotion_category_path(promotion_category, **search_filter_params) end def page_actions @@ -40,7 +44,7 @@ def name_column { header: :name, data: ->(promotion_category) do - content_tag :div, promotion_category.name + link_to promotion_category.name, edit_path(promotion_category), class: "body-link" end } end @@ -49,7 +53,7 @@ def code_column { header: :code, data: ->(promotion_category) do - content_tag :div, promotion_category.code + link_to promotion_category.code, edit_path(promotion_category), class: "body-link" end } end diff --git a/legacy_promotions/lib/components/admin/solidus_admin/promotions/index/component.rb b/legacy_promotions/lib/components/admin/solidus_admin/promotions/index/component.rb index b6fe1730f7e..6c88e2974e7 100644 --- a/legacy_promotions/lib/components/admin/solidus_admin/promotions/index/component.rb +++ b/legacy_promotions/lib/components/admin/solidus_admin/promotions/index/component.rb @@ -14,7 +14,11 @@ def search_url end def row_url(promotion) - spree.admin_promotion_path(promotion) + edit_path(promotion) + end + + def edit_path(promotion) + spree.edit_admin_promotion_path(promotion, **search_filter_params) end def page_actions @@ -63,14 +67,16 @@ def columns { header: :name, data: ->(promotion) do - content_tag :div, promotion.name + link_to promotion.name, edit_path(promotion), class: "body-link" end }, { header: :code, data: ->(promotion) do - count = promotion.codes.count - (count == 1) ? promotion.codes.pick(:value) : t('spree.number_of_codes', count:) + link_to edit_path(promotion), class: "body-link" do + count = promotion.codes.count + (count == 1) ? promotion.codes.pick(:value) : t('spree.number_of_codes', count:) + end end }, { diff --git a/promotions/lib/components/admin/solidus_promotions/promotion_categories/index/component.rb b/promotions/lib/components/admin/solidus_promotions/promotion_categories/index/component.rb index 53d675ed3ed..96b9586134d 100644 --- a/promotions/lib/components/admin/solidus_promotions/promotion_categories/index/component.rb +++ b/promotions/lib/components/admin/solidus_promotions/promotion_categories/index/component.rb @@ -6,7 +6,11 @@ def model_class end def row_url(promotion_category) - solidus_promotions.edit_admin_promotion_category_path(promotion_category) + edit_path(promotion_category) + end + + def edit_path(promotion_category) + solidus_promotions.edit_admin_promotion_category_path(promotion_category, **search_filter_params) end def page_actions @@ -40,7 +44,7 @@ def name_column { header: :name, data: ->(promotion_category) do - content_tag :div, promotion_category.name + link_to promotion_category.name, edit_path(promotion_category), class: "body-link" end } end @@ -49,7 +53,7 @@ def code_column { header: :code, data: ->(promotion_category) do - content_tag :div, promotion_category.code + link_to promotion_category.code, edit_path(promotion_category), class: "body-link" end } end diff --git a/promotions/lib/components/admin/solidus_promotions/promotions/index/component.rb b/promotions/lib/components/admin/solidus_promotions/promotions/index/component.rb index 8416e5d343c..cffcb847aba 100644 --- a/promotions/lib/components/admin/solidus_promotions/promotions/index/component.rb +++ b/promotions/lib/components/admin/solidus_promotions/promotions/index/component.rb @@ -63,13 +63,13 @@ def columns { header: :name, data: ->(promotion) do - link_to promotion.name, row_url(promotion) + link_to promotion.name, row_url(promotion), class: "body-link" end }, { header: :code, data: ->(promotion) do - link_to solidus_promotions.admin_promotion_promotion_codes_path(promotion), title: t(".codes") do + link_to solidus_promotions.admin_promotion_promotion_codes_path(promotion), title: t(".codes"), class: "body-link" do count = promotion.codes.count (count == 1) ? promotion.codes.pick(:value) : t("spree.number_of_codes", count: count) end