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
        format.html { redirect_to(admin_asset_categories_url, :notice => t('create.success.asset_category')) }
        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('create.success')) }
        # format.html { redirect_to(panel_announcement_back_end_asset_categories_url, :notice => t('create.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
