2019-05-28 15:54:32 +00:00
|
|
|
class EPaperTopic
|
2024-11-15 10:20:00 +00:00
|
|
|
|
2019-05-28 15:54:32 +00:00
|
|
|
include Mongoid::Document
|
|
|
|
include Mongoid::Timestamps
|
|
|
|
include OrbitModel::Status
|
|
|
|
include OrbitCategory::Categorizable
|
|
|
|
include OrbitTag::Taggable
|
2024-11-15 10:20:00 +00:00
|
|
|
include Slug
|
2019-05-28 15:54:32 +00:00
|
|
|
|
|
|
|
field :title,as: :slug_title, localize: true
|
|
|
|
field :period, type: DateTime
|
|
|
|
field :description, localize: true
|
|
|
|
field :content, localize: true
|
|
|
|
field :mailed, type: Boolean, default: false
|
|
|
|
field :ready_to_send, type: Boolean, default: false
|
|
|
|
field :article_authors, type: Array, default: []
|
|
|
|
|
|
|
|
mount_uploader :image, ImageUploader
|
|
|
|
|
|
|
|
scope :can_display, ->{where(:is_hidden=>false,:title.ne => "").order_by([:period, :desc])}
|
|
|
|
|
|
|
|
def article_author_profiles
|
|
|
|
MemberProfile.find(self.article_authors)
|
|
|
|
end
|
|
|
|
|
|
|
|
def criteria_title
|
2020-08-04 06:48:46 +00:00
|
|
|
PaperCriteria.where(:start_date.lte => self.period.in_time_zone(Time.zone.utc_offset / 3600), :end_date.gte => self.period.in_time_zone(Time.zone.utc_offset / 3600)).first.title rescue ""
|
2019-05-28 15:54:32 +00:00
|
|
|
end
|
2024-11-15 10:20:00 +00:00
|
|
|
end
|