01cf6431a9
Messagegroups are a new kind of group. Every user can join and leave such a group on her own. They are useful to create topics for mails. E.g. if there is a weekly newsletter we can create a new messagegroup for it and every user which is interested in receiving the newsletter can join the corresponding group.
20 lines
710 B
Ruby
20 lines
710 B
Ruby
# encoding: utf-8
|
|
class Admin::MessagegroupsController < Admin::BaseController
|
|
inherit_resources
|
|
|
|
def index
|
|
@messagegroups = Messagegroup.order('name ASC')
|
|
# if somebody uses the search field:
|
|
@messagegroups = @messagegroups.where('name LIKE ?', "%#{params[:query]}%") unless params[:query].blank?
|
|
|
|
@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')
|
|
rescue => error
|
|
redirect_to admin_messagegroups_url, alert: t('admin.messagegroups.destroy.error', error: error.message)
|
|
end
|
|
end
|