2012-07-31 18:48:41 +02:00
|
|
|
# encoding: utf-8
|
2010-03-22 01:58:37 +01:00
|
|
|
class Admin::OrdergroupsController < Admin::BaseController
|
2011-06-10 01:36:04 +02:00
|
|
|
inherit_resources
|
2009-01-14 12:46:01 +01:00
|
|
|
|
|
|
|
def index
|
2012-09-30 21:15:55 +02:00
|
|
|
@ordergroups = Ordergroup.order('name ASC')
|
2011-06-10 01:36:04 +02:00
|
|
|
|
|
|
|
# if somebody uses the search field:
|
|
|
|
unless params[:query].blank?
|
2012-09-30 21:15:55 +02:00
|
|
|
@ordergroups = @ordergroups.where('name LIKE ?', "%#{params[:query]}%")
|
2011-06-10 01:36:04 +02:00
|
|
|
end
|
|
|
|
|
2012-10-15 21:19:17 +02:00
|
|
|
@ordergroups = @ordergroups.page(params[:page]).per(@per_page)
|
2009-01-14 12:46:01 +01:00
|
|
|
end
|
2011-06-10 13:33:10 +02:00
|
|
|
|
|
|
|
def destroy
|
|
|
|
@ordergroup = Ordergroup.find(params[:id])
|
|
|
|
@ordergroup.destroy
|
2013-02-09 06:47:21 +01:00
|
|
|
redirect_to admin_ordergroups_url, notice: t('admin.ordergroups.destroy.notice')
|
2011-06-10 13:33:10 +02:00
|
|
|
rescue => error
|
2013-02-09 06:47:21 +01:00
|
|
|
redirect_to admin_ordergroups_url, alert: t('admin.ordergroups.destroy.error')
|
2011-06-10 13:33:10 +02:00
|
|
|
end
|
2009-01-14 12:46:01 +01:00
|
|
|
end
|