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

View file

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

View file

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