forked from fixin.me/fixin.me
Add Quantity #edit and #update
This commit is contained in:
13
app/views/quantities/edit.turbo_stream.erb
Normal file
13
app/views/quantities/edit.turbo_stream.erb
Normal file
@@ -0,0 +1,13 @@
|
||||
<% ids = {row: dom_id(@quantity, :edit),
|
||||
hidden_row: dom_id(@quantity),
|
||||
link: nil,
|
||||
form_tag: dom_id(@quantity, :edit, :form)} %>
|
||||
|
||||
<%= turbo_stream.append :quantity_form do %>
|
||||
<%- tabular_form_with model: @quantity, html: {id: ids[:form_tag]} do %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<%= turbo_stream.hide ids[:hidden_row] %>
|
||||
<%= turbo_stream.remove ids[:row] %>
|
||||
<%= turbo_stream.after @quantity, partial: 'form', locals: ids -%>
|
||||
4
app/views/quantities/update.turbo_stream.erb
Normal file
4
app/views/quantities/update.turbo_stream.erb
Normal file
@@ -0,0 +1,4 @@
|
||||
<%= turbo_stream.close_form dom_id(@quantity, :edit) %>
|
||||
<% @ancestors.map do |ancestor| %>
|
||||
<%= turbo_stream.replace ancestor %>
|
||||
<% end %>
|
||||
Reference in New Issue
Block a user