xmllistevents.php ajouté
This commit is contained in:
parent
2c6080abc0
commit
e75f29860b
@ -46,6 +46,10 @@ class EventsController < ApplicationController
|
||||
format.ics {
|
||||
@events = @events.where('start_time > ?', 360.days.ago).order :id
|
||||
}
|
||||
|
||||
format.xml {
|
||||
@events = @events.order :id
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
21
app/views/events/index.xml.builder
Normal file
21
app/views/events/index.xml.builder
Normal file
@ -0,0 +1,21 @@
|
||||
xml.instruct!
|
||||
|
||||
xml.events do
|
||||
for event in @events
|
||||
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.city event.city
|
||||
xml.region event.related_region
|
||||
xml.locality event.locality
|
||||
xml.tags event.tags
|
||||
xml.contact event.contact
|
||||
xml.adlurl event_url event
|
||||
|
||||
@event = event
|
||||
content = render file: '/events/show.html', locals: { rss: true }
|
||||
xml.description { xml.cdata! content }
|
||||
end
|
||||
end
|
||||
end
|
@ -23,6 +23,8 @@ Rails.application.routes.draw do
|
||||
resources :tags, only: [ :index, :show ]
|
||||
resources :maps, only: [:index]
|
||||
|
||||
# A mechanism to list "all" events
|
||||
get '(:format)listevents.php', to: 'events#index'
|
||||
# Respond to rss and ical calls
|
||||
get ':format.php' => 'events#index'
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user