Skip to content
Snippets Groups Projects
Commit f066e785 authored by Teal's avatar Teal
Browse files

add html description to ical feed

parent 9bbb4925
No related branches found
No related tags found
No related merge requests found
......@@ -61,11 +61,12 @@ class AssignmentsController < ApplicationController
event.dtstart = Icalendar::Values::DateTime.new(session.starts_at, tzid: session.starts_at.zone)
event.dtend = Icalendar::Values::DateTime.new(session.ends_at, tzid: session.ends_at.zone)
event.summary = session.title
event.description = session.description
event.description = helpers.strip_tags(session.description)
event.location = [session.stage.name, session.conference.name].join(' @ ')
event.created = Icalendar::Values::DateTime.new(session.created_at)
event.last_modified = Icalendar::Values::DateTime.new(session.updated_at)
event.uid = [session.conference.slug, session.ref_id].join('-')
event.append_custom_property("X-ALT-DESC;FMTTYPE=text/html", session.description)
calendar.add_event(event)
end
......
......@@ -6,6 +6,8 @@ class Session < ApplicationRecord
validates :ref_id, uniqueness: { scope: :conference_id }
after_update :notify_if_changed
def to_param
ref_id
end
......@@ -17,4 +19,12 @@ class Session < ApplicationRecord
def ends_at
super.in_time_zone(conference.time_zone)
end
private
def notify_if_changed
if saved_changes.present?
ActiveSupport::Notifications.instrument("republica.import.session.updated", record: self, changes: saved_changes)
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment