pagecontent/app/controllers/page_contents_controller.rb

14 lines
527 B
Ruby

class PageContentsController < OrbitAdminController
def index
params = OrbitHelper.params
page = Page.where(:page_id => params[:page_id]).first
url_to_edit = OrbitHelper.user_can_edit?(page) ? "/admin/page_contents/new?page_id=#{page.id.to_s}" : ""
{
"html" => (page.page_contexts.last.content rescue ""),
"title" => (page.name rescue ""),
"view_count" => (page.view_count rescue ""),
"view-count-head" =>t('page_content.view_count'),
"url_to_edit" => url_to_edit
}
end
end