class Panel::Survey::BackEnd::SurveysAnswersController < OrbitBackendController

  include AdminHelper
  include OrbitControllerLib::DivisionForDisable

  def initialize
    super
    @app_title = 'survey_answer'
  end

  def index
    @survey = ::Survey.find(params[:survey_id])
    @answers = (params[:sort]) ? get_sorted_and_filtered("@survey.survey_answers") : get_viewable("@survey.survey_answers")
    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @qas }
      format.js
    end
  end

  def delete
    @survey = ::Survey.find(params[:survey_id])
    if params[:ids]
      answers = @survey.survey_answers.any_in(:_id => params[:ids]).destroy_all
    end
    redirect_to panel_survey_back_end_survey_answers_url(@survey, :direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
  end

end