Class: Effective::CpdAuditReviewsController

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

Instance Method Summary collapse

Instance Method Details

#permitted_paramsObject



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
53
54
55
56
57
# File 'app/controllers/effective/cpd_audit_reviews_controller.rb', line 23

def permitted_params
  case step
  when :start
    params.require(:effective_cpd_audit_review).permit(:current_step, :comments)
  when :information
    params.require(:effective_cpd_audit_review).permit(:current_step, :comments)
  when :instructions
    params.require(:effective_cpd_audit_review).permit(:current_step, :comments)
  when :conflict
    params.require(:effective_cpd_audit_review)
      .permit(:current_step, :comments, :conflict_of_interest, :conflict_of_interest_reason)
  when :statements
    params.require(:effective_cpd_audit_review).permit(:current_step, :comments)
  when :questionnaire
    params.require(:effective_cpd_audit_review).permit(:current_step, :comments)
  when :recommendation
    params.require(:effective_cpd_audit_review).permit(:current_step, :comments, :recommendation)
  when :submit
    params.require(:effective_cpd_audit_review).permit(:current_step)
  when :complete
    raise('unexpected post to complete')
  else
    if step.to_s.start_with?('statement')
      params.require(:effective_cpd_audit_review).permit(:current_step, :comments,
        cpd_audit_review_items_attributes: [:id, :item_id, :item_type, :recommendation, :comments]
      )
    elsif step.to_s.start_with?('section')
      params.require(:effective_cpd_audit_review).permit(:current_step, :comments,
        cpd_audit_review_items_attributes: [:id, :item_id, :item_type, :recommendation, :comments]
      )
    else
      raise('unexpected step')
    end
  end
end

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



13
14
15
16
17
18
19
20
21
# File 'app/controllers/effective/cpd_audit_reviews_controller.rb', line 13

def render_step(the_step, options = {}, params = {})
  if resource.dynamic_wizard_statement_steps.keys.include?(the_step)
    render('cpd_statement', options)
  elsif resource.dynamic_wizard_questionnaire_steps.keys.include?(the_step)
    render('cpd_audit_level_section', options)
  else
    super
  end
end