Class: Effective::CpdAuditsController

Inherits:
ApplicationController
  • Object
show all
Includes:
WizardController
Defined in:
app/controllers/effective/cpd_audits_controller.rb

Instance Method Summary collapse

Instance Method Details

#permitted_paramsObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'app/controllers/effective/cpd_audits_controller.rb', line 18

def permitted_params
  case step
  when :start
    params.require(:effective_cpd_audit).permit(:current_step)
  when :information
    params.require(:effective_cpd_audit).permit(:current_step)
  when :instructions
    params.require(:effective_cpd_audit).permit(:current_step)
  when :conflict
    params.require(:effective_cpd_audit)
      .permit(:current_step, :conflict_of_interest, :conflict_of_interest_reason)
  when :exemption
    params.require(:effective_cpd_audit)
      .permit(:current_step, :exemption_request, :exemption_request_reason)
  when :extension
    params.require(:effective_cpd_audit)
      .permit(:current_step, :extension_request, :extension_request_date, :extension_request_reason)
  when :questionnaire
    params.require(:effective_cpd_audit).permit(:current_step)
  when :files
    params.require(:effective_cpd_audit).permit(:current_step, files: [])
  when :submit
    params.require(:effective_cpd_audit).permit(:current_step)
  when :complete
    raise('unexpected post to complete')
  else
    raise('unexpected step') unless step.to_s.start_with?('section')

    params.require(:effective_cpd_audit).permit(:current_step,
      cpd_audit_responses_attributes: [
        :id, :cpd_audit_id, :cpd_audit_level_question_id, :date, :email, :number, :long_answer, :short_answer, :upload_file, cpd_audit_level_question_option_ids: []
      ]
    )
  end
end

#render_step(the_step, options = {}, params = {}) ⇒ Object



13
14
15
16
# File 'app/controllers/effective/cpd_audits_controller.rb', line 13

def render_step(the_step, options = {}, params = {})
  return super unless resource.dynamic_wizard_steps.keys.include?(the_step)
  render('cpd_audit_level_section', options)
end