Sha256: d92301f59f59b5be5dbf90645d4e48bd35b59b6a59378dcb4c957ea11b8ae84b

Contents?: true

Size: 1.17 KB

Versions: 4

Compression:

Stored size: 1.17 KB

Contents

module <%= view_name.classify %>Helper
  def month_link(month_date)
    link_to(I18n.localize(month_date, :format => "%B"), {:month => month_date.month, :year => month_date.year})
  end
  
  # custom options for this calendar
  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.last_month),
      :next_month_text => month_link(@shown_month.next_month) + " >>"<%- if options[:use_all_day] -%>,
      :use_all_day => true
      <%- end -%>
    }
  end

  def event_calendar
    # args is an argument hash containing :event, :day, and :options
    calendar event_calendar_opts do |args|
      <%- if options[:use_all_day] -%>
      event, day = args[:event], args[:day]
      html = %(<a href="/events/#{event.id}" title="#{h(event.name)}">)
      html << display_event_time(event, day)
      html << %(#{h(event.name)}</a>)
      html
      <%- else -%>
      event = args[:event]
      %(<a href="/events/#{event.id}" title="#{h(event.name)}">#{h(event.name)}</a>)
      <%- end -%>
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
event-calendar-2.3.3 generators/event_calendar/templates/helper.rb.erb
event-calendar-2.3.2 generators/event_calendar/templates/helper.rb.erb
event-calendar-2.3.1 generators/event_calendar/templates/helper.rb.erb
elevation_event_calendar-1.0.0 ./generators/event_calendar/templates/helper.rb.erb