diff --git a/admin/app/components/solidus_admin/users/store_credits/index/component.html.erb b/admin/app/components/solidus_admin/users/store_credits/index/component.html.erb
index 41799abddbd..c619d713c9a 100644
--- a/admin/app/components/solidus_admin/users/store_credits/index/component.html.erb
+++ b/admin/app/components/solidus_admin/users/store_credits/index/component.html.erb
@@ -8,7 +8,7 @@
tag: :a,
href: new_store_credit_path,
data: {
- turbo_frame: :resource_modal
+ turbo_frame: :resource_form
},
text: t(".add_store_credit"),
icon: "add-line"
@@ -45,7 +45,7 @@
<%= render component("ui/button").new(
tag: :a,
data: {
- turbo_frame: :resource_modal
+ turbo_frame: :resource_form
},
href: new_store_credit_path,
text: t(".create_one"),
@@ -59,5 +59,5 @@
<% end %>
<% end %>
- <%= turbo_frame_tag :resource_modal, target: "_top" %>
+ <%= turbo_frame_tag :resource_form, target: "_top" %>
<% end %>
diff --git a/admin/app/components/solidus_admin/users/store_credits/new/component.html.erb b/admin/app/components/solidus_admin/users/store_credits/new/component.html.erb
index e5cc0ed6623..ca6f64f5af2 100644
--- a/admin/app/components/solidus_admin/users/store_credits/new/component.html.erb
+++ b/admin/app/components/solidus_admin/users/store_credits/new/component.html.erb
@@ -1,4 +1,4 @@
-<%= turbo_frame_tag :resource_modal, target: "_top" do %>
+<%= turbo_frame_tag :resource_form, target: "_top" do %>
<%= render component("ui/modal").new(title: t(".title")) do |modal| %>
<%= form_for @store_credit, url: form_url, method: :post, html: { id: form_id } do |f| %>
diff --git a/admin/app/components/solidus_admin/users/store_credits/show/component.html.erb b/admin/app/components/solidus_admin/users/store_credits/show/component.html.erb
index 8232ff9c879..887ea309db5 100644
--- a/admin/app/components/solidus_admin/users/store_credits/show/component.html.erb
+++ b/admin/app/components/solidus_admin/users/store_credits/show/component.html.erb
@@ -29,7 +29,7 @@
tag: :a,
scheme: :danger,
data: {
- turbo_frame: :resource_modal
+ turbo_frame: :resource_form
},
href: edit_validity_url,
text: t(".invalidate"),
@@ -39,7 +39,7 @@
<%= render component("ui/button").new(
tag: :a,
data: {
- turbo_frame: :resource_modal
+ turbo_frame: :resource_form
},
href: edit_memo_url,
text: t(".edit_memo"),
@@ -49,7 +49,7 @@
<%= render component("ui/button").new(
tag: :a,
data: {
- turbo_frame: :resource_modal
+ turbo_frame: :resource_form
},
href: edit_amount_url,
text: t(".edit_amount"),
@@ -77,5 +77,5 @@
<% end %>
<% end %>
- <%= turbo_frame_tag :resource_modal, target: "_top" %>
+ <%= turbo_frame_tag :resource_form, target: "_top" %>
<% end %>
diff --git a/admin/app/components/solidus_admin/zones/form/component.html.erb b/admin/app/components/solidus_admin/zones/form/component.html.erb
index 3fdfecb436b..c96c26a1075 100644
--- a/admin/app/components/solidus_admin/zones/form/component.html.erb
+++ b/admin/app/components/solidus_admin/zones/form/component.html.erb
@@ -1,4 +1,4 @@
-<%= turbo_frame_tag :resource_modal, target: "_top" do %>
+<%= turbo_frame_tag :resource_form, target: "_top" do %>
<%= render component("ui/modal").new(title:) do |modal| %>
<%= form_for @zone, url: @form_url, html: { id: @form_id, **stimulus_controller, **stimulus_value(name: :kind, value: @zone.kind) } do |f| %>
diff --git a/admin/app/components/solidus_admin/zones/index/component.rb b/admin/app/components/solidus_admin/zones/index/component.rb
index 33390df6bea..747bf3399d1 100644
--- a/admin/app/components/solidus_admin/zones/index/component.rb
+++ b/admin/app/components/solidus_admin/zones/index/component.rb
@@ -22,7 +22,7 @@ def edit_path(zone)
end
def turbo_frames
- %w[resource_modal]
+ %w[resource_form]
end
def page_actions
@@ -30,7 +30,7 @@ def page_actions
tag: :a,
text: t('.add'),
href: solidus_admin.new_zone_path(**search_filter_params),
- data: { turbo_frame: :resource_modal },
+ data: { turbo_frame: :resource_form },
icon: "add-line",
class: "align-self-end w-full",
)
@@ -69,7 +69,7 @@ def name_column
header: :name,
data: ->(zone) do
link_to zone.name, edit_path(zone),
- data: { turbo_frame: :resource_modal },
+ data: { turbo_frame: :resource_form },
class: 'body-link'
end
}
@@ -80,7 +80,7 @@ def description_column
header: :description,
data: ->(zone) do
link_to zone.description, edit_path(zone),
- data: { turbo_frame: :resource_modal },
+ data: { turbo_frame: :resource_form },
class: 'body-link'
end
}
diff --git a/admin/app/controllers/solidus_admin/adjustments_controller.rb b/admin/app/controllers/solidus_admin/adjustments_controller.rb
index 350bc3dee5d..f085652211e 100644
--- a/admin/app/controllers/solidus_admin/adjustments_controller.rb
+++ b/admin/app/controllers/solidus_admin/adjustments_controller.rb
@@ -20,7 +20,7 @@ def index
def lock
@adjustments = @order.all_adjustments.not_finalized.where(id: params[:id])
@adjustments.each(&:finalize!)
- flash[:success] = t('.success')
+ flash[:notice] = t('.success')
redirect_to order_adjustments_path(@order), status: :see_other
end
@@ -28,7 +28,7 @@ def lock
def unlock
@adjustments = @order.all_adjustments.finalized.where(id: params[:id])
@adjustments.each(&:unfinalize!)
- flash[:success] = t('.success')
+ flash[:notice] = t('.success')
redirect_to order_adjustments_path(@order), status: :see_other
end
@@ -36,7 +36,7 @@ def unlock
def destroy
@adjustments = @order.all_adjustments.where(id: params[:id])
@adjustments.destroy_all
- flash[:success] = t('.success')
+ flash[:notice] = t('.success')
redirect_to order_adjustments_path(@order), status: :see_other
end
diff --git a/admin/app/controllers/solidus_admin/base_controller.rb b/admin/app/controllers/solidus_admin/base_controller.rb
index bd7442f4eee..8854547389a 100644
--- a/admin/app/controllers/solidus_admin/base_controller.rb
+++ b/admin/app/controllers/solidus_admin/base_controller.rb
@@ -19,6 +19,7 @@ class BaseController < ApplicationController
helper 'solidus_admin/components'
helper 'solidus_admin/layout'
+ helper 'solidus_admin/flash'
private
diff --git a/admin/app/controllers/solidus_admin/customers_controller.rb b/admin/app/controllers/solidus_admin/customers_controller.rb
index af79d4d483a..b86ef95c1e6 100644
--- a/admin/app/controllers/solidus_admin/customers_controller.rb
+++ b/admin/app/controllers/solidus_admin/customers_controller.rb
@@ -13,7 +13,7 @@ def show
def destroy
if @order.update(user: nil)
- flash[:success] = t('.success')
+ flash[:notice] = t('.success')
else
flash[:error] = t('.error')
end
diff --git a/admin/app/controllers/solidus_admin/products_controller.rb b/admin/app/controllers/solidus_admin/products_controller.rb
index e5f22336ed3..4475d11cb47 100644
--- a/admin/app/controllers/solidus_admin/products_controller.rb
+++ b/admin/app/controllers/solidus_admin/products_controller.rb
@@ -43,7 +43,7 @@ def update
@product = Spree::Product.friendly.find(params[:id])
if @product.update(product_params)
- flash[:success] = t('spree.successfully_updated', resource: [
+ flash[:notice] = t('spree.successfully_updated', resource: [
Spree::Product.model_name.human,
@product.name.inspect,
].join(' '))
diff --git a/admin/app/controllers/solidus_admin/resources_controller.rb b/admin/app/controllers/solidus_admin/resources_controller.rb
index b4656a2f5d2..19f93fe10c9 100644
--- a/admin/app/controllers/solidus_admin/resources_controller.rb
+++ b/admin/app/controllers/solidus_admin/resources_controller.rb
@@ -133,7 +133,7 @@ def render_resource_form_with_errors(page_component)
render page_component, status: :unprocessable_entity
end
format.turbo_stream do
- render turbo_stream: turbo_stream.replace(:resource_modal, page_component),
+ render turbo_stream: turbo_stream.replace(resource_form_frame, page_component),
status: :unprocessable_entity
end
end
@@ -165,5 +165,9 @@ def blueprint_view
raise NotImplementedError,
"You must implement the blueprint_view method in #{self.class}"
end
+
+ def resource_form_frame
+ :resource_form
+ end
end
end
diff --git a/admin/app/controllers/solidus_admin/stores_controller.rb b/admin/app/controllers/solidus_admin/stores_controller.rb
index c653163d5c9..5da0a2044f9 100644
--- a/admin/app/controllers/solidus_admin/stores_controller.rb
+++ b/admin/app/controllers/solidus_admin/stores_controller.rb
@@ -1,35 +1,40 @@
# frozen_string_literal: true
module SolidusAdmin
- class StoresController < SolidusAdmin::BaseController
- include SolidusAdmin::ControllerHelpers::Search
-
- def index
- stores = apply_search_to(
- Spree::Store.order(id: :desc),
- param: :q
- )
-
- set_page_and_extract_portion_from(stores)
-
- respond_to do |format|
- format.html { render component('stores/index').new(page: @page) }
- end
- end
-
+ class StoresController < SolidusAdmin::ResourcesController
def destroy
- @stores = Spree::Store.where(id: params[:id])
-
- Spree::Store.transaction { @stores.destroy_all }
+ @resource = resource_class.where(id: params[:id])
+
+ failed = @resource.destroy_all.reject(&:destroyed?)
+ if failed.present?
+ desc = failed.map { t(".error.description", name: _1.name, reason: _1.errors.full_messages.join(" ")) }.join("
")
+ flash[:alert] = { danger: { title: t(".error.title"), description: desc } }
+ else
+ flash[:notice] = t('.success')
+ end
- flash[:notice] = t('.success')
- redirect_back_or_to stores_path, status: :see_other
+ redirect_to after_destroy_path, status: :see_other
end
private
- def store_params
- params.require(:store).permit(:store_id, permitted_store_attributes)
+ def resource_class = Spree::Store
+
+ def resources_collection = Spree::Store
+
+ def permitted_resource_params
+ params.require(:store).permit(
+ :name,
+ :url,
+ :code,
+ :meta_description,
+ :meta_keywords,
+ :seo_title,
+ :mail_from_address,
+ :default_currency,
+ :cart_tax_country_iso,
+ available_locales: [],
+ )
end
end
end
diff --git a/admin/app/controllers/solidus_admin/users_controller.rb b/admin/app/controllers/solidus_admin/users_controller.rb
index 7e7d181a1bd..04eaa09ac1e 100644
--- a/admin/app/controllers/solidus_admin/users_controller.rb
+++ b/admin/app/controllers/solidus_admin/users_controller.rb
@@ -37,7 +37,7 @@ def update_addresses
set_address_from_params
if @address.valid? && @user.update(user_params)
- flash[:success] = t(".#{@type}.success")
+ flash[:notice] = t(".#{@type}.success")
respond_to do |format|
format.turbo_stream { render turbo_stream: '
' }
diff --git a/admin/app/helpers/solidus_admin/flash_helper.rb b/admin/app/helpers/solidus_admin/flash_helper.rb
new file mode 100644
index 00000000000..de9308ac727
--- /dev/null
+++ b/admin/app/helpers/solidus_admin/flash_helper.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+# Reserve :alert for messages that should go in UI alert component. Everything else will be shown in UI toast.
+module SolidusAdmin
+ module FlashHelper
+ def toasts
+ flash.to_hash.with_indifferent_access.except(:alert)
+ end
+
+ # Construct alert flashes like +flash[:alert] = {
: { title: "", description: "" } }+.
+ # See +SolidusAdmin::UI::Alert::Component::SCHEMES+ for available alert types.
+ def alerts
+ flash.to_hash.with_indifferent_access.fetch(:alert, {}).slice(*SolidusAdmin::UI::Alert::Component::SCHEMES.keys)
+ end
+ end
+end
diff --git a/admin/app/views/layouts/solidus_admin/application.html.erb b/admin/app/views/layouts/solidus_admin/application.html.erb
index 6755eea3c1d..c833d196a47 100644
--- a/admin/app/views/layouts/solidus_admin/application.html.erb
+++ b/admin/app/views/layouts/solidus_admin/application.html.erb
@@ -31,8 +31,16 @@
+
+
+ <% alerts.each do |key, text| %>
+ <%= render component("ui/alert").new(title: text[:title], description: text[:description], scheme: key.to_sym) %>
+ <% end %>
+
+
+
- <% flash.each do |key, message| %>
+ <% toasts.each do |key, message| %>
<%= render component("ui/toast").new(text: message, scheme: key.to_sym == :error ? :error : :default) %>
<% end %>
diff --git a/admin/config/locales/stores.en.yml b/admin/config/locales/stores.en.yml
index 4f901a50d6d..19ff629880e 100644
--- a/admin/config/locales/stores.en.yml
+++ b/admin/config/locales/stores.en.yml
@@ -1,6 +1,28 @@
en:
+ activerecord:
+ attributes:
+ spree/store:
+ available_locales: Storefront Languages
+ bcc_email: BCC Email
+ cart_tax_country_iso: Tax Country
+ code: Slug
+ default: Default
+ default_currency: Default Currency
+ mail_from_address: Store Email
+ meta_description: Meta Description
+ meta_keywords: Meta Keywords
+ name: Store Name
+ seo_title: Page Title
+ url: URL
solidus_admin:
stores:
title: "Stores"
+ create:
+ success: "Store was successfully created."
destroy:
+ error:
+ title: "Some Stores could not be removed"
+ description: "%{name}: %{reason}"
success: "Stores were successfully removed."
+ update:
+ success: "Store was successfully updated."
diff --git a/admin/config/routes.rb b/admin/config/routes.rb
index ec215522965..64632d94f00 100644
--- a/admin/config/routes.rb
+++ b/admin/config/routes.rb
@@ -79,7 +79,7 @@
admin_resources :shipping_methods, only: [:index, :destroy]
admin_resources :shipping_categories, except: [:show]
admin_resources :stock_locations, only: [:index, :destroy]
- admin_resources :stores, only: [:index, :destroy]
+ admin_resources :stores, except: [:show]
admin_resources :zones, except: [:show]
admin_resources :refund_reasons, except: [:show]
admin_resources :reimbursement_types, only: [:index]
diff --git a/admin/docs/index_pages.md b/admin/docs/index_pages.md
index a17379d5529..d18c4b93592 100644
--- a/admin/docs/index_pages.md
+++ b/admin/docs/index_pages.md
@@ -94,7 +94,7 @@ end
def delete
@users = Spree.user_class.where(id: params[:id])
@users.destroy_all
- flash[:success] = "Admin users deleted"
+ flash[:notice] = "Admin users deleted"
redirect_to solidus_admin.users_path, status: :see_other
end
```
diff --git a/admin/lib/solidus_admin/testing_support/feature_helpers.rb b/admin/lib/solidus_admin/testing_support/feature_helpers.rb
index 6f28ad553cb..bf47f18d52c 100644
--- a/admin/lib/solidus_admin/testing_support/feature_helpers.rb
+++ b/admin/lib/solidus_admin/testing_support/feature_helpers.rb
@@ -61,6 +61,10 @@ def clear_search
find('button[aria-label="Clear"]').click
end
end
+
+ def solidus_select_control(field)
+ find_field(field, visible: :all).ancestor(".control")
+ end
end
end
end
diff --git a/admin/spec/components/solidus_admin/ui/button/component_spec.rb b/admin/spec/components/solidus_admin/ui/button/component_spec.rb
index 4eda5fab23a..fd5667e6894 100644
--- a/admin/spec/components/solidus_admin/ui/button/component_spec.rb
+++ b/admin/spec/components/solidus_admin/ui/button/component_spec.rb
@@ -39,4 +39,41 @@
expect(page).to have_content("Cancel")
end
end
+
+ describe ".back" do
+ let(:component) { described_class.back(path: "/index") }
+
+ it "renders Back button" do
+ render_inline(component)
+ expect(page).to have_link(href: '/index', title: 'Back')
+ end
+ end
+
+ describe ".delete" do
+ let(:component) { described_class.delete }
+
+ it "renders Delete button" do
+ render_inline(component)
+ expect(page).to have_button("Delete")
+ end
+ end
+
+ describe ".discard" do
+ let(:component) { described_class.discard(path: "/index") }
+
+ it "renders Discard button" do
+ render_inline(component)
+ expect(page).to have_link(href: '/index')
+ expect(page).to have_content("Discard")
+ end
+ end
+
+ describe ".save" do
+ let(:component) { described_class.save }
+
+ it "renders Save button" do
+ render_inline(component)
+ expect(page).to have_button("Save")
+ end
+ end
end
diff --git a/admin/spec/features/stores_spec.rb b/admin/spec/features/stores_spec.rb
index 921393a584d..07a01204213 100644
--- a/admin/spec/features/stores_spec.rb
+++ b/admin/spec/features/stores_spec.rb
@@ -5,20 +5,120 @@
describe "Stores", :js, type: :feature do
before { sign_in create(:admin_user, email: 'admin@example.com') }
- it "lists stores and allows deleting them" do
- create(:store, name: "B2C Store")
- create(:store, name: "B2B Store")
-
- visit "/admin/stores"
- expect(page).to have_content("B2C Store")
- expect(page).to have_content("B2B Store")
- expect(page).to be_axe_clean
-
- select_row("B2C Store")
- click_on "Delete"
- expect(page).to have_content("Stores were successfully removed.")
- expect(page).not_to have_content("B2C Store")
- expect(Spree::Store.count).to eq(1)
- expect(page).to be_axe_clean
+ describe "index page" do
+ before do
+ create(:store, name: "B2C Store")
+ create(:store, name: "B2B Store", default: true)
+ visit "/admin/stores"
+ expect(page).to have_content("B2C Store")
+ expect(page).to have_content("B2B Store")
+ expect(page).to be_axe_clean
+ end
+
+ it "lists stores and allows deleting them" do
+ select_row("B2C Store")
+
+ accept_confirm("Are you sure you want to delete 1 store?") do
+ click_button("Delete")
+ end
+
+ expect(page).to have_content("Stores were successfully removed.")
+ expect(page).not_to have_content("B2C Store")
+ expect(page).to be_axe_clean
+ end
+
+ it "does not allow to delete default store" do
+ select_row("B2B Store")
+
+ accept_confirm("Are you sure you want to delete 1 store?") do
+ click_button("Delete")
+ end
+
+ expect(page).not_to have_content("Stores were successfully removed.")
+ expect(page).to have_content("B2B Store")
+ expect(page).to have_content("Some Stores could not be removed")
+ expect(page).to have_content("B2B Store: Cannot destroy the default Store")
+ expect(page).to be_axe_clean
+ end
+ end
+
+ describe "creating new store" do
+ before do
+ visit "/admin/stores"
+ click_on "Add new"
+ expect(page).to be_axe_clean
+ end
+
+ context "with valid form" do
+ it "saves store" do
+ fill_in "Store Name", with: "New Store"
+ fill_in "Slug", with: "new-store"
+ fill_in "URL", with: "www.new-store.com"
+ fill_in "Store Email", with: "mail@new-stores.com"
+
+ within("header") { click_on "Save" }
+
+ expect(page).to have_content("Store was successfully created")
+ expect(page).to have_content("New Store")
+ expect(page).to have_content("new-store")
+ expect(page).to have_content("www.new-store.com")
+ end
+ end
+
+ context "with invalid form" do
+ it "saves store" do
+ within("header") { click_on "Save" }
+
+ expect(page).to have_content("can't be blank", count: 4)
+ end
+ end
+ end
+
+ describe "editing existing store" do
+ before do
+ create(:store,
+ name: "B2C Store",
+ default_currency: "GBP",
+ cart_tax_country_iso: create(:country, iso: "GB").iso,
+ available_locales: %w[en])
+
+ create(:country, iso: "US")
+ visit "/admin/stores"
+ click_on "B2C Store"
+ expect(page).to be_axe_clean
+ end
+
+ it "updates store" do
+ expect(solidus_select_control("Default Currency")).to have_content("GBP")
+ expect(solidus_select_control("Tax Country")).to have_content("United Kingdom")
+ expect(solidus_select_control("Storefront Languages")).to have_content("English (US)")
+
+ fill_in "Store Name", with: "Updated Store"
+ fill_in "Slug", with: "updated-store"
+ fill_in "URL", with: "www.updated-store.com"
+ fill_in "Store Email", with: "updated-mail@new-stores.com"
+ solidus_select("USD", from: "Default Currency")
+ solidus_select("United States", from: "Tax Country")
+
+ within("header") { click_on "Save" }
+
+ expect(page).to have_content("Store was successfully updated")
+ expect(page).to have_content("Updated Store")
+ expect(page).to have_content("updated-store")
+ expect(page).to have_content("www.updated-store.com")
+
+ click_on "Updated Store"
+ expect(solidus_select_control("Default Currency")).to have_content("USD")
+ expect(solidus_select_control("Tax Country")).to have_content("United States")
+ end
+ end
+
+ describe "clicking Discard" do
+ it "redirects back to index" do
+ visit "/admin/stores"
+ click_on "Add new"
+ click_on "Discard"
+ expect(page).to have_current_path("/admin/stores")
+ end
end
end
diff --git a/admin/spec/requests/solidus_admin/stores_spec.rb b/admin/spec/requests/solidus_admin/stores_spec.rb
new file mode 100644
index 00000000000..bc19dddffc5
--- /dev/null
+++ b/admin/spec/requests/solidus_admin/stores_spec.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+require "spec_helper"
+require 'solidus_admin/testing_support/shared_examples/crud_resource_requests'
+
+RSpec.describe "SolidusAdmin::StoresController", type: :request do
+ before { create(:store, default: true) } # create a default store so that we operate on a non-default one
+
+ include_examples 'CRUD resource requests', 'store' do
+ let(:resource_class) { Spree::Store }
+ let(:valid_attributes) { { name: "Store", code: "store", url: "store.com", mail_from_address: "store@example.com" } }
+ let(:invalid_attributes) { { name: "" } }
+ end
+end
diff --git a/core/app/models/spree/store.rb b/core/app/models/spree/store.rb
index fd5aef8289c..f16e3389342 100644
--- a/core/app/models/spree/store.rb
+++ b/core/app/models/spree/store.rb
@@ -25,7 +25,7 @@ class Store < Spree::Base
self.allowed_ransackable_attributes = %w[name url code]
before_save :ensure_default_exists_and_is_unique
- before_destroy :validate_not_default
+ before_destroy :validate_not_default, prepend: true
enum :reverse_charge_status, {
disabled: 0,
@@ -73,6 +73,7 @@ def ensure_default_exists_and_is_unique
def validate_not_default
if default
errors.add(:base, :cannot_destroy_default_store)
+ throw :abort
end
end
end
diff --git a/core/spec/models/spree/store_spec.rb b/core/spec/models/spree/store_spec.rb
index 9bf552581d6..37bdf445638 100644
--- a/core/spec/models/spree/store_spec.rb
+++ b/core/spec/models/spree/store_spec.rb
@@ -136,4 +136,24 @@
expect { Spree::Store.new(reverse_charge_status: :invalid_status) }.to raise_error(ArgumentError)
end
end
+
+ describe "#validate_not_default" do
+ context "when deleting a default store" do
+ it "prevents deletion" do
+ store = create(:store, default: true)
+ expect(store.destroy).to eq false
+ expect(store.errors.full_messages.join).to match /Cannot destroy/
+ expect { store.reload }.not_to raise_error
+ end
+ end
+
+ context "when deleting a non-default store" do
+ it "allows deletion" do
+ create(:store, default: true)
+ store = create(:store, default: false)
+ expect(store.destroy).to be_truthy
+ expect { store.reload }.to raise_error(ActiveRecord::RecordNotFound)
+ end
+ end
+ end
end
diff --git a/legacy_promotions/lib/components/admin/solidus_admin/promotion_categories/edit/component.html.erb b/legacy_promotions/lib/components/admin/solidus_admin/promotion_categories/edit/component.html.erb
index f0f59dc8548..6bb6300c329 100644
--- a/legacy_promotions/lib/components/admin/solidus_admin/promotion_categories/edit/component.html.erb
+++ b/legacy_promotions/lib/components/admin/solidus_admin/promotion_categories/edit/component.html.erb
@@ -1,4 +1,4 @@
-<%= turbo_frame_tag :resource_modal, target: "_top" do %>
+<%= turbo_frame_tag :resource_form, target: "_top" do %>
<%= render component("ui/modal").new(title: t(".title")) do |modal| %>
<%= form_for @promotion_category, url: form_url, html: { id: form_id } do |f| %>
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 35f8574f999..e8d0fa6ea81 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
@@ -14,7 +14,7 @@ def edit_path(record)
end
def turbo_frames
- %w[resource_modal]
+ %w[resource_form]
end
def page_actions
@@ -22,7 +22,7 @@ def page_actions
tag: :a,
text: t('.add'),
href: solidus_admin.new_promotion_category_path(**search_filter_params),
- data: { turbo_frame: :resource_modal },
+ data: { turbo_frame: :resource_form },
icon: "add-line",
)
end
@@ -50,7 +50,7 @@ def name_column
header: :name,
data: ->(record) do
link_to record.name, edit_path(record),
- data: { turbo_frame: :resource_modal },
+ data: { turbo_frame: :resource_form },
class: 'body-link'
end
}
@@ -61,7 +61,7 @@ def code_column
header: :code,
data: ->(record) do
link_to record.code, edit_path(record),
- data: { turbo_frame: :resource_modal },
+ data: { turbo_frame: :resource_form },
class: 'body-link'
end
}
diff --git a/legacy_promotions/lib/components/admin/solidus_admin/promotion_categories/new/component.html.erb b/legacy_promotions/lib/components/admin/solidus_admin/promotion_categories/new/component.html.erb
index f0f59dc8548..6bb6300c329 100644
--- a/legacy_promotions/lib/components/admin/solidus_admin/promotion_categories/new/component.html.erb
+++ b/legacy_promotions/lib/components/admin/solidus_admin/promotion_categories/new/component.html.erb
@@ -1,4 +1,4 @@
-<%= turbo_frame_tag :resource_modal, target: "_top" do %>
+<%= turbo_frame_tag :resource_form, target: "_top" do %>
<%= render component("ui/modal").new(title: t(".title")) do |modal| %>
<%= form_for @promotion_category, url: form_url, html: { id: form_id } do |f| %>
diff --git a/promotions/lib/components/admin/solidus_promotions/promotion_categories/edit/component.html.erb b/promotions/lib/components/admin/solidus_promotions/promotion_categories/edit/component.html.erb
index f0f59dc8548..6bb6300c329 100644
--- a/promotions/lib/components/admin/solidus_promotions/promotion_categories/edit/component.html.erb
+++ b/promotions/lib/components/admin/solidus_promotions/promotion_categories/edit/component.html.erb
@@ -1,4 +1,4 @@
-<%= turbo_frame_tag :resource_modal, target: "_top" do %>
+<%= turbo_frame_tag :resource_form, target: "_top" do %>
<%= render component("ui/modal").new(title: t(".title")) do |modal| %>
<%= form_for @promotion_category, url: form_url, html: { id: form_id } do |f| %>
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 d908005d267..9ff6b534244 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
@@ -14,7 +14,7 @@ def edit_path(record)
end
def turbo_frames
- %w[resource_modal]
+ %w[resource_form]
end
def page_actions
@@ -22,7 +22,7 @@ def page_actions
tag: :a,
text: t(".add"),
href: solidus_promotions.new_promotion_category_path(**search_filter_params),
- data: { turbo_frame: :resource_modal },
+ data: { turbo_frame: :resource_form },
icon: "add-line"
)
end
@@ -50,7 +50,7 @@ def name_column
header: :name,
data: ->(record) do
link_to record.name, edit_path(record),
- data: { turbo_frame: :resource_modal },
+ data: { turbo_frame: :resource_form },
class: 'body-link'
end
}
@@ -61,7 +61,7 @@ def code_column
header: :code,
data: ->(record) do
link_to record.code, edit_path(record),
- data: { turbo_frame: :resource_modal },
+ data: { turbo_frame: :resource_form },
class: 'body-link'
end
}
diff --git a/promotions/lib/components/admin/solidus_promotions/promotion_categories/new/component.html.erb b/promotions/lib/components/admin/solidus_promotions/promotion_categories/new/component.html.erb
index f0f59dc8548..6bb6300c329 100644
--- a/promotions/lib/components/admin/solidus_promotions/promotion_categories/new/component.html.erb
+++ b/promotions/lib/components/admin/solidus_promotions/promotion_categories/new/component.html.erb
@@ -1,4 +1,4 @@
-<%= turbo_frame_tag :resource_modal, target: "_top" do %>
+<%= turbo_frame_tag :resource_form, target: "_top" do %>
<%= render component("ui/modal").new(title: t(".title")) do |modal| %>
<%= form_for @promotion_category, url: form_url, html: { id: form_id } do |f| %>