agenda-libre-ruby/app/views/events/index.rss.builder

62 lines
2.6 KiB
Plaintext
Raw Normal View History

2013-12-29 20:42:00 +01:00
xml.instruct!
xml.tag! 'rdf:RDF', 'xmlns:rdf' => "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
'xmlns' => "http://purl.org/rss/1.0/", 'xmlns:dc' => "http://purl.org/dc/elements/1.1/",
'xmlns:sy' => "http://purl.org/rss/1.0/modules/syndication/",
'xmlns:admin' => "http://webns.net/mvcb/", 'xmlns:cc' => "http://web.resource.org/cc/",
'xmlns:content' => "http://purl.org/rss/1.0/modules/content/",
'xmlns:georss' => "http://www.georss.org/georss" do
xml.channel 'rdf:about' => root_url do
xml.title "Agenda du Libre [ #{params[:region].present? && params[:region] != 'all' ? Region.find(params[:region]).name : t('.all_regions')} ]"
xml.description 'Agenda des événements autour du Logiciel Libre'
xml.link 'http://www.agendadulibre.org'
xml.tag! 'dc:language', 'fr'
xml.tag! 'dc:creator', 'AgendaDuLibre.org'
xml.items do
xml.tag! 'rdf:Seq' do
for event in @events
xml.tag! 'rdf:li', 'rdf:resource' => event_url(event)
end
end
end
end
for event in @events
xml.item 'rdf:about' => event_url(event) do
xml.title "#{event.city}: #{event.title}, #{l event.start_time.to_date, format: :long}"
xml.link event_url event
xml.tag! 'dc:identifier', "#{event.id}@agendadulibre.org"
xml.tag! 'dc:date', event.start_time
xml.tag! 'georss:point', City.find_all_by_majname(event.city.upcase).collect { |c| "#{c.latitude} #{c.longitude}" }.first
content = "<h2><em>#{event.city}</em>: #{event.title}</h2>
2013-12-29 23:25:38 +01:00
<h3>Date et lieu</h3>"
if event.same_day?
content += "
<p>Le #{l event.start_time.to_date, format: :long},
de #{l event.start_time, format: :hours} à #{l event.end_time, format: :hours}.</p>
<p>À <em>#{link_to event.city, 'http://fr.wikipedia.org/wiki/'+event.city}</em>,
#{link_to event.region.name, 'http://fr.wikipedia.org/wiki/'+event.region.name}</p>"
else
content += "
<p>Du #{l event.start_time, format: :at} au #{l event.end_time, format: :at}.</p>"
end
content += "
2013-12-29 20:42:00 +01:00
<h3>Description</h3>
#{event.description}
<h3>Informations</h3>
<p>Site Web: <a href=\"#{event.url}\">#{event.url}</a></p>
2013-12-29 23:25:38 +01:00
<p>Contact: #{mail_to event.contact.gsub('@', ' CHEZ ').gsub('.', ' POINT '), event.contact.gsub('@', ' CHEZ ').gsub('.', ' POINT ')}</p>
2013-12-29 20:42:00 +01:00
"
if (event.tags && event.tags.present?)
content += "<p>Tags: #{event.tags.split.collect { |tag| link_to tag, events_url(tag: tag) }.join(', ')}</p>"
end
xml.description strip_tags(content)
xml.tag! 'content:encoded', content
end
end
end