forked from fixin.me/fixin.me
Render units from collection, without redirects
This commit is contained in:
@@ -1,15 +0,0 @@
|
||||
<% Unit.each_with_level(@units) do |unit, level| %>
|
||||
<tr>
|
||||
<td class="link">
|
||||
<%= link_to unit.symbol, edit_unit_path(unit), class: level > 0 ? 'subunit' : '' %>
|
||||
</td>
|
||||
<td><%= unit.name %></td>
|
||||
<td class="number"><%= scientifize(unit.multiplier) if unit.multiplier %></td>
|
||||
<% if current_user.at_least(:active) %>
|
||||
<td class="actions">
|
||||
<%= image_button_to t(".delete_unit"), "delete-outline", unit_path(unit),
|
||||
method: :delete %>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
13
app/views/units/_unit.html.erb
Normal file
13
app/views/units/_unit.html.erb
Normal file
@@ -0,0 +1,13 @@
|
||||
<tr>
|
||||
<td class="link">
|
||||
<%= link_to unit.symbol, edit_unit_path(unit), class: unit.base.nil? ? '' : 'subunit' %>
|
||||
</td>
|
||||
<td><%= unit.name %></td>
|
||||
<td class="number"><%= scientifize(unit.multiplier) if unit.multiplier %></td>
|
||||
<% if current_user.at_least(:active) %>
|
||||
<td class="actions">
|
||||
<%= image_button_to t(".delete_unit"), "delete-outline", unit_path(unit),
|
||||
method: :delete %>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
@@ -21,7 +21,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="units" is="turbo-frame">
|
||||
<%= render partial: 'index' %>
|
||||
<%= render(@units) || render_no_items %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
<%= turbo_stream.update :units do %>
|
||||
<%= render partial: 'index' %>
|
||||
<%= render(@units) || render_no_items %>
|
||||
<% end %>
|
||||
Reference in New Issue
Block a user