Orbit/app/controllers/admin/layouts_controller.rb

55 lines
994 B
Ruby
Raw Normal View History

2009-05-07 17:54:33 +00:00
class Admin::LayoutsController < ApplicationController
layout "admin"
before_filter :authenticate_user!
before_filter :is_admin?
2009-05-07 17:54:33 +00:00
def index
@layouts = Layout.all.entries
2009-05-07 17:54:33 +00:00
end
def show
#TODO
# @layout = Layout.find(params[:id])
# redirect_to "/#{@layout.name}"
2009-05-07 17:54:33 +00:00
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] = t('admin.create_success_layout')
2010-01-04 09:49:55 +00:00
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] = t('admin.update_success_layout')
2010-01-04 09:49:55 +00:00
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