60 lines
2.4 KiB
Plaintext
60 lines
2.4 KiB
Plaintext
<% if @measurements.any? %>
|
|
<%= render partial: 'measurements/options' %>
|
|
|
|
<table class="readouts list odd-even">
|
|
<thead>
|
|
<tr>
|
|
<% total_width = 3 + @quantities.length %>
|
|
<th style="width:<%= 3 * 100/total_width%>%"><%= l(:field_taken_at_date) %></th>
|
|
<% @quantities.each do |q| %>
|
|
<th style="width:<%= 100/total_width %>%"><%= q.name %></th>
|
|
<% end %>
|
|
</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" style="cursor: pointer;" onclick="$(this).closest('tr').toggle(); $(this).closest('tr').nextUntil('tr.primary', 'tr').toggle(); return false;">
|
|
<span class="icon icon-bullet-closed"><%= format_datetime(m) %></span>
|
|
</td>
|
|
<% @requested_r[index].each do |*, value| %>
|
|
<td class="primary value"><%= format_value(value) %></td>
|
|
<% end %>
|
|
</tr>
|
|
|
|
<tr class="<%= row_class %>" style="display:none">
|
|
<td class="date" style="cursor: pointer;" onclick="$(this).closest('tr').prev('tr.primary').toggle(); $(this).closest('tr').prev('tr.primary').nextUntil('tr.primary', 'tr').toggle(); return false;">
|
|
<span class="icon icon-bullet-closed"><%= format_datetime(m) %></span>
|
|
</td>
|
|
<% @requested_r[index].each do |q_name, value| %>
|
|
<td class="primary">
|
|
<p class="quantity"><%= q_name %></p>
|
|
<p class="value"><%= format_value(value) %></p>
|
|
</td>
|
|
<% end %>
|
|
</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">
|
|
<td class="space"></td>
|
|
<% values.each do |q_name, value| %>
|
|
<td class="extra">
|
|
<p class="quantity"><%= q_name %></p>
|
|
<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 %>
|