From 644f09664d4b639cee46c0091c07264171f37b83 Mon Sep 17 00:00:00 2001 From: Thomas von Deyen Date: Fri, 20 Dec 2024 23:04:27 +0100 Subject: [PATCH] Add user store credit: Load modal with turbo frame --- .../users/store_credits/index/component.html.erb | 9 +++++++-- .../users/store_credits/new/component.html.erb | 1 - .../solidus_admin/users/store_credits/new/component.rb | 1 - 3 files changed, 7 insertions(+), 4 deletions(-) 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 d5eefee139..43e7852966 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 @@ -5,9 +5,14 @@ <%= page_header_actions do %> <%= render component("ui/button").new( - "data-action": "click->#{stimulus_id}#actionButtonClicked", - "data-#{stimulus_id}-url-param": solidus_admin.new_user_store_credit_path(user_id: @user.id, _turbo_frame: :new_store_credit_modal), + tag: :a, + href: solidus_admin.new_user_store_credit_path(user_id: @user.id), + data: { + turbo_frame: :new_store_credit_modal, + turbo_prefetch: false + }, text: t(".add_store_credit"), + icon: "add-line" )%> <% end %> <% 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 d90ebf1c12..39bb8c48cf 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 @@ -28,4 +28,3 @@ <% end %> <% end %> <% end %> -<%= render component("users/store_credits/index").new(user: @user, store_credits: @store_credits) %> diff --git a/admin/app/components/solidus_admin/users/store_credits/new/component.rb b/admin/app/components/solidus_admin/users/store_credits/new/component.rb index afecb8b683..bebe6ff4d6 100644 --- a/admin/app/components/solidus_admin/users/store_credits/new/component.rb +++ b/admin/app/components/solidus_admin/users/store_credits/new/component.rb @@ -5,7 +5,6 @@ def initialize(user:, store_credit:, categories:) @user = user @store_credit = store_credit @store_credit_categories = categories - @store_credits = Spree::StoreCredit.where(user_id: @user.id).order(id: :desc) end def form_id