module Admin::EventsHelper

Constants

LONG_DAYS_OF_WEEK

Public Instance Methods

discipline_upcoming_events(discipline, upcoming_events) click to toggle source

Road upcoming events, Track upcoming events, etc …

# File app/helpers/admin/events_helper.rb, line 12
def discipline_upcoming_events(discipline, upcoming_events)
  if upcoming_events.disciplines.size > 1
    caption = discipline.name.upcase
  else
    caption = " ".html_safe
  end
  render :partial => 'events/discipline_upcoming', :locals => { :discipline => discipline, :dates => upcoming_events.dates, :caption => caption }
end
form_method_for(event) click to toggle source

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

# File app/helpers/admin/events_helper.rb, line 53
def form_method_for(event)
  if event.new_record?
    :post
  else
    :put
  end
end
long_day_of_week(index) click to toggle source

Sunday, Monday, …

# File app/helpers/admin/events_helper.rb, line 22
def long_day_of_week(index)
  LONG_DAYS_OF_WEEK[index]
end
upcoming_events_table(upcoming_events, caption = nil, footer = nil) click to toggle source

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

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