2017-04-22 20:01:47 +02:00
|
|
|
def meta(xml, event)
|
2018-07-14 18:17:21 +02:00
|
|
|
xml.dc :identifier, "#{event.id}@#{request.domain}"
|
2018-03-27 23:30:21 +02:00
|
|
|
xml.dc :date, l(event.start_time, format: :xml)
|
2017-04-22 20:01:47 +02:00
|
|
|
|
|
|
|
return unless event.latitude || event.longitude
|
|
|
|
xml.georss :point, event.latitude, ' ', event.longitude
|
|
|
|
end
|
|
|
|
|
|
|
|
def event_to_rss(xml, event)
|
|
|
|
meta xml, event
|
|
|
|
|
|
|
|
xml.title "#{event.city}: #{event.title}, #{display_date event}"
|
|
|
|
xml.link event_url event
|
2017-06-04 14:38:02 +02:00
|
|
|
xml.description event.description
|
2017-04-22 20:01:47 +02:00
|
|
|
xml.content(:encoded) { xml.cdata! event.description }
|
|
|
|
end
|
|
|
|
|
2013-12-29 20:42:00 +01:00
|
|
|
xml.instruct!
|
|
|
|
|
2014-08-17 15:43:04 +02:00
|
|
|
xml.rdf :RDF,
|
|
|
|
'xmlns' => 'http://purl.org/rss/1.0/',
|
2017-04-22 20:01:47 +02:00
|
|
|
'xmlns:rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
|
2014-08-17 15:43:04 +02:00
|
|
|
'xmlns:dc' => 'http://purl.org/dc/elements/1.1/',
|
|
|
|
'xmlns:content' => 'http://purl.org/rss/1.0/modules/content/',
|
|
|
|
'xmlns:georss' => 'http://www.georss.org/georss' do
|
2013-12-29 20:42:00 +01:00
|
|
|
xml.channel 'rdf:about' => root_url do
|
2014-08-17 15:43:04 +02:00
|
|
|
title = t 'layouts.application.title'
|
2017-10-15 01:02:58 +02:00
|
|
|
region = Region.find_by id: session[:region]
|
|
|
|
title += " [#{region.name}]" if region
|
2014-08-17 15:43:04 +02:00
|
|
|
xml.title title
|
|
|
|
xml.description t 'layouts.application.subtitle'
|
|
|
|
xml.link root_url
|
2014-06-27 10:35:42 +02:00
|
|
|
xml.dc :language, 'fr'
|
2014-08-17 15:43:04 +02:00
|
|
|
xml.dc :creator, root_url
|
2013-12-29 20:42:00 +01:00
|
|
|
|
|
|
|
xml.items do
|
2014-06-27 11:00:59 +02:00
|
|
|
xml.rdf :Seq do
|
2014-08-17 15:43:04 +02:00
|
|
|
@events.each do |event|
|
2014-06-27 11:00:59 +02:00
|
|
|
xml.rdf :li, 'rdf:resource' => event_url(event)
|
2013-12-29 20:42:00 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-08-17 15:43:04 +02:00
|
|
|
@events.each do |event|
|
2013-12-29 20:42:00 +01:00
|
|
|
xml.item 'rdf:about' => event_url(event) do
|
2017-04-22 20:01:47 +02:00
|
|
|
event_to_rss xml, event
|
2013-12-29 20:42:00 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|