forked from fixin.me/fixin.me
Add stimulus-rails gem and wire up 7 controllers: - measurements_view_controller: view toggle (compact/wide) via localStorage - measurements_controller: grouped rows MutationObserver - charts_controller: Plotly chart rendering - form_controller: keyboard shortcuts (Escape/Enter) and submit validation - details_controller: quantity picker state, focusout close, MutationObserver - readout_unit_controller: default unit button enable/disable + PATCH submission - drag_controller: drag-and-drop for quantity reparenting and unit rebasing Remove all inline onclick/onkeydown/ondrag*/onsubmit handlers from templates. Remove all window.* global exports from application.js. Remove bare <script> block from measurements/_form.html.erb. Remove turbo:load listeners for behavior now in controller connect(). application.js now only contains: Turbo Stream custom action definitions and the showPage visibility listener. Document Stimulus conventions in CLAUDE.md. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
24 lines
849 B
Plaintext
24 lines
849 B
Plaintext
<%= tabular_fields_for @unit, form: form_tag do |form| %>
|
|
<%- tag.tr id: row, class: "form",
|
|
data: {controller: 'form', action: 'keydown->form#processKey',
|
|
link: link, form: form_tag, hidden_row: hidden_row} do %>
|
|
|
|
<td style="--depth:<%= @unit.base_id? ? 1 : 0 %>">
|
|
<%= form.text_field :symbol, required: true, autofocus: true, size: 12 %>
|
|
</td>
|
|
<td>
|
|
<%= form.text_area :description, cols: 30, rows: 1, escape: false %>
|
|
</td>
|
|
<td>
|
|
<%= form.number_field :multiplier, required: true, size: 10, min: :step if @unit.base_id? %>
|
|
</td>
|
|
|
|
<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}) %>
|
|
</td>
|
|
<td></td>
|
|
<% end %>
|
|
<% end %>
|