docbrown/app/controllers/admin/pages_controller.rb
Josh Puetz 1c566e0ec4
[deploy] Move /internal to `/admin (#9639)
* First draft - all the big changes

* Changing some more references to 'internal'

* Relocate internal request tests to admin

* Relocate internal system tests to admin

* Fix trailing space

* Test fix

* Move queries from internal to admin

* Docs updates

* Rename internal stimuls controllers to admin (plus docs)

* Rename admin layout

* Fix routing after rebase

* Fixes for latest added admin interfaces

* Serviceworker ignore paths
2020-08-07 10:36:26 -04:00

43 lines
843 B
Ruby

module Admin
class PagesController < Admin::ApplicationController
layout "admin"
def index
@pages = Page.all
end
def new
@page = Page.new
end
def edit
@page = Page.find(params[:id])
end
def update
@page = Page.find(params[:id])
@page.update!(page_params)
redirect_to "/admin/pages"
end
def create
@page = Page.new(page_params)
@page.save!
redirect_to "/admin/pages"
end
def destroy
@page = Page.find(params[:id])
@page.destroy
redirect_to "/admin/pages"
end
private
def page_params
allowed_params = %i[title slug body_markdown body_html body_json description template is_top_level_path
social_image]
params.require(:page).permit(allowed_params)
end
end
end