Add CSV download for ordergroups
This commit is contained in:
parent
389f205a6b
commit
71fd6f2a24
4 changed files with 56 additions and 2 deletions
|
|
@ -1,10 +1,14 @@
|
|||
# encoding: utf-8
|
||||
class Admin::OrdergroupsController < Admin::BaseController
|
||||
inherit_resources
|
||||
|
||||
|
||||
def index
|
||||
@ordergroups = Ordergroup.undeleted.order('name ASC')
|
||||
|
||||
if request.format.csv?
|
||||
send_data OrdergroupsCsv.new(@ordergroups).to_csv, filename: 'ordergroups.csv', type: 'text/csv'
|
||||
end
|
||||
|
||||
# if somebody uses the search field:
|
||||
unless params[:query].blank?
|
||||
@ordergroups = @ordergroups.where('name LIKE ?', "%#{params[:query]}%")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue