recipe list cleanup
This commit is contained in:
parent
fcb827cc77
commit
e3f480b476
@ -2,6 +2,10 @@
|
|||||||
// They will automatically be included in application.css.
|
// They will automatically be included in application.css.
|
||||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||||
|
|
||||||
|
div.table_tags {
|
||||||
|
width: 275px;
|
||||||
|
}
|
||||||
|
|
||||||
@mixin editor {
|
@mixin editor {
|
||||||
|
|
||||||
@extend .well;
|
@extend .well;
|
||||||
|
@ -10,11 +10,15 @@ class RecipeDecorator < BaseDecorator
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def created_at
|
||||||
|
wrapped.created_at ? wrapped.created_at.strftime('%D') : ''
|
||||||
|
end
|
||||||
|
|
||||||
def tag_names
|
def tag_names
|
||||||
tags = wrapped.tag_names
|
tags = wrapped.tag_names
|
||||||
tags.map do |t|
|
tags.map do |t|
|
||||||
h.content_tag('span', t, class: 'label label-default')
|
h.content_tag('span', t, class: 'label label-default')
|
||||||
end.join(' ').html_safe
|
end.join(' ').html_safe
|
||||||
end
|
end
|
||||||
|
|
||||||
def source_markup
|
def source_markup
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
<% decorate(@recipes, RecipeDecorator).each do |recipe| %>
|
<% decorate(@recipes, RecipeDecorator).each do |recipe| %>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= link_to recipe.short_name, recipe %></td>
|
<td><%= link_to recipe.short_name, recipe %></td>
|
||||||
<td><%= recipe.tag_names %></td>
|
<td><div class="table_tags"><%= recipe.tag_names %></div></td>
|
||||||
<td>
|
<td>
|
||||||
<% if recipe.rating %>
|
<% if recipe.rating %>
|
||||||
<%= text_field_tag('rating', recipe.rating, disabled: true, data: {rating: true, size: '20px', interval: '0.25'}) %>
|
<%= text_field_tag('rating', recipe.rating, disabled: true, data: {rating: true, size: '20px', interval: '0.25'}) %>
|
||||||
@ -57,17 +57,17 @@
|
|||||||
</td>
|
</td>
|
||||||
<td><%= recipe.yields %></td>
|
<td><%= recipe.yields %></td>
|
||||||
<td><%= recipe_time(recipe) %></td>
|
<td><%= recipe_time(recipe) %></td>
|
||||||
<td><%= timestamp(recipe.created_at) %></td>
|
<td><%= recipe.created_at %></td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<% if current_user? %>
|
<% if current_user? %>
|
||||||
<%= link_to new_recipe_log_path(recipe), class: 'btn btn-sm btn-primary' do %>
|
<%= link_to new_recipe_log_path(recipe), class: 'btn btn-xs btn-primary' do %>
|
||||||
<span class="glyphicon glyphicon-copy"></span>
|
<span class="glyphicon glyphicon-copy"></span>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= link_to edit_recipe_path(recipe), class: 'btn btn-sm btn-primary' do %>
|
<%= link_to edit_recipe_path(recipe), class: 'btn btn-xs btn-primary' do %>
|
||||||
<span class="glyphicon glyphicon-pencil"></span>
|
<span class="glyphicon glyphicon-pencil"></span>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= link_to recipe, method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-sm btn-danger' do %>
|
<%= link_to recipe, method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-xs btn-danger' do %>
|
||||||
<span class="glyphicon glyphicon-remove"></span>
|
<span class="glyphicon glyphicon-remove"></span>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
@ -98,15 +98,9 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<%= nutrient_row(@recipe, nutrition_data, 'Calories', :kcal) %>
|
<% NutritionData::NUTRIENTS.select { |_, v| v.present? }.each do |k, v| %>
|
||||||
<%= nutrient_row(@recipe, nutrition_data, 'g Protein', :protein) %>
|
<%= nutrient_row(@recipe, nutrition_data, v, k) %>
|
||||||
<%= nutrient_row(@recipe, nutrition_data, 'g Fat', :lipids) %>
|
<% end %>
|
||||||
<%= nutrient_row(@recipe, nutrition_data, 'g Carbohydrates', :carbohydrates) %>
|
|
||||||
<%= nutrient_row(@recipe, nutrition_data, 'mg Sodium', :sodium) %>
|
|
||||||
<%= nutrient_row(@recipe, nutrition_data, 'g Sugar', :sugar) %>
|
|
||||||
<%= nutrient_row(@recipe, nutrition_data, 'g Fiber', :fiber) %>
|
|
||||||
<%= nutrient_row(@recipe, nutrition_data, 'µg Vitamin K', :vit_k) %>
|
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user