Initial XML export support (FRAB compatible)
This commit is contained in:
parent
1cc2b0cac2
commit
628e433fbc
6 changed files with 51 additions and 0 deletions
|
|
@ -223,6 +223,12 @@ class Event < ActiveRecord::Base
|
|||
(100 * result.values.count(true) / result.values.compact.count).to_s
|
||||
end
|
||||
|
||||
##
|
||||
# Returns the slug of an event
|
||||
def slugify
|
||||
"#{self.id}-#{self.title.downcase.gsub(/[^a-z1-9]+/, '-').chomp('-')}"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
##
|
||||
|
|
|
|||
|
|
@ -12,6 +12,13 @@ class EventType < ActiveRecord::Base
|
|||
|
||||
LENGTH_STEP = 15
|
||||
|
||||
##
|
||||
# Return the length in timestamp format (HH:MM)
|
||||
#
|
||||
def length_timestamp
|
||||
[self.length / 60, self.length % 60].map { |t| t.to_s.rjust(2,'0') }.join(':')
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
##
|
||||
|
|
|
|||
3
app/views/conference/_all_days.xml.haml
Normal file
3
app/views/conference/_all_days.xml.haml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
- @conference.program.events.group_by{ |event| event.start_time.to_date }.each_with_index do | day, index |
|
||||
%day{ :date => day[0], :index => index+1 }
|
||||
=render 'all_rooms', :events => day[1]
|
||||
4
app/views/conference/_all_rooms.xml.haml
Normal file
4
app/views/conference/_all_rooms.xml.haml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
- events.group_by{ |event| event.room }.each do | room |
|
||||
%room{ :name => room[0].name }
|
||||
- room[1].each do | event |
|
||||
= render 'event', :event => event
|
||||
20
app/views/conference/_event.xml.haml
Normal file
20
app/views/conference/_event.xml.haml
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
- event.public?
|
||||
%event{ :guid => event.guid, :id => event.id }
|
||||
%date=event.start_time.iso8601
|
||||
%start=event.start_time.strftime("%H:%M")
|
||||
%duration=event.event_type.length_timestamp
|
||||
%room=event.room.name
|
||||
%type=event.event_type.name
|
||||
%language="en" ## fix me, add language property to Event/Conference?
|
||||
%slug=event.slugify
|
||||
%title=event.title
|
||||
%subtitle=event.subtitle
|
||||
%track=event.track.name
|
||||
%abstract=event.abstract
|
||||
%recording
|
||||
%license/
|
||||
%optout=false #fixme
|
||||
%persons
|
||||
- event.speakers.uniq.each do | speaker |
|
||||
%person{ :id => speaker.id}= speaker.name
|
||||
|
||||
11
app/views/conference/schedule.xml.haml
Normal file
11
app/views/conference/schedule.xml.haml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
%schedule
|
||||
%version=@conference.revision
|
||||
%conference
|
||||
%acronym=@conference.short_title
|
||||
%title=@conference.title
|
||||
%start=@conference.start_date
|
||||
%end=@conference.end_date
|
||||
%days=(@conference.end_date - @conference.start_date).to_i + 1
|
||||
%timeslot_duration="00:15" ## fixme
|
||||
- if not @conference.venue.nil? and @conference.venue.rooms.any?
|
||||
= render 'all_days'
|
||||
Loading…
Add table
Add a link
Reference in a new issue