35 lines
830 B
Ruby
35 lines
830 B
Ruby
class Admin::PageContentsController < OrbitAdminController
|
|
def index
|
|
@pages = Page.where(:module=>"page_content").page(params[:page]).per(10)
|
|
@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!
|
|
end
|
|
end
|