2010-02-01 09:24:28 +00:00
|
|
|
class Admin::AssetsController < ApplicationController
|
|
|
|
|
|
|
|
layout "admin"
|
2010-03-04 08:33:26 +00:00
|
|
|
before_filter :authenticate_user!
|
2011-04-13 10:19:51 +00:00
|
|
|
before_filter :is_admin?
|
2010-02-01 09:24:28 +00:00
|
|
|
|
2011-04-13 10:19:51 +00:00
|
|
|
def index
|
|
|
|
@assets = Asset.all.entries
|
2010-02-01 09:24:28 +00:00
|
|
|
end
|
|
|
|
|
2011-04-13 10:19:51 +00:00
|
|
|
def show
|
|
|
|
#TODO
|
2010-02-01 09:24:28 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def edit
|
|
|
|
@asset = Asset.find(params[:id])
|
|
|
|
end
|
|
|
|
|
|
|
|
def new
|
|
|
|
@asset = Asset.new
|
|
|
|
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
|