mirror of
https://github.com/danbee/danbarberphoto
synced 2025-03-04 08:49:07 +00:00
54 lines
1.2 KiB
Ruby
54 lines
1.2 KiB
Ruby
class Admin::PagesController < Admin::AdminController
|
|
|
|
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])
|
|
|
|
respond_to do |format|
|
|
if @page.update_attributes(params[:page])
|
|
format.html { redirect_to(admin_pages_path, :notice => 'Page was successfully updated.') }
|
|
format.xml { head :ok }
|
|
else
|
|
format.html { render :action => "edit" }
|
|
format.xml { render :xml => @page.errors, :status => :unprocessable_entity }
|
|
end
|
|
end
|
|
end
|
|
|
|
def create
|
|
@page = Page.new(params[:page])
|
|
|
|
respond_to do |format|
|
|
if @page.save
|
|
format.html { redirect_to(admin_pages_path, :notice => 'Page was successfully added.') }
|
|
format.xml { head :ok }
|
|
else
|
|
format.html { render :action => "edit" }
|
|
format.xml { render :xml => @page.errors, :status => :unprocessable_entity }
|
|
end
|
|
end
|
|
end
|
|
|
|
def destroy
|
|
@page = Page.find(params[:id])
|
|
@page.destroy
|
|
|
|
respond_to do |format|
|
|
format.html { redirect_to(admin_pages_path, :notice => 'Page was deleted.') }
|
|
format.xml { head :ok }
|
|
end
|
|
end
|
|
|
|
end
|