Ajout de l'adresse dans les flux rss et ical

This commit is contained in:
echarp 2014-08-24 12:19:45 +02:00
parent dad2e7daab
commit 144737b54d
6 changed files with 13 additions and 14 deletions

View File

@ -12,7 +12,7 @@ class EventsController < ApplicationController
respond_to do |format| respond_to do |format|
format.html format.html
format.rss do format.rss do
@events = @events.includes(:related_city).future_in params[:daylimit] @events = @events.future_in params[:daylimit]
end end
format.ics { @events = @events.last_year.order :id } format.ics { @events = @events.last_year.order :id }
format.xml { @events = @events.includes(:related_region).order :id } format.xml { @events = @events.includes(:related_region).order :id }

View File

@ -17,9 +17,10 @@ module EventsHelper
keywords: @event.tags, keywords: @event.tags,
DC: { title: @event.title, date: @event.start_time.to_s }, DC: { title: @event.title, date: @event.start_time.to_s },
geo: { geo: {
region: @event.related_region,
placename: @event.city, placename: @event.city,
position: "#{@event.latitude};#{@event.longitude}" region: @event.related_region,
position: "#{@event.latitude};#{@event.longitude}",
ICBM: "#{@event.latitude}, #{@event.longitude}"
} }
end end

View File

@ -13,7 +13,7 @@ UID:<%= event.id %>@agendadulibre.org
SUMMARY:<%= event.title %> SUMMARY:<%= event.title %>
URL:<%= event_url event %> URL:<%= event_url event %>
DESCRIPTION:Un événement de l'Agenda du Libre DESCRIPTION:Un événement de l'Agenda du Libre
LOCATION:<%= event.city.gsub('-', ' ') %> LOCATION:<%= event.address %> <%= event.city.gsub('-', ' ') %>
END:VEVENT END:VEVENT
<% end %> <% end %>
END:VCALENDAR END:VCALENDAR

View File

@ -1,7 +1,8 @@
json.array!(@events) do |event| json.array!(@events) do |event|
json.extract! event, :id, :title, :description, :start_time, :end_time, json.extract! event, :id, :title, :description, :start_time, :end_time,
:city, :region_id, :locality, :url, :contact, :contact, :address, :city, :region_id, :locality, :url, :contact,
:submitter, :moderated, :tags, :secret, :decision_time, :contact, :submitter, :moderated, :tags, :secret,
:submission_time, :moderator_mail_id, :submitter_mail_id :decision_time, :submission_time, :moderator_mail_id,
:submitter_mail_id
json.url event_url(event, format: :json) json.url event_url(event, format: :json)
end end

View File

@ -39,12 +39,8 @@ xml.rdf :RDF,
domain = root_url.gsub(/www/, '').gsub(/http.?:../, '').gsub(/:.*/, '') domain = root_url.gsub(/www/, '').gsub(/http.?:../, '').gsub(/:.*/, '')
xml.dc :identifier, "#{event.id}@#{domain}" xml.dc :identifier, "#{event.id}@#{domain}"
xml.dc :date, event.start_time.iso8601 xml.dc :date, event.start_time.iso8601
if event.related_city && event.related_city.latitude && if event.latitude && event.longitude
event.related_city.longitude xml.georss :point, event.latitude, ' ', event.longitude
xml.georss :point,
event.related_city.latitude,
' ',
event.related_city.longitude
end end
@event = event @event = event

View File

@ -1,11 +1,12 @@
xml.instruct! xml.instruct!
xml.events do xml.events do
for event in @events @events.each do |event|
xml.event do xml.event do
xml.title event.title xml.title event.title
xml.start_time event.start_time.strftime '%Y/%m/%d %T' xml.start_time event.start_time.strftime '%Y/%m/%d %T'
xml.end_time event.end_time.strftime '%Y/%m/%d %T' xml.end_time event.end_time.strftime '%Y/%m/%d %T'
xml.address event.address
xml.city event.city xml.city event.city
xml.region event.related_region xml.region event.related_region
xml.locality event.locality xml.locality event.locality