39 lines
902 B
Ruby
39 lines
902 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
|
|
if can_edit_or_delete?(nil)
|
|
@page = Page.find(params[:page_id])
|
|
@page_content = PageContext.new
|
|
else
|
|
render_401
|
|
end
|
|
end
|
|
|
|
def create
|
|
@page_content = PageContext.new(update_params)
|
|
@page_content.update_user_id = current_user.id
|
|
@page_content.save
|
|
redirect_to params['referer_url']
|
|
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
|