1
0

Added nutrient view on ingredients index

Created custom plugin's stylesheet
This commit is contained in:
cryptogopher
2019-09-24 23:41:22 +02:00
parent 9664df4888
commit 0001b56ca6
9 changed files with 72 additions and 3 deletions

View File

@@ -3,8 +3,10 @@
<% end %>
<div class="contextual">
<%= link_to t(".heading_nutrient_view"), nutrients_project_ingredients_path(@project),
:class => 'icon icon-stats' %>
<% if User.current.allowed_to?(:manage_common, @project) %>
<%= link_to t(".heading_import_ingredients"), '#', :class => 'icon icon-file',
<%= link_to t(".heading_import_ingredients"), '#', :class => 'icon icon-multiple',
:onclick => 'showAndScrollTo("import-ingredients", "filename"); return false;' %>
<%= link_to t(".heading_new_ingredient"), '#', :class => 'icon icon-add',
:onclick => 'showAndScrollTo("add-ingredient", "ingredient_name"); return false;' %>

View File

@@ -0,0 +1,34 @@
<% content_for :sidebar do %>
<%= render :partial => 'body_trackers/sidebar' %>
<% end %>
<div class="contextual">
<%= link_to t(".heading_ingredient_list"), project_ingredients_path(@project),
:class => 'icon icon-list' %>
</div>
<h2><%= t ".heading" %></h2>
<% if @nutrients.any? %>
<table class="nutrients list">
<thead>
<tr>
<th><%= l(:field_name) %></th>
<% @header.each do |q| %>
<th><%= q.name %></th>
<% end %>
</tr>
</thead>
<tbody>
<% @nutrients.each do |name, values| %>
<tr class="ingredient">
<td class="name"><%= name %></td>
<% @header.each do |q| %>
<td class="value"><%= values[q.id] || '-' %></td>
<% end %>
</tr>
<% end %>
</tbody>
</table>
<% else %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>