Module: EffectiveCpdHelper
- Included in:
- Effective::CpdScorer, Effective::CpdStatementsController
- Defined in:
- app/helpers/effective_cpd_helper.rb
Instance Method Summary collapse
- #cpd_credit_label ⇒ Object
- #cpd_credits_label ⇒ Object
- #cpd_cycle_label ⇒ Object
- #cpd_cycles_label ⇒ Object
- #cpd_rule_formula_hint(cpd_activity) ⇒ Object
- #cpd_score(value) ⇒ Object
- #cpd_statement_submit_label(cpd_statement) ⇒ Object
- #effective_cpd_categories ⇒ Object
Instance Method Details
#cpd_credit_label ⇒ Object
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_label ⇒ Object
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_label ⇒ Object
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_label ⇒ Object
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 |
#cpd_score(value) ⇒ Object
47 48 49 |
# File 'app/helpers/effective_cpd_helper.rb', line 47 def cpd_score(value) ("%.#{2}f" % value.to_d) end |
#cpd_statement_submit_label(cpd_statement) ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'app/helpers/effective_cpd_helper.rb', line 33 def cpd_statement_submit_label(cpd_statement) label = "Yes, I understand I will not be able to submit more #{cpd_credits_label} or modify any of my activities for this #{cpd_cycle_label}, once I submit." if (end_at = cpd_statement.cpd_cycle.end_at).present? label += " The last date to submit this form is #{end_at.strftime("%B %d, %Y")}." end label end |
#effective_cpd_categories ⇒ Object
43 44 45 |
# File 'app/helpers/effective_cpd_helper.rb', line 43 def effective_cpd_categories @effective_cpd_categories ||= Effective::CpdCategory.deep.sorted end |