Orbit/app/controllers/admin/assets_controller.rb

53 lines
919 B
Ruby
Raw Normal View History

2010-02-01 09:24:28 +00:00
class Admin::AssetsController < ApplicationController
layout "admin"
before_filter :authenticate_user!
before_filter :is_admin?
2010-02-01 09:24:28 +00:00
def index
@assets = Asset.all.entries
2010-02-01 09:24:28 +00:00
end
def show
#TODO
2010-02-01 09:24:28 +00:00
end
def edit
@asset = Asset.find(params[:id])
session[:last_page] = get_go_back || admin_assets_url
2010-02-01 09:24:28 +00:00
end
def new
@asset = Asset.new
session[:last_page] = get_go_back || admin_assets_url
2010-02-01 09:24:28 +00:00
end
def create
@asset = Asset.new(params[:asset])
if @asset.save
redirect_to admin_assets_url
else
render :action => :new
end
end
def update
@asset = Asset.find(params[:id])
if @asset.update_attributes(params[:asset])
redirect_to admin_assets_url
else
render :action => :edit
end
end
def destroy
@asset = Asset.find(params[:id])
@asset.destroy
redirect_to admin_assets_url
end
end