foodsoft/app/controllers/admin/workgroups_controller.rb

21 lines
648 B
Ruby
Raw Normal View History

# encoding: utf-8
class Admin::WorkgroupsController < Admin::BaseController
inherit_resources
def index
@workgroups = Workgroup.order('name ASC')
# if somebody uses the search field:
@workgroups = @workgroups.where('name LIKE ?', "%#{params[:query]}%") unless params[:query].blank?
@workgroups = @workgroups.page(params[:page]).per(@per_page)
end
2011-06-10 13:22:15 +02:00
def destroy
@workgroup = Workgroup.find(params[:id])
@workgroup.destroy
2013-02-09 06:47:21 +01:00
redirect_to admin_workgroups_url, notice: t('admin.ordergroups.destroy.notice')
2011-06-10 13:22:15 +02:00
rescue => error
2013-02-09 06:47:21 +01:00
redirect_to admin_workgroups_url, alert: t('admin.ordergroups.destroy.error')
end
end