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