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:
|
2023-05-12 13:01:12 +02:00
|
|
|
@workgroups = @workgroups.where('name LIKE ?', "%#{params[:query]}%") if params[:query].present?
|
2009-01-13 19:01:56 +01:00
|
|
|
|
2012-10-15 21:19:17 +02:00
|
|
|
@workgroups = @workgroups.page(params[:page]).per(@per_page)
|
2009-01-13 19:01:56 +01:00
|
|
|
end
|
|
|
|
|
2011-06-10 13:22:15 +02:00
|
|
|
def destroy
|
|
|
|
@workgroup = Workgroup.find(params[:id])
|
|
|
|
@workgroup.destroy
|
2023-05-12 13:01:12 +02:00
|
|
|
redirect_to admin_workgroups_url, notice: t('.notice')
|
|
|
|
rescue StandardError => e
|
|
|
|
redirect_to admin_workgroups_url, alert: t('.error', error: e.message)
|
2009-01-13 19:01:56 +01:00
|
|
|
end
|
|
|
|
end
|