Module: CalendarHelper

Includes:
EventCalendar::CalendarHelper
Defined in:
app/helpers/calendar_helper.rb

Instance Method Summary collapse

Instance Method Details

#event_calendarObject



21
22
23
24
25
26
27
28
29
30
# File 'app/helpers/calendar_helper.rb', line 21

def event_calendar
  # args is an argument hash containing :event, :day, and :options
  calendar event_calendar_opts do |args|
    event, day = args[:event], args[:day]
    html = %(<a href="#{event_path(event)}" title="#{h(event.display_name.localize)}">)
    html << display_event_time(event, day)
    html << %(#{h(event.display_name.localize)}</a>)
    html
  end
end

#event_calendar_optsObject

custom options for this calendar



8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/helpers/calendar_helper.rb', line 8

def event_calendar_opts
  { 
    :year => @year,
    :month => @month,
    :event_strips => @event_strips,
    :month_name_text => I18n.localize(@shown_month, :format => "%B %Y"),
    :previous_month_text => "<< " + month_link(@shown_month.prev_month),
    :next_month_text => month_link(@shown_month.next_month) + " >>",
    :use_all_day => true,
    :link_to_day_action => 'show'
  }
end


3
4
5
# File 'app/helpers/calendar_helper.rb', line 3

def month_link(month_date)
  link_to(I18n.localize(month_date, :format => "%B"), {:month => month_date.month, :year => month_date.year})
end