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

21 lines
995 B
Plaintext

<div class="topside vflex">
<% if current_user.at_least(:active) %>
<%# TODO: show hint when no quantities/units defined %>
<%= tabular_form_with url: new_measurement_path,
html: {id: :new_readouts_form} do |f| %>
<% end %>
<div class="hflex">
<%= select_tag :id, options_from_collection_for_select(
@quantities, :id, ->(q){ sanitize('&emsp;' * q.depth + q.name) }
), form: :new_readouts_form %>
<% common_options = {form: :new_readouts_form, formmethod: :get,
formnovalidate: true, data: {turbo_stream: true}} %>
<%= image_button_tag t('.new_quantity'), 'plus-outline', **common_options -%>
<%= image_button_tag t('.new_children'), 'plus-multiple-outline',
formaction: new_measurement_path(:children), **common_options -%>
<%= image_button_tag t('.new_subtree'), 'plus-multiple-outline',
formaction: new_measurement_path(:subtree), **common_options -%>
</div>
<% end %>
</div>