Module Admin::EventsHelper
In: app/helpers/admin/events_helper.rb

Methods

Constants

LONG_DAYS_OF_WEEK = %w{ Sunday Monday Tuesday Wednesday Thursday Friday Saturday } unless defined?(LONG_DAYS_OF_WEEK)

Public Instance methods

Road upcoming events, Track upcoming events, etc …

[Source]

    # File app/helpers/admin/events_helper.rb, line 12
12:   def discipline_upcoming_events(discipline, upcoming_events)
13:     if upcoming_events.disciplines.size > 1
14:       caption = discipline.name.upcase
15:     else
16:       caption = " "
17:     end
18:     render :partial => 'events/discipline_upcoming', :locals => { :discipline => discipline, :dates => upcoming_events.dates, :caption => caption }
19:   end

Choose POST or PUT. Not sure why we need this.

[Source]

    # File app/helpers/admin/events_helper.rb, line 53
53:   def form_method_for(event)
54:     if event.new_record?
55:       :post
56:     else
57:       :put
58:     end
59:   end

Show link even if not approved because this is for admins

[Source]

    # File app/helpers/admin/events_helper.rb, line 27
27:   def link_to_flyer(event)
28:     return unless event
29:     
30:     if event.flyer.blank?
31:       event.full_name
32:     else
33:       link_to event.full_name, event.flyer
34:     end
35:   end

Build links like Cascade Classic: Mt. Bachelor Stage

[Source]

    # File app/helpers/admin/events_helper.rb, line 38
38:   def link_to_parents(event)
39:     html = ""
40:     event.ancestors.reverse.each do |e|
41:       if e.parent
42:         html << link_to(truncate(e.name, :length => 40), edit_admin_event_path(e), :class => "obvious")
43:         html << ": "
44:       else
45:         html << link_to(truncate(e.name, :length => 40), edit_admin_event_path(e), :class => "obvious")
46:         html << " (#{e.friendly_class_name}): "
47:       end
48:     end
49:     html
50:   end

Sunday, Monday, …

[Source]

    # File app/helpers/admin/events_helper.rb, line 22
22:   def long_day_of_week(index)
23:     LONG_DAYS_OF_WEEK[index]
24:   end

Build a caption and footer links and render events/upcoming partial

[Source]

   # File app/helpers/admin/events_helper.rb, line 5
5:   def upcoming_events_table(upcoming_events, caption = nil, footer = nil)
6:     caption ||= link_to("Schedule", :only_path  => false, :host => RacingAssociation.current.rails_host, :controller => 'schedule')
7:     footer ||= link_to('More &hellip;', :only_path => false, :host => RacingAssociation.current.rails_host, :controller => 'schedule')
8:     render_page 'events/upcoming', :locals => { :upcoming_events => upcoming_events, :caption => caption, :footer => footer }
9:   end

[Validate]