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

57 lines
1.1 KiB
Ruby

class Admin::LayoutsController < ApplicationController
layout "admin"
before_filter :authenticate_user!
before_filter :is_admin?
def index
@layouts = Layout.all.entries
end
def show
#TODO
# @layout = Layout.find(params[:id])
# redirect_to "/#{@layout.name}"
end
def new
@layout = Layout.new
session[:last_page] = get_go_back || admin_layouts_url
end
def edit
@layout = Layout.find(params[:id])
session[:last_page] = get_go_back || admin_layouts_url
end
def create
@layout = Layout.new(params[:layout])
if @layout.save
flash[:notice] = t('admin.create_success_layout')
redirect_to admin_layouts_url
else
render :action => 'new'
end
end
def update
@layout = Layout.find(params[:id])
if @layout.update_attributes(params[:layout])
flash[:notice] = t('admin.update_success_layout')
redirect_to admin_layouts_url
else
render :action => "edit"
end
end
def destroy
@layout = Layout.find(params[:id])
@layout.destroy
redirect_to admin_layouts_url
end
end