2017-07-05 09:16:55 +00:00
|
|
|
class Paper
|
|
|
|
include Mongoid::Document
|
|
|
|
include Mongoid::Timestamps
|
|
|
|
include OrbitModel::Status
|
|
|
|
include OrbitTag::Taggable
|
|
|
|
include OrbitCategory::Categorizable
|
|
|
|
include Slug
|
|
|
|
|
|
|
|
field :title,as: :slug_title, localize: true
|
2017-08-04 10:42:19 +00:00
|
|
|
field :period, type: DateTime
|
2017-07-05 09:16:55 +00:00
|
|
|
field :description, localize: true
|
|
|
|
field :mailed, type: Boolean, default: false
|
|
|
|
field :ready_to_send, type: Boolean, default: false
|
|
|
|
|
|
|
|
|
|
|
|
has_many :topics, :dependent => :destroy
|
|
|
|
|
|
|
|
|
|
|
|
scope :can_display, ->{where(:is_hidden=>false,:title.ne => "").order_by([:is_top, :desc])}
|
|
|
|
|
|
|
|
def self.find_by_param(input)
|
|
|
|
self.find_by(uid: input)
|
|
|
|
end
|
|
|
|
|
|
|
|
def send_epaper
|
|
|
|
self.ready_to_send = true
|
|
|
|
self.save
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|