Skip to content

Commit 4e053bf

Browse files
committed
Integrate turbo frame for address form
1 parent cc878bd commit 4e053bf

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

admin/app/components/solidus_admin/orders/show/address/component.html.erb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
href: solidus_admin.send("order_#{@type}_address_path", @order, address_id: address.id),
2626
class: 'block text-black text-sm hover:bg-gray-50 p-2 mx-2 w-auto rounded-lg',
2727
'data-action': "#{stimulus_id}#close",
28+
'data-turbo-frame': address_frame_id
2829
) do %>
2930
<%= format_address(address) %>
3031
<% end %>
@@ -35,7 +36,9 @@
3536
</div>
3637

3738
<div class="w-full flex gap-4">
38-
<%= render component('ui/forms/address').new(address: @address, name: "order[#{@type}_address_attributes]") %>
39+
<%= turbo_frame_tag address_frame_id do %>
40+
<%= render component('ui/forms/address').new(address: @address, name: "order[#{@type}_address_attributes]") %>
41+
<% end %>
3942
</div>
4043

4144
<label class="flex gap-2 items-center">

admin/app/components/solidus_admin/orders/show/address/component.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ def form_id
1616
@form_id ||= "#{stimulus_id}--form-#{@type}-#{@order.id}"
1717
end
1818

19+
def address_frame_id
20+
@table_frame_id ||= "#{stimulus_id}--#{@type}-address-frame-#{@order.id}"
21+
end
22+
1923
def use_attribute
2024
case @type
2125
when 'ship'

0 commit comments

Comments
 (0)