Module: IcalHelper

Included in:
EventsController, UsersController
Defined in:
app/helpers/ical_helper.rb

Instance Method Summary collapse

Instance Method Details


17
18
19
# File 'app/helpers/ical_helper.rb', line 17

def calendar_link
  link_to t('event.subscribe'), calendar_user_url(id: current_user, :format => :ics, :only_path => false, :protocol => "webcal")
end

#icalendar(*events) ⇒ Object


2
3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'app/helpers/ical_helper.rb', line 2

def icalendar(*events)
  RiCal.Calendar do |cal|
    events.each do |event|
      cal.event do |item|
        item.summary     = event.name
        item.description = "#{event.description} #{event_url(event)}"
        item.dtstart     = event.date
        item.dtend       = event.end_date
        item.url         = event_url(event)
        item.location    = event.location.name if event.location
      end
    end
  end.to_s
end