1
0

Added Goal model and preliminary Targets index

This commit is contained in:
cryptogopher
2020-06-25 03:56:49 +02:00
parent 8240e5e868
commit 1dd2e2b596
18 changed files with 149 additions and 14 deletions

View File

@@ -1,6 +1,12 @@
<h3><%= t ".heading_body_trackers" %></h3>
<ul>
<li><%= link_to t(".link_summary"), project_body_trackers_path(@project) %></li>
<li>
<%= link_to t(".link_targets"), project_targets_path(@project) %>
/
<%#= link_to t(".link_goals"), nutrients_project_foods_path(@project) %>
Goals
</li>
</ul>
<h3><%= t ".heading_measurements" %></h3>

View File

@@ -0,0 +1,5 @@
<% if User.current.allowed_to?(:manage_common, @project) %>
<%= link_to t(".link_new_target"),
new_project_target_path(@project, @view_params),
{remote: true, class: 'icon icon-add'} %>
<% end %>

View File

@@ -0,0 +1,34 @@
<% if @targets.any? { |t| t.persisted? } %>
<table class="list">
<thead>
<tr>
<th style="width:5%"><%= l(:field_taken_at_date) %></th>
<th><%= l(:field_name) %></th>
<th><%= l(:field_notes) %></th>
<th><%= l(:field_source) %></th>
<th style="width:5%"><%= l(:field_action) %></th>
</tr>
</thead>
<tbody>
<% @measurements.each do |m| %>
<% next if m.new_record? %>
<tr id="measurement-<%= m.id %>" class="primary measurement">
<td class="date unwrappable"><%= format_datetime(m) %></td>
<td class="name">
<div style="float:left;">
<%= link_to m.routine.name, readouts_measurement_routine_path(m.routine) %>
</div>
<div style="float:right;">
<small><%= " (#{pluralize(m.readouts.size, 'readout')})" %></small>
</div>
</td>
<td class="notes ellipsible"><%= m.notes %></td>
<td class="source"><%= m.source.name if m.source.present? %></td>
<td class="action unwrappable"><%= action_links(m) %></td>
</tr>
<% end %>
</tbody>
</table>
<% else %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>

View File

@@ -0,0 +1,11 @@
<div class="contextual">
<%= render partial: 'targets/contextual' %>
</div>
<div id="new-target">
</div>
<h2><%= t ".heading" %></h2>
<div id='targets'>
<%= render partial: 'targets/index' %>
</div>