Module: EffectiveCpdAuditsHelper

Defined in:
app/helpers/effective_cpd_audits_helper.rb

Instance Method Summary collapse

Instance Method Details

#cpd_audit_conflict_of_interest_collectionObject



3
4
5
# File 'app/helpers/effective_cpd_audits_helper.rb', line 3

def cpd_audit_conflict_of_interest_collection
  [['Yes, there is a conflict of interest', true], ['No conflict of interest', false]]
end

#cpd_audit_exemption_request_collectionObject



7
8
9
# File 'app/helpers/effective_cpd_audits_helper.rb', line 7

def cpd_audit_exemption_request_collection
  [['Yes, I would like to request an exemption', true], ['No exemption request', false]]
end

#cpd_audit_extension_request_collectionObject



11
12
13
# File 'app/helpers/effective_cpd_audits_helper.rb', line 11

def cpd_audit_extension_request_collection
  [['Yes, I would like to request an extension', true], ['No extension request', false]]
end

#cpd_audit_new_reviewer_collection(cpd_audit = nil) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/helpers/effective_cpd_audits_helper.rb', line 15

def cpd_audit_new_reviewer_collection(cpd_audit = nil)
  cpd_audit ||= EffectiveCpd.CpdAudit.new
  raise('expected a cpd audit') unless cpd_audit.class.respond_to?(:effective_cpd_audit?)

  cpd_audit.current_user = current_user
  users = cpd_audit.suggested_cpd_audit_reviewers()

  users.map do |user|
    in_progress = (:span, class: 'badge badge-info') do
      user.cpd_audit_reviews.count { |review| review.in_progress? }.to_s + ' in progress'
    end

    html = (:div, "#{user} #{in_progress}")

    [user.to_s, user.to_param, { 'data-html': html }]
  end
end