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|
format.html
format.rss do
@events = @events.includes(:related_city).future_in params[:daylimit]
@events = @events.future_in params[:daylimit]
end
format.ics { @events = @events.last_year.order :id }
format.xml { @events = @events.includes(:related_region).order :id }

View File

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

View File

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

View File

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

View File

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

View File

@ -1,11 +1,12 @@
xml.instruct!
xml.events do
for event in @events
@events.each do |event|
xml.event do
xml.title event.title
xml.start_time event.start_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.region event.related_region
xml.locality event.locality