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
|
|
|
|
@workgroups = Workgroup.order(:name.asc)
|
|
|
|
# if somebody uses the search field:
|
|
|
|
@workgroups = @workgroups.where(:name.matches => "%#{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
|