2016-02-17 12:26:21 +01:00
|
|
|
class Admin::MessagegroupsController < Admin::BaseController
|
|
|
|
inherit_resources
|
|
|
|
|
|
|
|
def index
|
|
|
|
@messagegroups = Messagegroup.order('name ASC')
|
|
|
|
# if somebody uses the search field:
|
2023-05-12 13:01:12 +02:00
|
|
|
@messagegroups = @messagegroups.where('name LIKE ?', "%#{params[:query]}%") if params[:query].present?
|
2016-02-17 12:26:21 +01:00
|
|
|
|
|
|
|
@messagegroups = @messagegroups.page(params[:page]).per(@per_page)
|
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
|
|
|
@messagegroup = Messagegroup.find(params[:id])
|
|
|
|
@messagegroup.destroy
|
|
|
|
redirect_to admin_messagegroups_url, notice: t('admin.messagegroups.destroy.notice')
|
2023-05-12 13:01:12 +02:00
|
|
|
rescue StandardError => e
|
|
|
|
redirect_to admin_messagegroups_url, alert: t('admin.messagegroups.destroy.error', error: e.message)
|
2016-02-17 12:26:21 +01:00
|
|
|
end
|
|
|
|
end
|