pagecontent/app/controllers/admin/page_contents_controller.rb

35 lines
830 B
Ruby
Raw Normal View History

2014-05-06 09:20:15 +00:00
class Admin::PageContentsController < OrbitAdminController
2014-05-05 07:05:59 +00:00
def index
2014-07-04 08:10:42 +00:00
@pages = Page.where(:module=>"page_content").page(params[:page]).per(10)
2014-05-06 09:20:15 +00:00
@table_fields = ["Name","Version","Updated At","Last Modified By"]
end
def show
@page_context = PageContext.find(params[:id])
end
def new
@page = Page.find(params[:page_id])
@page_content = PageContext.new
end
def create
@page_content = PageContext.new(update_params)
@page_content.update_user_id = current_user.id
@page_content.save
redirect_to admin_page_contents_path
end
def view
@table_fields = ["Name","Version","Updated At","Last Modified By"]
@page = Page.find(params[:id])
@page_contexts = @page.page_contexts.desc(:version)
end
private
def update_params
params.require(:page_context).permit!
2014-05-05 07:05:59 +00:00
end
end