Orbit/app/controllers/admin/asset_categories_controller.rb

65 lines
1.7 KiB
Ruby
Raw Normal View History

2012-05-16 03:07:11 +00:00
class Admin::AssetCategoriesController < OrbitBackendController
def index
@asset_categories = AssetCategory.all
@asset_category = AssetCategory.new
@url = admin_asset_categories_path
end
def show
@asset_category = AssetCategory.find(params[:id])
end
def new
@asset_category = AssetCategory.new
end
def edit
@asset_category = AssetCategory.find(params[:id])
@url = admin_asset_categories_path(@asset_category)
end
def create
@asset_category = AssetCategory.new(params[:asset_category])
respond_to do |format|
if @asset_category.save
2012-09-12 11:12:50 +00:00
format.html { redirect_to(admin_asset_categories_url, :notice => t('create.success.asset_category')) }
2012-05-16 03:07:11 +00:00
format.js
else
format.html { render :action => "new" }
format.js { render action: "new" }
end
end
end
def update
@asset_category = AssetCategory.find(params[:id])
@url = admin_asset_categories_path(@asset_category)
respond_to do |format|
if @asset_category.update_attributes(params[:asset_category])
2012-09-12 11:12:50 +00:00
# format.html { redirect_to(panel_announcement_back_end_asset_category_url(@asset_category), :notice => t('create.success')) }
# format.html { redirect_to(panel_announcement_back_end_asset_categories_url, :notice => t('create.success')) }
2012-05-16 03:07:11 +00:00
# format.xml { head :ok }
format.js
else
format.html { render :action => "edit" }
format.js { render :action => "edit" }
end
end
end
def destroy
@asset_category = AssetCategory.find(params[:id])
@asset_category.destroy
respond_to do |format|
format.html { redirect_to(admin_asset_categories_url) }
format.js
end
end
end