forked from fixin.me/fixin.me
9c51887024
Stretch inputs to column width in place of fixed sizing. Set minimum column widths for columns with form inputs. Simplify table operations by removing `thead` and adding sentinel. Manage empty table display with CSS only.
34 lines
1.3 KiB
Plaintext
34 lines
1.3 KiB
Plaintext
<div class="rightside-area buttongrid">
|
|
<% if current_user.at_least(:active) %>
|
|
<%= image_link_to t('.new_unit'), 'plus-outline', new_unit_path,
|
|
id: :new_unit_link, onclick: 'this.blur();', data: {turbo_stream: true} %>
|
|
<% end %>
|
|
<%= image_link_to t('.import_units'), 'download-outline', default_units_path,
|
|
class: 'tools-area' %>
|
|
</div>
|
|
|
|
<table class="main-area items-table">
|
|
<caption class="hint"><%= t '.no_items' %></caption>
|
|
|
|
<tbody>
|
|
<tr>
|
|
<th class="hmintext"><%= Unit.human_attribute_name(:symbol) %>
|
|
<th class="hminnumber"><%= Unit.human_attribute_name(:multiplier) %>
|
|
<th class="hexpand"><%= Unit.human_attribute_name(:description) %>
|
|
<% if current_user.at_least(:active) %>
|
|
<th><%= t :actions %>
|
|
<th>
|
|
|
|
<tr id="unit_" hidden
|
|
ondragover="dragOver(event)" ondrop="drop(event)"
|
|
ondragenter="dragEnter(event)" ondragleave="dragLeave(event)"
|
|
data-drop-id="unit_" data-drop-id-param="<%= field_name(:unit, :base_id) %>">
|
|
<th colspan="5"><%= t '.top_level_drop' %>
|
|
<% end %>
|
|
|
|
<%= render @units %>
|
|
<%# Hidden rows with IDs allow simplier row insertion by using only
|
|
turbo_stream #after/#before instead of #after + #prepend/#before + #append. %>
|
|
<tr id="endmark" hidden>
|
|
</table>
|