fixin.me/app/views/units/new.turbo_stream.erb
cryptogopher 759a0b31b7 Disable only form-opening link
Close other forms on new form open
2024-02-04 20:11:44 +01:00

21 lines
619 B
Plaintext

<% options = {partial: 'form', locals: {id: dom_id(@unit.base || @unit, :add)}} %>
<% if @unit.errors.present? %>
<%= turbo_stream.replace @unit, **options -%>
<% else %>
<%= turbo_stream.disable options[:locals][:id] -%>
<%= turbo_stream.click_all 'tbody a[name=cancel]' -%>
<%#= turbo_stream.blur_all %>
<% if @unit.base.nil? %>
<%= turbo_stream.prepend :units, **options -%>
<% else %>
<%= turbo_stream.after @unit.base, **options -%>
<% end %>
<%= turbo_stream.update :unit_form_frame do %>
<%= form_with model: @unit, html: {id: :unit_form} do %>
<% end %>
<% end %>
<% end %>