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
84 lines
3.5 KiB
Plaintext
84 lines
3.5 KiB
Plaintext
<%= render partial: 'measurements/filters',
|
|
locals: {url: filter_project_measurements_path(@project)} %>
|
|
|
|
<% if @measurements.any? %>
|
|
<%= render partial: 'measurements/options' %>
|
|
|
|
<% formulas = @quantities.map { |q| q.formula } %>
|
|
<% formulas.unshift(@formula_q.formula) if @formula_q %>
|
|
<%= error_messages_for *formulas %>
|
|
|
|
<table class="readouts list odd-even">
|
|
<thead>
|
|
<tr>
|
|
<% total_width = 3 + @quantities.length %>
|
|
<th style="width:<%= 2 * 100/total_width%>%"><%= l(:field_taken_at_date) %></th>
|
|
<% @quantities.each do |q| %>
|
|
<th style="width:<%= 100/total_width %>%" class="closable ellipsible">
|
|
<div style="float:right;position:relative;">
|
|
<%= link_to '',
|
|
toggle_column_measurement_routine_path(@routine, quantity_id: q.id),
|
|
{class: "icon icon-close", method: :post, remote: true} %>
|
|
</div>
|
|
<%= q.name %>
|
|
</th>
|
|
<% end %>
|
|
<th style="width:<%= 100/total_width %>%"><%= l(:field_action) %></th>
|
|
</tr>
|
|
</thead>
|
|
|
|
<tbody>
|
|
<% @measurements.each_with_index do |m, index| %>
|
|
<% row_class = "measurement #{cycle('odd', 'even')}" %>
|
|
<tr id="measurement-<%= m.id %>" class="primary <%= row_class %>">
|
|
<td class="date unwrappable" style="cursor: pointer;"
|
|
onclick="$(this).closest('tr').toggle(); $(this).closest('tr').nextUntil('tr.primary', '.measurement').toggle(); return false;">
|
|
<span class="icon icon-bullet-closed"><%= format_datetime(m) %></span>
|
|
</td>
|
|
<% @requested_r[index].each do |*, value| %>
|
|
<td class="primary value ellipsible"><%= format_value(value) %></td>
|
|
<% end %>
|
|
<td class="action unwrappable"><%= action_links(m) %></td>
|
|
</tr>
|
|
|
|
<tr class="<%= row_class %>" style="display:none">
|
|
<% if @quantities.length > 0
|
|
rows = (@extra_r[index].length - 1) / @quantities.length + 2
|
|
else
|
|
rows = 1
|
|
end %>
|
|
<td rowspan="<%= rows %>" class="date unwrappable" style="cursor: pointer;"
|
|
onclick="$(this).closest('tr').prev('tr.primary').toggle(); $(this).closest('tr').prev('tr.primary').nextUntil('tr.primary', '.measurement').toggle(); return false;">
|
|
<span class="icon icon-bullet-open"><%= format_datetime(m) %></span>
|
|
</td>
|
|
<% @requested_r[index].each do |q, value| %>
|
|
<td class="primary quantity ellipsible">
|
|
<%= q.name %>
|
|
<p class="value"><%= format_value(value) %></p>
|
|
</td>
|
|
<% end %>
|
|
<td rowspan="<%= rows %>" class="action unwrappable"><%= action_links(m) %></td>
|
|
</tr>
|
|
|
|
<% next unless @quantities.length > 0 %>
|
|
<% @extra_r[index].each_slice(@quantities.length).with_index do |values| %>
|
|
<tr class="extra <%= row_class %>" style="display:none">
|
|
<% values.each do |q, value| %>
|
|
<td class="extra quantity ellipsible">
|
|
<%= q.name if value %>
|
|
<p class="value"><%= format_value(value) %></p>
|
|
</td>
|
|
<% end %>
|
|
<% if @quantities.length > values.length %>
|
|
<td class="space" colspan="<%= @quantities.length-values.length %>"></td>
|
|
<% end %>
|
|
</tr>
|
|
<% end %>
|
|
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
<% else %>
|
|
<p class="nodata"><%= l(:label_no_data) %></p>
|
|
<% end %>
|