forked from saurabh/orbit4-5
33 lines
781 B
Ruby
33 lines
781 B
Ruby
|
module OrbitModel
|
||
|
module Status
|
||
|
|
||
|
def self.included(base)
|
||
|
base.field :is_top, :type => Boolean, :default => false
|
||
|
base.field :is_hot, :type => Boolean, :default => false
|
||
|
base.field :is_hidden, :type => Boolean, :default => false
|
||
|
|
||
|
def is_top?
|
||
|
self.is_top
|
||
|
end
|
||
|
|
||
|
def is_hot?
|
||
|
self.is_hot
|
||
|
end
|
||
|
|
||
|
def is_hidden?
|
||
|
self.is_hidden
|
||
|
end
|
||
|
|
||
|
def status_for_table
|
||
|
status = ""
|
||
|
status << "<span class='label label-success'>#{I18n.t(:top)}</span> " if self.is_top
|
||
|
status << "<span class='label label-important'>#{I18n.t(:hot)}</span> " if self.is_hot
|
||
|
status << "<span class='label'>#{I18n.t(:hidden)}</span>"if self.is_hidden
|
||
|
status.html_safe
|
||
|
end
|
||
|
end
|
||
|
|
||
|
end
|
||
|
|
||
|
end
|