Clean up and improve items-table styling

Closes #9
This commit is contained in:
2026-03-25 18:42:24 +01:00
parent 33004f62bd
commit d893e59293
13 changed files with 109 additions and 150 deletions

View File

@@ -5,7 +5,7 @@
</td>
<% if current_user.at_least(:active) %>
<td class="actions">
<td class="flex">
<% unless unit.portable.nil? %>
<% if unit.default? %>
<%= image_button_to_if unit.portable?, t('.import'), 'download-outline',

View File

@@ -23,10 +23,10 @@
</head>
<body>
<header class="hflex">
<header class="flex">
<%= image_link_to t(".source_code"), "code-braces", source_code_url %>
<%= image_link_to t(".issue_tracker"), "bug-outline", issue_tracker_url,
class: "extendedright" %>
class: "rextend" %>
<% if user_signed_in? %>
<%= image_link_to_unless_current(current_user, "account-wrench-outline",
edit_user_registration_path) %>

View File

@@ -1,13 +1,13 @@
<%= tabular_form_with model: Measurement.new, id: :measurement_form,
class: 'topside-area vflex centered',
class: 'topside-area flex vertical center',
html: {onkeydown: 'formProcessKey(event)'} do |form| %>
<table class="items-table centered">
<table class="items-table center">
<tbody id="readouts">
<%= tabular_fields_for @measurement do |form| %>
<tr class="italic">
<td class="hexpand hmin50"><%= t '.taken_at_html' %></td>
<td colspan="3" class="number">
<td colspan="3" class="ralign">
<%= form.datetime_field :taken_at, required: true %>
</td>
</tr>
@@ -16,7 +16,7 @@
</table>
<%# TODO: right-click selection; unnecessary with hierarchical tags? %>
<details id="quantity_select" class="centered hexpand" open
<details id="quantity_select" class="center hexpand" open
onkeydown="detailsProcessKey(event)">
<summary autofocus>
<!-- TODO: Set content with CSS when span empty to avoid duplication -->
@@ -30,7 +30,7 @@
<ul><%= quantities_check_boxes(@quantities) %></ul>
</details>
<div class="hflex reverse">
<div class="flex reverse">
<%= form.button id: :create_measurement_button, disabled: true -%>
<%= image_link_to t(:cancel), "close-outline", measurements_path, name: :cancel,
class: 'dangerous', onclick: render_turbo_stream('form_close') %>

View File

@@ -9,7 +9,7 @@
<%= form.text_area :description, cols: 30, rows: 1, escape: false %>
</td>
<td class="actions">
<td class="flex">
<%= form.button %>
<%= image_link_to t(:cancel), "close-outline", quantities_path, class: 'dangerous',
name: :cancel, onclick: render_turbo_stream('form_close', {row: row}) %>

View File

@@ -5,14 +5,14 @@
data: {drag_path: reparent_quantity_path(quantity), drop_id: dom_id(quantity),
drop_id_param: "quantity[parent_id]"} do %>
<td class="link" style="--depth:<%= quantity.depth %>">
<%= link_to quantity, edit_quantity_path(quantity), onclick: 'this.blur();',
data: {turbo_stream: true} %>
<td style="--depth:<%= quantity.depth %>">
<%= link_to quantity, edit_quantity_path(quantity), class: 'link',
onclick: 'this.blur();', data: {turbo_stream: true} %>
</td>
<td><%= quantity.description %></td>
<% if current_user.at_least(:active) %>
<td class="actions">
<td class="flex">
<%= image_link_to t('.new_subquantity'), 'plus-outline', new_quantity_path(quantity),
id: dom_id(quantity, :new, :link), onclick: 'this.blur();', data: {turbo_stream: true} %>

View File

@@ -15,7 +15,7 @@
<thead>
<tr>
<th><%= Quantity.human_attribute_name(:name) %></th>
<th><%= Quantity.human_attribute_name(:description) %></th>
<th class="hexpand"><%= Quantity.human_attribute_name(:description) %></th>
<% if current_user.at_least(:active) %>
<th><%= t :actions %></th>
<th></th>

View File

@@ -4,17 +4,17 @@
<td>
<%# TODO: add grayed readout index (in separate column?) %>
<%= readout.quantity.relative_pathname(@superquantity) %>
<%= form.hidden_field :quantity_id %>
</td>
<td>
<%= form.number_field :value, required: true, autofocus: readout_counter == 0 %>
</td>
<td>
<%= form.hidden_field :quantity_id %>
<%= form.collection_select :unit_id, @user_units, :id,
->(u){ sanitize('&emsp;' * (u.base_id ? 1 : 0) + u.symbol) },
{prompt: '', disabled: '', selected: ''}, required: true %>
</td>
<td class="actions">
<td class="flex">
<%# TODO: change to _link_ after giving up displaying relative paths %>
<%= image_button_tag '', 'delete-outline', class: 'dangerous', name: nil,
formaction: discard_readouts_path(readout.quantity),

View File

@@ -8,11 +8,11 @@
<td>
<%= form.text_area :description, cols: 30, rows: 1, escape: false %>
</td>
<td class="number">
<td>
<%= form.number_field :multiplier, required: true, size: 10, min: :step if @unit.base_id? %>
</td>
<td class="actions">
<td class="flex">
<%= form.button %>
<%= image_link_to t(:cancel), "close-outline", units_path, class: 'dangerous',
name: :cancel, onclick: render_turbo_stream('form_close', {row: row}) %>

View File

@@ -6,14 +6,15 @@
drop_id: dom_id(unit.base || unit),
drop_id_param: "unit[base_id]"} do %>
<td class="link" style="--depth:<%= unit.base_id? ? 1 : 0 %>">
<%= link_to unit, edit_unit_path(unit), onclick: 'this.blur();', data: {turbo_stream: true} %>
<td style="--depth:<%= unit.base_id? ? 1 : 0 %>">
<%= link_to unit, edit_unit_path(unit), class: 'link', onclick: 'this.blur();',
data: {turbo_stream: true} %>
</td>
<td><%= unit.description %></td>
<td class="number"><%= unit.multiplier.to_html %></td>
<td class="ralign"><%= unit.multiplier.to_html %></td>
<% if current_user.at_least(:active) %>
<td class="actions">
<td class="flex">
<% unless unit.base_id? %>
<%= image_link_to t('.new_subunit'), 'plus-outline', new_unit_path(unit),
id: dom_id(unit, :new, :link), onclick: 'this.blur();', data: {turbo_stream: true} %>

View File

@@ -14,7 +14,7 @@
<thead>
<tr>
<th><%= Unit.human_attribute_name(:symbol) %></th>
<th><%= Unit.human_attribute_name(:description) %></th>
<th class="hexpand"><%= Unit.human_attribute_name(:description) %></th>
<th><%= Unit.human_attribute_name(:multiplier) %></th>
<% if current_user.at_least(:active) %>
<th><%= t :actions %></th>

View File

@@ -11,7 +11,7 @@
<tbody>
<% @users.each do |user| %>
<tr>
<td class="link"><%= link_to user, user_path(user) %></td>
<td><%= link_to user, user_path(user), class: 'link' %></td>
<td>
<% if user == current_user %>
<%= user.status %>
@@ -22,11 +22,11 @@
<% end %>
<% end %>
</td>
<td class="svg">
<td>
<%= svg_tag 'pictograms/checkbox-marked-outline' if user.confirmed_at.present? %>
</td>
<td><%= l user.created_at, format: :without_tz %></td>
<td class="actions">
<td class="flex">
<% if allow_disguise?(user) %>
<%= image_link_to t('.disguise'), 'incognito', disguise_user_path(user) %>
<% end %>

View File

@@ -8,7 +8,7 @@
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
</div>
<div class="actions">
<div class="flex">
<%= f.submit "Resend unlock instructions" %>
</div>
<% end %>