forked from fixin.me/fixin.me
43 lines
1.4 KiB
Plaintext
43 lines
1.4 KiB
Plaintext
<div class="rightside">
|
|
<% if current_user.at_least(:active) %>
|
|
<%= turbo_frame_tag target: dom_id(Unit.new) do %>
|
|
<%= image_link_to t('.add_unit'), 'plus-outline', new_unit_path, id: :add_unit,
|
|
onclick: 'this.style.visibility = "hidden";' %>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
|
|
<%= turbo_frame_tag 'unit_form_frame' %>
|
|
|
|
<table class="main items" id="units">
|
|
<thead>
|
|
<tr>
|
|
<th><%= User.human_attribute_name(:symbol).capitalize %></th>
|
|
<th><%= User.human_attribute_name(:name).capitalize %></th>
|
|
<th><%= User.human_attribute_name(:multiplier).capitalize %></th>
|
|
<% if current_user.at_least(:active) %>
|
|
<th><%= t :actions %></th>
|
|
<% end %>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr id="<%= dom_id(Unit.new) %>" is="turbo-frame"></tr>
|
|
|
|
<% 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) unless unit.multiplier == 1 %></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 %>
|
|
</tbody>
|
|
</table>
|