This repository has been archived on 2024-03-16. You can view files and clone it, but cannot push or open issues or pull requests.
orbit-4-1/app/controllers/admin/layouts_controller.rb

86 lines
1.9 KiB
Ruby
Raw Normal View History

2009-05-07 17:54:33 +00:00
class Admin::LayoutsController < ApplicationController
layout "admin"
2009-05-07 17:54:33 +00:00
# GET /layouts
# GET /layouts.xml
def index
@layouts = Layout.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @layouts }
end
end
# GET /layouts/1
# GET /layouts/1.xml
def show
@layout = Layout.find(params[:id])
redirect_to "/#{@layout.name}"
end
# GET /layouts/new
# GET /layouts/new.xml
def new
@layout = Layout.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @layouts }
end
end
# GET /layouts/1/edit
def edit
@layout = Layout.find(params[:id])
end
# POST /layouts
# POST /layouts.xml
def create
@layout = Layout.new(params[:layout])
respond_to do |format|
if @layout.save
flash[:notice] = 'Layout was successfully created.'
format.html { redirect_to admin_layouts_url }
format.xml { render :xml => @layout, :status => :created, :location => @layouts }
else
format.html { render :action => "new" }
format.xml { render :xml => @layout.errors, :status => :unprocessable_entity }
end
end
end
# PUT /layouts/1
# PUT /layouts/1.xml
def update
@layout = Layout.find(params[:id])
respond_to do |format|
if @layout.update_attributes(params[:layout])
flash[:notice] = 'Layout was successfully updated.'
format.html { redirect_to admin_layouts_url }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @layout.errors, :status => :unprocessable_entity }
end
end
end
# DELETE /layouts/1
# DELETE /layouts/1.xml
def destroy
@layout = Layout.find(params[:id])
@layout.destroy
respond_to do |format|
format.html { redirect_to admin_layouts_url }
format.xml { head :ok }
end
end
end