Class: SurveyorGui::ResponsesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- SurveyorGui::ResponsesController
- Includes:
- ReportPreviewWrapper
- Defined in:
- app/controllers/surveyor_gui/responses_controller.rb
Instance Method Summary collapse
Methods included from ReportPreviewWrapper
Instance Method Details
#index ⇒ Object
7 8 9 10 |
# File 'app/controllers/surveyor_gui/responses_controller.rb', line 7 def index @title = "Survey Responses" @response_sets = Survey.find_by_id(params[:id]).response_sets end |
#preview ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/surveyor_gui/responses_controller.rb', line 12 def preview user_id = defined?(current_user) && current_user ? current_user.id : nil @title = "Show Response" @survey = Survey.find(params[:survey_id]) @response_set = ResponseSet.create(:survey => @survey, :user_id => user_id, :test_data => true) ReportResponseGenerator.new(@survey).generate_1_result_set(@response_set) @responses = @response_set.responses @response_sets = [@response_set] if (!@survey) flash[:notice] = "Survey/Questionnnaire not found." redirect_to :back end render :show end |
#show ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'app/controllers/surveyor_gui/responses_controller.rb', line 27 def show @title = "Show Response" @response_set = ResponseSet.find(params[:id]) @survey = @response_set.survey @responses = @response_set.responses @response_sets = [@response_set] if (!@response_set) flash[:error] = "Response not found" redirect_to :back elsif (!@survey) flash[:error] = "Survey/Questionnnaire not found." redirect_to :back end end |