66 lines
1.8 KiB
Ruby
66 lines
1.8 KiB
Ruby
|
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])
|
||
|
@i18n_variable = @asset_category.i18n_variable
|
||
|
@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
|
||
|
format.html { redirect_to(admin_asset_categories_url, :notice => t('announcement.create_asset_category_success')) }
|
||
|
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])
|
||
|
# format.html { redirect_to(panel_announcement_back_end_asset_category_url(@asset_category), :notice => t('asset_category.update_asset_category_success')) }
|
||
|
# format.html { redirect_to(panel_announcement_back_end_asset_categories_url, :notice => t('asset_category.update_asset_category_success')) }
|
||
|
# 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
|