export feature for tracks and booths are done

This commit is contained in:
Your Name 2017-10-09 17:46:39 +05:30 committed by Stella Rouzi
parent be1992a03a
commit e99287d18a
22 changed files with 418 additions and 3 deletions

View file

@ -3,7 +3,24 @@ module Admin
load_and_authorize_resource :conference, find_by: :short_title
load_and_authorize_resource through: :conference
def index; end
def index
@file_name = "booths_for_#{@conference.short_title}"
@booth_export_option = params[:booth_export_option]
respond_to do |format|
format.html
# Explicity call #to_json to avoid the use of EventSerializer
format.json { render json: Booth.where(state: :confirmed, program: @program).to_json }
format.xlsx do
response.headers['Content-Disposition'] = "attachment; filename=\"#{@file_name}.xlsx\""
render 'booths'
end
format.pdf { render 'booths' }
format.csv do
response.headers['Content-Disposition'] = "attachment; filename=\"#{@file_name}.csv\""
render 'booths'
end
end
end
def show; end

View file

@ -7,7 +7,25 @@ module Admin
# Show flash message with ajax calls
after_action :prepare_unobtrusive_flash, only: :toggle_cfp_inclusion
def index; end
def index
@file_name = "tracks_for_#{@conference.short_title}"
@track_export_option = params[:track_export_option]
respond_to do |format|
format.html
# Explicity call #to_json to avoid the use of EventSerializer
format.json { render json: Track.where(state: :confirmed, program: @program).to_json }
format.xlsx do
response.headers['Content-Disposition'] = "attachment; filename=\"#{@file_name}.xlsx\""
render 'tracks'
end
format.pdf { render 'tracks' }
format.csv do
response.headers['Content-Disposition'] = "attachment; filename=\"#{@file_name}.csv\""
render 'tracks'
end
end
end
def show
respond_to do |format|