Enable exporting of events to CSV

This commit is contained in:
Petko Bordjukov 2016-10-08 21:25:45 +03:00
parent 921bde2d4e
commit cb63c66652
2 changed files with 6 additions and 0 deletions

View File

@ -1,3 +1,4 @@
require 'csv'
module Management module Management
class ManagementController < ::ApplicationController class ManagementController < ::ApplicationController
before_action :authenticate_user!, :authorize_user! before_action :authenticate_user!, :authorize_user!

View File

@ -0,0 +1,5 @@
<%- csv_headers = %w{id title subtitle type track language paticipants status} -%>
<%= CSV.generate_line(csv_headers).html_safe -%>
<%- @events.each do |event| -%>
<%= CSV.generate_line([event.id, event.title, event.subtitle, event.event_type.name, event.track.name, event.language, participant_names_or_emails(event).join(', '), event.status]).html_safe -%>
<%- end -%>