class Decidim::Meetings::Calendar::BaseCalendar
include your new class.
it. After that, modify the ‘Decidim::Meetings::Calendar.for` method to
from it and overwrite the `events` with whatever logic you need to do
This class serves as a base class to render calendars. Please, inherit
def self.for(resource, filters = nil)
resource - a resource that has meetings.
meetings to the ICalendar format.
Convenience method to shorten the calls. Converts the resource
def self.for(resource, filters = nil) new(resource, filters).calendar end
def calendar
Converts the resource meetings to the ICalendar format.
def calendar return if events.blank? <<~CALENDAR.gsub("\n\n", "\n") BEGIN:VCALENDAR\r VERSION:2.0\r PRODID:icalendar-ruby\r CALSCALE:GREGORIAN\r #{events} END:VCALENDAR\r CALENDAR end
def events
example of how to achieve it.
you can cache its contents. Check existing implementations for an
`MeetingToEvent` class to do so. Since this method returns a String,
will be exported, and convert them to ICalendar events. Please use the
inheriting from this one. It should find the relevant meetings that
Internal: this method is supposed to be overwritten by classes
def events raise "Please, overwrite this method. You can use the `MeetingToEvent` class to convert a meeting to the correct ICalendar format." end
def initialize(resource, filters = nil)
Initializes the class.
def initialize(resource, filters = nil) @resource = resource @filters = filters end