Added setting taken_at in measurement form
Changed action toggle -> retake
This commit is contained in:
@@ -4,11 +4,16 @@
|
||||
<p><%= f.select :source_id, source_options,
|
||||
{required: false, include_blank: t('.null_source')} %></p>
|
||||
<p><%= f.text_field :name, size: 40, required: true %></p>
|
||||
<p>
|
||||
<%= f.date_field :taken_at_date, required: true %>
|
||||
<%= f.time_field :taken_at_time, value: @measurement.taken_at.strftime("%H:%M"),
|
||||
required: true, label: '' %>
|
||||
</p>
|
||||
<% @measurement.readouts.each_with_index do |r, index| %>
|
||||
<%= f.fields_for 'readouts_attributes', r, index: '' do |ff| %>
|
||||
<p class="readout">
|
||||
<%= ff.select :quantity_id, quantity_options,
|
||||
{include_blank: true, label: (index > 0 ? '' : :field_readouts)} %>
|
||||
{include_blank: true, required: true, label: (index > 0 ? '' : :field_readouts)} %>
|
||||
<%= ff.number_field :value, {size: 8, step: :any, label: ''} %>
|
||||
<%= ff.select :unit_id, unit_options, {label: ''} %>
|
||||
<%= ff.check_box :_destroy, {style: "display:none", label: ''} %>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= l(:field_name) %></th>
|
||||
<th><%= l(:field_taken_at_date) %></th>
|
||||
<th><%= l(:field_source) %></th>
|
||||
<th style="width:10%"><%= l(:field_action) %></th>
|
||||
</tr>
|
||||
@@ -11,18 +12,14 @@
|
||||
<% @measurements.each do |m| %>
|
||||
<% next if m.new_record? %>
|
||||
<tr id="measurement-<%= m.id %>" class="measurement <%= 'hidden' if m.hidden %>">
|
||||
<td class="name">
|
||||
<%= link_to '', toggle_measurement_path(m), {
|
||||
remote: true,
|
||||
method: :post,
|
||||
class: "icon icon-eye"
|
||||
} %>
|
||||
<%= m.name %>
|
||||
</td>
|
||||
<td class="source">
|
||||
<%= m.source.name if m.source.present? %>
|
||||
</td>
|
||||
<td class="name"><%= m.name %></td>
|
||||
<td class="date"><%= m.taken_at.strftime("%F %R") %></td>
|
||||
<td class="source"><%= m.source.name if m.source.present? %></td>
|
||||
<td class="action">
|
||||
<%= link_to l(:button_retake), retake_measurement_path(m), {
|
||||
remote: true,
|
||||
class: "icon icon-reload"
|
||||
} %>
|
||||
<%= delete_link measurement_path(m), {remote: true, data: {}} %>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
3
app/views/measurements/index.js.erb
Normal file
3
app/views/measurements/index.js.erb
Normal file
@@ -0,0 +1,3 @@
|
||||
$('div[id^=flash_]').remove();
|
||||
$('#content').prepend('<%= escape_javascript(render_flash_messages) %>');
|
||||
$('#measurements').html('<%= escape_javascript(render partial: 'measurements/index') %>');
|
||||
Reference in New Issue
Block a user