Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Rules
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,12 @@ end
route '/schedule/ical/track/*' do
"#{$prefix}/schedule/track/#{item.identifier.split('/')[-1]}.ics"
end
route '/schedule/xcal/event/*' do
"#{$prefix}/schedule/event/#{item.identifier.split('/')[-1]}.xcs"
end
route '/schedule/ical/event/*' do
"#{$prefix}/schedule/event/#{item.identifier.split('/')[-1]}.ics"
end
route '/schedule/pentabarf/' do
"#{$prefix}/schedule/xml"
end
Expand Down
9 changes: 9 additions & 0 deletions layouts/schedule/event.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@
<li><i class="icon-calendar"></i> <strong>Day</strong>: <%= l day(item[:day]) %></li>
<li><i class="icon-play"></i> <strong>Start (UTC+1)</strong>: <%= ltt item, :start %></li>
<li><i class="icon-stop"></i> <strong>End (UTC+1)</strong>: <%= ltt item, :end %></li>
<li>
<i class="icon-calendar"></i> <strong>Calendar:</strong>
<%=
[
{ name: 'iCal', identifier: "/schedule/ical/event/#{item[:slug]}/" },
{ name: 'xCal', identifier: "/schedule/xcal/event/#{item[:slug]}/" },
].map{|cal| l(cal[:identifier], cal[:name], show_subtitle: false) }.join(", ")
%>
</li>
<% if item[:live_video_link] %>
<li id="live-stream-with-q-and-a" class="visible-desktop">
<i class="icon-film"></i> <strong>Video only</strong>:
Expand Down
14 changes: 14 additions & 0 deletions lib/data_sources/schedule.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,20 @@ def to_items(hash, name)
end
end

# create ical and xcal items for each event
cache.fetch('events').each do |event_slug, event|
[
{ title: 'iCal', mime: 'text/calendar', item: "/schedule/ical/event/#{event_slug}/" },
{ title: 'xCal', mime: 'text/xml', item: "/schedule/xcal/event/#{event_slug}/" },
].each do |alt|
meta = event.dup
meta[:events] = [event_slug]
r << Nanoc3::Item.new('', meta, alt[:item], mtime)
event[:alternative_representations] = [] unless event.has_key? :alternative_representations
event[:alternative_representations] << alt
end
end

memory = {}
{
attachments: 'attachment',
Expand Down
6 changes: 3 additions & 3 deletions lib/helpers/schedule_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ def img(item, attr = {})
%Q!<img #{a.map { |k, v| %Q!#{k}="#{v}"! }.join(" ")}/>!
end

def l(item, title = :title, sep = ", ", detail = nil, klass = nil)
def l(item, title = :title, sep = ", ", detail = nil, klass = nil, show_subtitle: true)
if item.is_a? String and item.start_with? '/'
item = $item_by_id.fetch(item)
end

case item
when Array
item.map { |i| l(i, title, sep, detail, klass) }.join(sep)
item.map { |i| l(i, title, sep, detail, klass, show_subtitle: show_subtitle) }.join(sep)
when Nanoc::Item
text = case title
when Symbol
Expand Down Expand Up @@ -89,7 +89,7 @@ def l(item, title = :title, sep = ", ", detail = nil, klass = nil)
if klass
args[:class] = (klass.is_a? Array) ? klass.join(" ") : klass
end
subtitle = '<br/><i>' + henc(item[:subtitle]) + '</i>' if item[:subtitle]
subtitle = show_subtitle && item[:subtitle] ? '<br/><i>' + henc(item[:subtitle]) + '</i>' : nil
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change was necessary to prevent the l() helper from emitting a string to the HTML that contained the subtitle for events that have one, which tracks don't (at least not in the sample data, nor how the same l() helper is used in that template)

%Q!<a#{args.map { |k, v| %Q( #{k}="#{v}") }.join('')}>#{henc text}#{subtitle if subtitle}</a>!
else
raise "unsupported object of type #{item.class}"
Expand Down