Unit#edit action

This commit is contained in:
cryptogopher 2024-01-22 02:33:23 +01:00
parent a7f80a575c
commit 5ea1f87824
3 changed files with 11 additions and 2 deletions

View File

@ -1,6 +1,6 @@
<tr id="<%= dom_id(unit) %>">
<td class="<%= class_names('link', {subunit: unit.base}) %>">
<%= link_to unit.symbol, edit_unit_path(unit) %>
<%= link_to unit.symbol, edit_unit_path(unit), data: {turbo_stream: true} %>
</td>
<td><%= unit.name %></td>
<td class="number"><%= scientifize(unit.multiplier) if unit.multiplier %></td>

View File

@ -1 +0,0 @@
/var/www/app/views/units/new.html.erb

View File

@ -0,0 +1,10 @@
<%# TODO: make sure turbo_stream layout is used in new/edit %>
<%= turbo_stream.disable :add_unit %>
<%= turbo_stream.disable_all 'td.actions .button' %>
<%= turbo_stream.replace @unit, partial: 'form' %>
<%= turbo_stream.update :unit_form_frame do %>
<%= form_with model: @unit, html: {id: :unit_form} do %>
<% end %>
<% end %>