class Decidim::Meetings::Calendar::MeetingToEvent
calendar.add_event(event)
event = MeetingToEvent.new(meeting).event
calendar = Icalendar::Calendar.new
attach it to a calendar, you can do it like this:
Note that this event will not be bound to any calendar. If you need to
converter.to_ical # => “BEGIN:VEVENTnr…END:VEVENTnr”
converter.event # => #<Icalendar::Event …>
converter = MeetingToEvent.new(meeting)
meeting = Decidim::Meetings::Meeting.find(params)
Examples:
‘icalendar` gem.
This class converts the given meeting to an ICalendar event, using the
def event
Converts the given meeting to an ICalendar event object
def event return @event if @event @event = Icalendar::Event.new @event.dtstart = Icalendar::Values::DateTime.new(meeting.start_time.utc, "tzid" => "UTC") @event.dtend = Icalendar::Values::DateTime.new(meeting.end_time.utc, "tzid" => "UTC") @event.summary = present(meeting).title @event.description = strip_tags(CGI.unescapeHTML(present(meeting).description)) @event.location = meeting.address @event.geo = [meeting.latitude, meeting.longitude] @event.url = url_for(meeting) @event end
def initialize(meeting)
Initializes the converteer for the given meeting.
def initialize(meeting) @meeting = meeting end
def present(meeting)
def present(meeting) Decidim::Meetings::MeetingPresenter.new(meeting) end
def url_for(meeting)
def url_for(meeting) Decidim::ResourceLocatorPresenter.new(meeting).url end