From 2257d9bcf872e2c7c932910ff19a55e39ed297b6 Mon Sep 17 00:00:00 2001 From: andrea longhi Date: Tue, 5 Mar 2024 15:43:59 +0100 Subject: [PATCH] Rework stock item form modal Since the modal open and closes on the current page, close links are not needed anymore. Same goes for the explicit q and page params. The `Cancel` button is simplified to use dialog standards. --- .../stock_items/edit/component.html.erb | 22 ++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) 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 6e6d9f55703..8c45b141768 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,7 +3,7 @@ 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" > - <%= render component("ui/modal").new(title: t(".title"), close_path: solidus_admin.stock_items_path(page: params[:page], q: permitted_query_params)) do |modal| %> + <%= render component("ui/modal").new(title: t(".title")) do |modal| %> <%= form_for @stock_item, url: solidus_admin.stock_item_path(@stock_item), html: { id: form_id } do |f| %>
@@ -58,24 +58,16 @@ checked: f.object.backorderable?, include_hidden: true, ) %> - - <% if params[:q] %> - <%= f.hidden_field :q, value: params[:q].to_json, id: false %> - <% end %> - - <% if params[:page] %> - <%= f.hidden_field :page, value: params[:page], id: false %> - <% end %>
<% end %> <% modal.with_actions do %> - <%= render component("ui/button").new( - tag: :a, - scheme: :secondary, - text: t(".cancel"), - href: solidus_admin.stock_items_path(page: params[:page], q: params[:q]), - ) %> +
+ <%= render component("ui/button").new( + scheme: :secondary, + text: t(".cancel"), + ) %> +
<%= render component("ui/button").new( tag: :button,