Initial XML export support (FRAB compatible)

This commit is contained in:
Daniel Molkentin 2016-06-11 00:53:51 +02:00
parent 1cc2b0cac2
commit 628e433fbc
6 changed files with 51 additions and 0 deletions

View file

@ -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
##

View file

@ -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
##

View 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]

View 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

View 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

View 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'