# encoding: utf-8

class PageContext
  include Mongoid::Document
  include Mongoid::Timestamps
  include Mongoid::MultiParameterAttributes
  include Impressionist::Impressionable
  include OrbitCoreLib::ObjectAuthable

  is_impressionable :counter_cache => { :column_name => :view_count }

  field :context, localize: true

  field :create_user_id
  field :update_user_id
  field :version, :type => Integer , :default => 0
  field :view_count, :type => Integer, :default => 0
  
  field :archived, :type => Boolean, :default => false
  # field :current, :type => Boolean, :default => false
  
  belongs_to :page

  AfterObjectAuthUrl = '/panel/page_content/back_end/page_contexts'
  APP_NAME = 'page_content'
  ObjectAuthTitlesOptions = %W{Edit}
  
  def pp_object
    page.title
  end

  def is_top?
    self.is_top
  end
  
end