Added tags to homepage
This commit is contained in:
parent
cc398bd9d8
commit
b09b3eb196
@ -10,6 +10,13 @@ class RecipeDecorator < BaseDecorator
|
|||||||
end
|
end
|
||||||
end
|
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
|
||||||
|
|
||||||
def source_markup
|
def source_markup
|
||||||
uri = begin
|
uri = begin
|
||||||
URI.parse(self.source)
|
URI.parse(self.source)
|
||||||
|
@ -67,6 +67,7 @@ class RecipeIngredient < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def to_mass
|
def to_mass
|
||||||
|
if ingredient
|
||||||
value_unit = as_value_unit
|
value_unit = as_value_unit
|
||||||
density = self.ingredient.density? ? UnitConversion.parse(ingredient.density) : nil
|
density = self.ingredient.density? ? UnitConversion.parse(ingredient.density) : nil
|
||||||
|
|
||||||
@ -81,6 +82,7 @@ class RecipeIngredient < ApplicationRecord
|
|||||||
self.units = value_unit.unit.to_s
|
self.units = value_unit.unit.to_s
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def custom_unit?
|
def custom_unit?
|
||||||
self.ingredient && self.ingredient.custom_unit_weight(self.units).present?
|
self.ingredient && self.ingredient.custom_unit_weight(self.units).present?
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th><%= index_sort_header('Name', :name, @criteria) %></th>
|
<th><%= index_sort_header('Name', :name, @criteria) %></th>
|
||||||
|
<th>Tags</th>
|
||||||
<th><%= index_sort_header('Rating', :rating, @criteria) %></th>
|
<th><%= index_sort_header('Rating', :rating, @criteria) %></th>
|
||||||
<th>Yields</th>
|
<th>Yields</th>
|
||||||
<th><%= index_sort_header('Time', :total_time, @criteria) %></th>
|
<th><%= index_sort_header('Time', :total_time, @criteria) %></th>
|
||||||
@ -32,6 +33,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>
|
<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'}) %>
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
<% if @scale %>
|
<% if @scale %>
|
||||||
<span class="label label-default"><%= @scale %> X</span>
|
<span class="label label-default"><%= @scale %> X</span>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<br/>
|
||||||
|
<small><%= @recipe.tag_names %></small>
|
||||||
</h1>
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
<p class="lead">
|
<p class="lead">
|
||||||
|
Loading…
Reference in New Issue
Block a user