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
|
2011-06-10 01:36:04 +02:00
|
|
|
@ordergroups = Ordergroup.order(:name.asc)
|
|
|
|
|
|
|
|
# if somebody uses the search field:
|
|
|
|
unless params[:query].blank?
|
|
|
|
@ordergroups = @ordergroups.where(:name.matches => "%#{params[:query]}%")
|
|
|
|
end
|
|
|
|
|
|
|
|
@ordergroups = @ordergroups.paginate(:page => params[:page], :per_page => @per_page)
|
2009-01-14 12:46:01 +01:00
|
|
|
|
|
|
|
respond_to do |format|
|
2011-06-10 01:36:04 +02:00
|
|
|
format.html # index.html.haml
|
|
|
|
format.js { render :layout => false } # index.js.erb
|
2009-01-14 12:46:01 +01:00
|
|
|
end
|
|
|
|
end
|
2011-06-10 13:33:10 +02:00
|
|
|
|
|
|
|
def destroy
|
|
|
|
@ordergroup = Ordergroup.find(params[:id])
|
|
|
|
@ordergroup.destroy
|
|
|
|
redirect_to admin_ordergroups_url, :notice => "Bestellgruppe wurde gelöscht"
|
|
|
|
rescue => error
|
|
|
|
redirect_to admin_ordergroups_url, :alert => "Bestellgruppe konnte nicht gelöscht werden: #{error}"
|
|
|
|
end
|
2009-01-14 12:46:01 +01:00
|
|
|
end
|