exporting events to pdf, excel, and csv format

This commit is contained in:
AnithaPal 2016-08-11 16:21:30 -04:00
parent 7cc2609662
commit 3da3fcccbb
6 changed files with 139 additions and 4 deletions

View file

@ -23,11 +23,18 @@ module Admin
@tracks_distribution_confirmed = @conference.tracks_distribution(:confirmed)
@event_distribution = @conference.event_distribution
@scheduled_event_distribution = @conference.scheduled_event_distribution
@pdf_filename = "events_for_#{@conference.short_title}.pdf"
@file_name = "events_for_#{@conference.short_title}"
@csv_filename = "events_for_#{@conference.short_title}.csv"
respond_to do |format|
format.html
# Explicity call #to_json to avoid the use of EventSerializer
format.json { render json: Event.where(state: :confirmed, program: @program).to_json }
format.xlsx { render xlsx: 'index', filename: "#{@file_name}.xlsx" }
format.pdf
format.csv
# format.csv { send_data @events, filename:"#{@file_name}.csv" }
end
end