Added MeasurementRoutine as a nested Measurement model
Updated ItemsWithQuantities to work with MeasurementRoutine Replaced ColumnViews HABTM with polymorphic HMT Added Measurement notes Added destroy restrictions on Quantity Replaced BodyTrackingPluginController with Finders concern Removed 'body_trackers' prefix from paths Unified styling for textarea
This commit is contained in:
@@ -1,17 +1,29 @@
|
||||
<%= error_messages_for @measurement %>
|
||||
|
||||
<div class="box tabular">
|
||||
<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>
|
||||
<fieldset class="box">
|
||||
<legend ><%= t('.label_routine') %></legend>
|
||||
<div class="tabular">
|
||||
<%= f.fields_for :routine do |ff| %>
|
||||
<p><%= ff.text_field :name, required: true, style: "width: 95%;" %></p>
|
||||
<p><%= ff.text_area :description, cols: 40, rows: 3, style: "width: 95%;" %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="box">
|
||||
<legend ><%= t('.label_measurement') %></legend>
|
||||
<div class="tabular">
|
||||
<p><%= f.select :source_id, source_options,
|
||||
{required: false, include_blank: t('.null_source')} %></p>
|
||||
<p><%= f.text_area :notes, cols: 40, rows: 1, style: "width: 95%;" %></p>
|
||||
<p>
|
||||
<%= f.date_field :taken_at_date, required: true %>
|
||||
<%= f.time_field :taken_at_time, value: format_time(@measurement), required: true,
|
||||
label: '' %>
|
||||
</p>
|
||||
<% @measurement.readouts.each_with_index do |r, index| %>
|
||||
<%= f.fields_for 'readouts_attributes', r, index: '' do |ff| %>
|
||||
<p class="readout">
|
||||
</p>
|
||||
<% @measurement.readouts.each_with_index do |r, index| %>
|
||||
<%= f.fields_for 'readouts_attributes', r, index: '' do |ff| %>
|
||||
<p class="readout">
|
||||
<%= ff.hidden_field :id %>
|
||||
<%= ff.select :quantity_id, quantity_options,
|
||||
{include_blank: true, required: true, label: (index > 0 ? '' : :field_readouts)} %>
|
||||
@@ -22,14 +34,15 @@
|
||||
class: 'icon icon-del',
|
||||
style: (@measurement.readouts.length > 1 ? "" : "display:none"),
|
||||
onclick: "deleteReadout(); return false;" %>
|
||||
</p>
|
||||
</p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<p>
|
||||
<p>
|
||||
<%= link_to t(".button_new_readout"), '#', class: 'icon icon-add',
|
||||
onclick: 'newReadout(); return false;' %>
|
||||
</p>
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<%= javascript_tag do %>
|
||||
function newReadout() {
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<td class="date unwrappable"><%= format_datetime(m) %></td>
|
||||
<td class="name">
|
||||
<div style="float:left;">
|
||||
<%= link_to m.name, readouts_measurement_path(m) %>
|
||||
<%= link_to m.routine.name, readouts_measurement_routine_path(m.routine) %>
|
||||
</div>
|
||||
<div style="float:right;">
|
||||
<small><%= " (#{pluralize(m.readouts.size, 'readout')})" %></small>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<fieldset id="options" class="collapsible">
|
||||
<legend onclick="toggleFieldset(this);"><%= l(:label_options) %></legend>
|
||||
<div>
|
||||
<%= form_tag toggle_column_measurement_path(@scoping_measurement),
|
||||
<%= form_tag toggle_column_measurement_routine_path(@routine),
|
||||
id: 'toggle-column-form', name: 'toggle-column-form',
|
||||
method: :post, remote: true do %>
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<th style="width:<%= 100/total_width %>%" class="closable ellipsible">
|
||||
<div style="float:right;position:relative;">
|
||||
<%= link_to '',
|
||||
toggle_column_measurement_path(@scoping_measurement, quantity_id: q.id),
|
||||
toggle_column_measurement_routine_path(@routine, quantity_id: q.id),
|
||||
{class: "icon icon-close", method: :post, remote: true} %>
|
||||
</div>
|
||||
<%= q.name %>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<h2>
|
||||
<%= link_to t("measurements.index.heading"), project_measurements_path(@project) %>
|
||||
>
|
||||
<%= @measurements.first.name %>
|
||||
<%= @routine.name %>
|
||||
</h2>
|
||||
<div id='readouts'>
|
||||
<%= render partial: 'measurements/readouts' %>
|
||||
|
||||
Reference in New Issue
Block a user