fixin.me/app/views/units/index.html.erb

33 lines
902 B
Plaintext

<div class="rightside">
<% if current_user.at_least(:active) %>
<%= image_link_to t('.add_unit'), 'plus-outline', new_unit_path, id: :add_unit,
onclick: 'this.blur();', data: {turbo_stream: true} %>
<% end %>
</div>
<%= tag.div id: :unit_form %>
<table class="main items">
<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 id="units">
<%= render(@units) || render_no_items %>
</tbody>
</table>
<%= javascript_tag do %>
function processKey(event) {
if (event.key == "Escape") {
event.target.closest("tr").querySelector("a[name=cancel]").click();
}
}
<% end %>