Skip to content

Commit db5b0fd

Browse files
committed
Integrate turbo frame for address form
1 parent c7e019b commit db5b0fd

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
<%= tag.a(
2626
href: solidus_admin.send("order_#{@type}_address_path", @order, address_id: address.id),
2727
class: 'block text-sm hover:bg-gray-50 p-2 mx-2 w-auto rounded',
28-
'data-action': "#{stimulus_id}#close"
28+
'data-action': "#{stimulus_id}#close",
29+
'data-turbo-frame': address_frame_id
2930
) do %>
3031
<%= format_address(address) %>
3132
<% end %>
@@ -37,7 +38,9 @@
3738
</div>
3839

3940
<div class="w-full flex gap-4">
40-
<%= render component('ui/forms/address').new(address: @address, form: "order[#{@type}_address_attributes]") %>
41+
<%= turbo_frame_tag address_frame_id do %>
42+
<%= render component('ui/forms/address').new(address: @address, form: "order[#{@type}_address_attributes]") %>
43+
<% end %>
4144
</div>
4245

4346
<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)