forked from fixin.me/fixin.me
Measurements#new form improvements
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
</td>
|
||||
|
||||
<td class="actions">
|
||||
<%= image_button_tag t(:delete), 'delete-outline', class: 'dangerous',
|
||||
<%= image_button_tag '', 'delete-outline', class: 'dangerous',
|
||||
formaction: discard_new_measurement_path(readout.quantity),
|
||||
formmethod: :get, formnovalidate: true, data: {turbo_stream: true} %>
|
||||
<%= form.hidden_field :quantity_id %>
|
||||
|
||||
@@ -1,21 +1,16 @@
|
||||
<%= tabular_form_with url: new_measurement_path, html: {id: :new_readouts_form} do %>
|
||||
<% if @readouts&.present? %>
|
||||
<fieldset>
|
||||
<%= tag.legend id: :new_readouts_form_legend %>
|
||||
<table class="items centered">
|
||||
<tbody id="readouts">
|
||||
<tr id="new_readouts_actions">
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td><div class="actions"><%= button_tag %></div></td>
|
||||
<td><div class="actions">
|
||||
<%= image_link_to t(:cancel), "close-outline", measurements_path,
|
||||
class: 'dangerous', name: :cancel,
|
||||
onclick: render_turbo_stream('form_close') %>
|
||||
</div></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
<%= tabular_fields_for Readout.new do |form| %>
|
||||
<fieldset>
|
||||
<legend>
|
||||
<%= tag.span id: :new_readouts_form_legend %>
|
||||
<%= image_link_to '', "close-outline", measurements_path, name: :cancel,
|
||||
class: 'dangerous', onclick: render_turbo_stream('form_close') %>
|
||||
</legend>
|
||||
<table class="items centered">
|
||||
<tbody id="readouts">
|
||||
<tr id="new_readouts_actions">
|
||||
<td colspan="4"><div class="actions centered"><%= form.button %></div></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
<div class="topside vflex">
|
||||
<% if current_user.at_least(:active) %>
|
||||
<%= render partial: 'form_frame' %>
|
||||
<%# 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(' ' * 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',
|
||||
formaction: new_measurement_path, **common_options -%>
|
||||
<%= 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',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<%= turbo_stream.replace :new_readouts_form do %>
|
||||
<%= turbo_stream.update :new_readouts_form do %>
|
||||
<%= render partial: 'form_frame' %>
|
||||
<% end if @prev_quantities.empty? %>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<% content_for :navigation, flush: true do %>
|
||||
<%= link_to svg_tag("pictograms/arrow-left-bold-outline") + t(:back),
|
||||
<%= link_to svg_tag("pictograms/arrow-left-bold-outline", t(:back)),
|
||||
request.referer.present? ? :back : root_path, class: 'tab' %>
|
||||
<% end %>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user