2012-04-16 08:48:01 +02:00
|
|
|
# encoding: utf-8
|
2010-03-22 01:58:37 +01:00
|
|
|
class Admin::WorkgroupsController < Admin::BaseController
|
2011-06-10 12:18:55 +02:00
|
|
|
inherit_resources
|
2009-01-13 19:01:56 +01:00
|
|
|
|
2011-06-10 12:18:55 +02:00
|
|
|
def index
|
2012-09-30 21:15:55 +02:00
|
|
|
@workgroups = Workgroup.order('name ASC')
|
2011-06-10 12:18:55 +02:00
|
|
|
# if somebody uses the search field:
|
2012-09-30 21:15:55 +02:00
|
|
|
@workgroups = @workgroups.where('name LIKE ?', "%#{params[:query]}%") unless params[:query].blank?
|
2009-01-13 19:01:56 +01:00
|
|
|
|
2011-06-10 12:18:55 +02:00
|
|
|
@workgroups = @workgroups.paginate(:page => params[:page], :per_page => @per_page)
|
2009-01-13 19:01:56 +01:00
|
|
|
|
|
|
|
respond_to do |format|
|
2011-06-10 12:18:55 +02:00
|
|
|
format.html # index.html.haml
|
|
|
|
format.js { render :layout => false } # index.js.erb
|
2009-01-13 19:01:56 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2011-06-10 13:22:15 +02:00
|
|
|
def destroy
|
|
|
|
@workgroup = Workgroup.find(params[:id])
|
|
|
|
@workgroup.destroy
|
|
|
|
redirect_to admin_workgroups_url, :notice => "Arbeitsgruppe wurde gelöscht"
|
|
|
|
rescue => error
|
|
|
|
redirect_to admin_workgroups_url, :alert => "Arbeitsgruppe konnte nicht gelöscht werden: #{error}"
|
2009-01-13 19:01:56 +01:00
|
|
|
end
|
|
|
|
end
|