class Panel::Ask::BackEnd::AskCategoriesController < OrbitBackendController

  include AdminHelper
  include OrbitControllerLib::DivisionForDisable

  before_filter :for_app_manager

  def initialize
    super
    @app_title = 'ask_categories'
  end

  def index
		@ask_categories = AskCategory.admin_manager_all
		@ask_category = AskCategory.new
    @url = panel_ask_back_end_ask_categories_path
  end

  def create
    @ask_category = AskCategory.new(params[:ask_category])
    @ask_category.save!

    respond_to do |format|
      format.js
    end
  end

  def edit
    @ask_category = AskCategory.find(params[:id])
    @url = panel_ask_back_end_ask_category_path(@ask_category)

    respond_to do |format|
      format.js
    end
  end

  def update
    @ask_category = AskCategory.find(params[:id])
    @url = panel_ask_back_end_ask_category_path(@ask_category)
    @ask_category.update_attributes(params[:ask_category])

    respond_to do |format|
      format.js
    end
  end

  def destroy
    @ask_category = AskCategory.find(params[:id])
    @ask_category.disable = !@ask_category.disable
    @ask_category.save!

    respond_to do |format|
      format.js
    end
  end

end
