Module: DmEvent::WorkshopsHelper
- Defined in:
- app/helpers/dm_event/workshops_helper.rb
Instance Method Summary collapse
-
#financial_collected_json(collected) ⇒ Object
Convert the financial “collected” data into json for pie charts ——————————————————————————.
-
#financial_collected_monthly_json(collected) ⇒ Object
Convert the financial “collected” data into json for pie charts ——————————————————————————.
-
#render_workshop_description(workshop) ⇒ Object
——————————————————————————.
-
#render_workshop_sidebar(workshop) ⇒ Object
——————————————————————————.
Instance Method Details
#financial_collected_json(collected) ⇒ Object
Convert the financial “collected” data into json for pie charts
24 25 26 27 28 29 30 |
# File 'app/helpers/dm_event/workshops_helper.rb', line 24 def financial_collected_json(collected) json = [] collected.sort.each do |item| json << { label: "#{item[0]}: #{item[1].format(:no_cents_if_whole => true, :symbol => true)}", data: item[1].to_f } end json.to_json end |
#financial_collected_monthly_json(collected) ⇒ Object
Convert the financial “collected” data into json for pie charts
34 35 36 37 38 39 40 |
# File 'app/helpers/dm_event/workshops_helper.rb', line 34 def financial_collected_monthly_json(collected) json = [] collected.sort.each do |item| json << [ "#{item[0].localize("%b")}", collected[item[0]].to_f ] end json.to_json end |
#render_workshop_description(workshop) ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'app/helpers/dm_event/workshops_helper.rb', line 4 def render_workshop_description(workshop) if workshop.description.nil? description = "" else # --- process as markdown x = render :inline => workshop.description description = liquidize_markdown(x, {}) end return description end |
#render_workshop_sidebar(workshop) ⇒ Object
16 17 18 19 20 |
# File 'app/helpers/dm_event/workshops_helper.rb', line 16 def (workshop) return '' if workshop..nil? liquidize_markdown(render(:inline => workshop.), {}) end |