2009-05-07 17:54:33 +00:00
|
|
|
class Admin::LayoutsController < ApplicationController
|
2009-05-07 18:13:27 +00:00
|
|
|
|
|
|
|
layout "admin"
|
2010-03-04 08:33:26 +00:00
|
|
|
before_filter :authenticate_user!
|
2009-05-07 18:13:27 +00:00
|
|
|
|
2009-05-07 17:54:33 +00:00
|
|
|
def index
|
|
|
|
@layouts = Layout.all
|
|
|
|
end
|
|
|
|
|
|
|
|
def show
|
|
|
|
@layout = Layout.find(params[:id])
|
|
|
|
|
|
|
|
redirect_to "/#{@layout.name}"
|
|
|
|
end
|
|
|
|
|
|
|
|
def new
|
|
|
|
@layout = Layout.new
|
|
|
|
end
|
|
|
|
|
|
|
|
def edit
|
|
|
|
@layout = Layout.find(params[:id])
|
|
|
|
end
|
|
|
|
|
|
|
|
def create
|
|
|
|
@layout = Layout.new(params[:layout])
|
|
|
|
|
2010-01-04 09:49:55 +00:00
|
|
|
if @layout.save
|
|
|
|
flash[:notice] = 'Layout was successfully created.'
|
|
|
|
redirect_to admin_layouts_url
|
|
|
|
else
|
|
|
|
render :action => "new"
|
2009-05-07 17:54:33 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def update
|
|
|
|
@layout = Layout.find(params[:id])
|
2010-01-04 09:49:55 +00:00
|
|
|
|
|
|
|
if @layout.update_attributes(params[:layout])
|
|
|
|
flash[:notice] = 'Layout was successfully updated.'
|
|
|
|
redirect_to admin_layouts_url
|
|
|
|
else
|
|
|
|
render :action => "edit"
|
2009-05-07 17:54:33 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
|
|
|
@layout = Layout.find(params[:id])
|
|
|
|
@layout.destroy
|
|
|
|
|
2010-01-04 09:49:55 +00:00
|
|
|
redirect_to admin_layouts_url
|
2009-05-07 17:54:33 +00:00
|
|
|
end
|
2010-01-04 09:49:55 +00:00
|
|
|
|
2009-05-07 17:54:33 +00:00
|
|
|
end
|