Class: Admin::GroupController

Inherits:
AdminController
  • Object
show all
Defined in:
app/controllers/admin/group_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/admin/group_controller.rb', line 10

def create
  @group = Group.new(params[:group])
  @group.system_id = _sid 
  if @group.save
    flash[:notice] = "Group created"
    Activity.add(_sid, "Created group '#{@group.name}'", current_user.id, "Groups", '') 
    redirect_to "/admin/groups"
  else
    @groups = Group.sys(_sid).order(:name).all
    render "index"
  end
end

#destroyObject



23
24
25
26
27
28
29
# File 'app/controllers/admin/group_controller.rb', line 23

def destroy
  @group = Group.find_sys_id(_sid, params[:id])
  Group.destroy(params[:id])
  Activity.add(_sid, "Deleted group '#{@group.name}'", current_user.id, "Groups", '') 
  flash[:notice] = "Group deleted"
  redirect_to "/admin/groups"
end

#indexObject



5
6
7
8
# File 'app/controllers/admin/group_controller.rb', line 5

def index
  @group = Group.new
  @groups = Group.order(:name).sys(_sid).all
end