Module: EffectiveCpdHelper

Included in:
Effective::CpdScorer
Defined in:
app/helpers/effective_cpd_helper.rb

Instance Method Summary collapse

Instance Method Details

#cpd_credit_labelObject



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

def cpd_credit_label
  (EffectiveCpd.credit_label || '').to_s.html_safe
end

#cpd_credits_labelObject



15
16
17
# File 'app/helpers/effective_cpd_helper.rb', line 15

def cpd_credits_label
  (EffectiveCpd.credit_label || '').to_s.pluralize.html_safe
end

#cpd_cycle_labelObject



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

def cpd_cycle_label
  (EffectiveCpd.cycle_label || '').to_s.html_safe
end

#cpd_cycles_labelObject



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

def cpd_cycles_label
  (EffectiveCpd.cycle_label || '').to_s.pluralize.html_safe
end

#cpd_rule_formula_hint(cpd_activity) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/helpers/effective_cpd_helper.rb', line 19

def cpd_rule_formula_hint(cpd_activity)
  raise('expected a CPDActivity') unless cpd_activity.kind_of?(Effective::CpdActivity)

  if cpd_activity.amount_label.present? && cpd_activity.amount2_label.present?
    "must include 'amount' and 'amount2'. Something like (amount + (amount2 * 10))"
  elsif cpd_activity.amount_label.present?
    "must include 'amount'. Something like (10 * amount)"
  elsif cpd_activity.amount2_label.present?
    "must include 'amount2'. Something like (10 * amount2)"
  else
    "must be a number and may not include 'amount'. Something like 10"
  end
end

#effective_cpd_categoriesObject



33
34
35
# File 'app/helpers/effective_cpd_helper.rb', line 33

def effective_cpd_categories
  @effective_cpd_categories ||= Effective::CpdCategory.deep.sorted
end