added csv download

This commit is contained in:
dinsmol 2021-08-11 22:28:20 +03:00
parent c7e92452af
commit 7f8eee52f4
41 changed files with 259 additions and 35 deletions

View file

@ -13,6 +13,18 @@ module Admin
@repp_logs = @repp_logs.page(params[:page])
@count = @q.result.count
@repp_logs = @repp_logs.per(params[:results_per_page]) if paginate?
respond_to do |format|
format.html do
render 'admin/repp_logs/index'
end
format.csv do
raw_csv = @q.result.to_csv
send_data raw_csv,
filename: "repp_logs_#{Time.zone.now.to_formatted_s(:number)}.csv",
type: "#{Mime[:csv]}; charset=utf-8"
end
end
end
def show