Skip to content

Commit

Permalink
Integrate turbo frame for address form
Browse files Browse the repository at this point in the history
  • Loading branch information
rainerdema committed Nov 15, 2023
1 parent 51631c2 commit 6bea277
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
href: solidus_admin.send("order_#{@type}_address_path", @order, address_id: address.id),
class: 'block text-black text-sm hover:bg-gray-50 p-2 mx-2 w-auto rounded-lg',
'data-action': "#{stimulus_id}#close",
'data-turbo-frame': address_frame_id
) do %>
<%= format_address(address) %>
<% end %>
Expand All @@ -35,7 +36,9 @@
</div>

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

<label class="flex gap-2 items-center">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ def form_id
@form_id ||= "#{stimulus_id}--form-#{@type}-#{@order.id}"
end

def address_frame_id
@table_frame_id ||= "#{stimulus_id}--#{@type}-address-frame-#{@order.id}"
end

def use_attribute
case @type
when 'ship'
Expand Down

0 comments on commit 6bea277

Please sign in to comment.