orbit-basic/app/models/ad_banner.rb

31 lines
964 B
Ruby
Raw Normal View History

2012-01-31 10:31:31 +00:00
class AdBanner
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::MultiParameterAttributes
include OrbitTag::Taggable
include OrbitModel::Authorizable
2012-05-15 01:57:05 +00:00
2012-02-02 01:55:09 +00:00
field :ad_fx #TODO Design should explain
2013-10-18 07:25:19 +00:00
field :height, type: Integer
field :speed, type: Integer
field :title
field :timeout, type: Integer
field :width, type: Integer
2012-04-01 15:39:49 +00:00
has_many :ad_images , dependent: :delete
2013-10-18 07:25:19 +00:00
validates_uniqueness_of :title
validates :title, :length => { :minimum => 2 }
validates :height, :speed, :timeout, :width, :presence => true
2013-10-18 07:25:19 +00:00
FX_TYPES = ["blindX","blindY","blindZ","cover","curtainX","curtainY","fade","fadeZoom","growX","growY","scrollUp","scrollDown","scrollLeft","scrollRight","scrollHorz","scrollVert","shuffle","slideX","slideY","toss","turnUp","turnDown","turnLeft","turnRight","uncover","wipe","zoom"]
2013-10-18 07:25:19 +00:00
def size
"#{self.width} x #{self.height}"
end
2013-10-18 07:25:19 +00:00
def timeout_in_min
self.timeout*1000 rescue 0
2012-04-23 09:03:55 +00:00
end
2012-02-02 01:55:09 +00:00
2012-01-31 10:31:31 +00:00
end