Senpai Silox Styling Suggestions

This commit is contained in:
David Vandorpe 2015-07-08 13:31:32 +02:00
parent a8055d6f09
commit 91945b6983
3 changed files with 8 additions and 8 deletions

View file

@ -13,7 +13,7 @@
# avatar_updated_at :datetime
# category :integer default("0")
# stock :integer default("0"), not null
# calories :integer default("0"), not null // expressed in kcal
# calories :integer default("0") // expressed in kcal
#
class Product < ActiveRecord::Base
@ -25,7 +25,7 @@ class Product < ActiveRecord::Base
validates :name, presence: true
validates :price_cents, numericality: { only_integer: true, greater_than_or_equal_to: 0 }
validates :stock, numericality: { only_integer: true, greater_than_or_equal_to: 0 }
validates :calories, numericality: { only_integer: true, :allow_nil => true, greater_than_or_equal_to: 0 }
validates :calories, numericality: { only_integer: true, allow_nil: true, greater_than_or_equal_to: 0 }
validates_attachment :avatar,
presence: true,
content_type: { content_type: ["image/jpeg", "image/gif", "image/png"] }

View file

@ -6,12 +6,12 @@
</div>
<div class="caption">
<h6>
<% if product.calories != nil %>
<%= content_tag( :small) do
concat( product.calories)
concat ' kcal'
<% if product.calories %>
<%= content_tag :small do
concat product.calories
concat ' kcal'
end
%>
%>
<% else %>
&nbsp;
<% end %>

View file

@ -5,7 +5,7 @@
</div>
<div class="caption">
<h6>
<% if product.calories != nil %>
<% if product.calories %>
<%= product.calories %> kcal
<% else %>
&nbsp;