2012-02-21 11:22:42 +00:00
|
|
|
# encoding: utf-8
|
|
|
|
|
|
|
|
class PageContext
|
|
|
|
include Mongoid::Document
|
|
|
|
include Mongoid::Timestamps
|
|
|
|
include Mongoid::MultiParameterAttributes
|
2012-05-15 13:26:09 +00:00
|
|
|
include Impressionist::Impressionable
|
2012-05-14 04:34:15 +00:00
|
|
|
include OrbitCoreLib::ObjectAuthable
|
|
|
|
|
2012-05-15 13:26:09 +00:00
|
|
|
is_impressionable :counter_cache => { :column_name => :view_count }
|
|
|
|
|
2012-02-21 11:22:42 +00:00
|
|
|
has_one :context, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy
|
|
|
|
|
|
|
|
field :create_user_id
|
|
|
|
field :update_user_id
|
2012-02-23 07:13:36 +00:00
|
|
|
field :version, :type => Integer , :default => 0
|
2012-05-15 13:26:09 +00:00
|
|
|
field :view_count, :type => Integer, :default => 0
|
2012-02-21 11:22:42 +00:00
|
|
|
|
2012-02-23 07:13:36 +00:00
|
|
|
field :archived, :type => Boolean, :default => false
|
|
|
|
# field :current, :type => Boolean, :default => false
|
2012-02-21 11:22:42 +00:00
|
|
|
|
|
|
|
belongs_to :page
|
|
|
|
|
2012-05-14 04:34:15 +00:00
|
|
|
AfterObjectAuthUrl = '/panel/page_content/back_end/page_contexts'
|
|
|
|
APP_NAME = 'page_content'
|
|
|
|
ObjectAuthTitlesOptions = %W{Edit}
|
|
|
|
|
|
|
|
def pp_object
|
|
|
|
page.i18n_variable[I18n.locale]
|
|
|
|
end
|
|
|
|
|
2012-02-21 11:22:42 +00:00
|
|
|
def is_top?
|
|
|
|
self.is_top
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|