Module: EventCal::CalendarHelper

Defined in:
lib/event_cal/calendar_helper.rb

Instance Method Summary collapse

Instance Method Details

#hightlight_classes(date, calendar) ⇒ Object


14
15
16
17
18
19
20
21
# File 'lib/event_cal/calendar_helper.rb', line 14

def hightlight_classes(date, calendar)
  classes = []
  classes << 'today' if date == Date.today
  events = calendar.events_on(date)
  classes << 'has_events' if events.present?
  events.map(&:class).uniq.each {|event_class| classes << event_class.to_s.underscore }
  classes
end

#path_to_next_month(calendar) ⇒ Object


26
27
# File 'lib/event_cal/calendar_helper.rb', line 26

def path_to_next_month(calendar)
end

#path_to_previous_month(calendar) ⇒ Object


23
24
# File 'lib/event_cal/calendar_helper.rb', line 23

def path_to_previous_month(calendar)
end

#path_to_today(calendar) ⇒ Object


29
30
# File 'lib/event_cal/calendar_helper.rb', line 29

def path_to_today(calendar)
end

#render_event_details(events) ⇒ Object


41
42
43
44
45
46
47
48
# File 'lib/event_cal/calendar_helper.rb', line 41

def render_event_details(events)
  render(
    { :partial => 'shared/event_cal/event_details',
      :format => :html,
      :locals => { :events => events }
    }
  )
end

#render_monthly(calendar) ⇒ Object


32
33
34
35
36
37
38
39
# File 'lib/event_cal/calendar_helper.rb', line 32

def render_monthly(calendar)
  render(
    { :partial => 'shared/event_cal/calendar',
      :format => :html,
      :locals => { :calendar => calendar },
    }
  )
end

#wday_class_for(date) ⇒ Object


5
6
7
8
9
10
11
12
# File 'lib/event_cal/calendar_helper.rb', line 5

def wday_class_for(date)
  case date.wday
  when 0
    'sunday'
  when 6
    'saturday'
  end
end