71 lines
2.7 KiB
Plaintext
71 lines
2.7 KiB
Plaintext
<% if @targets_by_date.any? %>
|
|
<%= render partial: 'targets/options' %>
|
|
|
|
<% formulas = @quantities.collect(&:formula) %>
|
|
<%= error_messages_for *formulas %>
|
|
|
|
<table id="targets" class="list odd-even">
|
|
<thead>
|
|
<% total_width = 2 + @quantities.length %>
|
|
<% header = quantities_table_header(@quantities) %>
|
|
<% header.each_with_index do |row, i| %>
|
|
<tr class="header">
|
|
<% if i == 0 %>
|
|
<th rowspan="<%= header.length %>" style="width:<%= 100/total_width %>%">
|
|
<%= l(:field_effective_from) %>
|
|
</th>
|
|
<% end %>
|
|
|
|
<% row.each do |q, span| %>
|
|
<% row_classes = [] %>
|
|
<% row_classes << 'interim' if (i < header.length-1) && (span >= 0) %>
|
|
<% row_classes << (span == 0 ? 'empty' : 'closable ellipsible') %>
|
|
<th <%= raw "class=\"#{row_classes.join(' ')}\"" unless row_classes.empty? %>
|
|
<%= "colspan=#{span}" if span > 0 %>
|
|
<%= "rowspan=#{-span}" if span < 0 %>
|
|
style="width: <%= [span, 1].max * 100/total_width %>%;"
|
|
title="<%= q.description %>">
|
|
<% unless span == 0 %>
|
|
<div style="float:right;position:relative;">
|
|
<% button_classes = 'icon' %>
|
|
<% if (i == header.length-1) || header[i+1].has_key?(q) || (span < -1) %>
|
|
<% button_classes += ' icon-close' %>
|
|
<% else %>
|
|
<% button_classes += ' icon-bullet-closed' %>
|
|
<% end %>
|
|
<%= link_to '', goal_toggle_exposure_path(@goal, quantity_id: q.id),
|
|
{class: button_classes, method: :post, remote: true} %>
|
|
</div>
|
|
<%= q.name %>
|
|
<% end %>
|
|
</th>
|
|
<% end %>
|
|
|
|
<% if i == 0 %>
|
|
<th rowspan="<%= header.length %>" style="width:<%= 100/total_width %>%;">
|
|
<%= l(:field_action) %>
|
|
</th>
|
|
<% end %>
|
|
</tr>
|
|
<% end %>
|
|
</thead>
|
|
|
|
<tbody>
|
|
<% @targets_by_date.each do |date, targets| %>
|
|
<tr id="date-<%= date %>" class="date <%= cycle('odd', 'even') %>">
|
|
<td class="topleft unwrappable">
|
|
<%= link_to(format_date(date), goal_target_path(@goal, date),
|
|
{remote: true, class: 'icon icon-arrow-right'}) %>
|
|
</td>
|
|
<% @quantities.each do |q| %>
|
|
<td class="primary right unwrappable"><%= raw targets[q].to_s %></td>
|
|
<% end %>
|
|
<td class="right shrunk unwrappable"><%= action_links(date) %></td>
|
|
</tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
<% else %>
|
|
<p class="nodata"><%= l(:label_no_data) %></p>
|
|
<% end %>
|