mirror of
https://github.com/internetee/registry.git
synced 2025-06-07 21:25:39 +02:00
refactored
This commit is contained in:
parent
8f17712232
commit
d2d31c049c
19 changed files with 32 additions and 112 deletions
|
@ -21,5 +21,19 @@ module Admin
|
|||
def paginate?
|
||||
params[:results_per_page].to_i.positive?
|
||||
end
|
||||
|
||||
def render_by_format(page, filename)
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
render page
|
||||
end
|
||||
format.csv do
|
||||
raw_csv = @q.result.to_csv
|
||||
send_data raw_csv,
|
||||
filename: "#{filename}_#{Time.zone.now.to_formatted_s(:number)}.csv",
|
||||
type: "#{Mime[:csv]}; charset=utf-8"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue