Class: GroupsController
Constant Summary
Localization::LOCALIZED_STRINGS
Instance Method Summary
collapse
in_place_edit_for, #initialize
#back_or_link_to, #detour?, #detour_to, #display_notice, #h, #image_button_to, #image_detour_to, #image_link_to, #image_link_to_remote, #insert, #record, #resolution_image, #t, #update_task, #with_detour
#l, load_localized_strings, #valid_language?
Instance Method Details
#create ⇒ Object
21
22
23
24
25
26
27
28
29
|
# File 'app/controllers/groups_controller.rb', line 21
def create
@group = Group.new(params[:group])
if @group.save
flash[:notice] = 'Group was successfully created.'
back_or_redirect_to :action => 'list'
else
render :action => 'new'
end
end
|
#destroy ⇒ Object
47
48
49
50
|
# File 'app/controllers/groups_controller.rb', line 47
def destroy
Group.find(params[:id]).destroy
redirect_to :action => 'list'
end
|
#edit ⇒ Object
31
32
33
34
35
|
# File 'app/controllers/groups_controller.rb', line 31
def edit
@group = Group.find(params[:id])
@users = User.find(:all, :order => 'first_name, last_name')
@groups = Group.find(:all, :order => 'name')
end
|
#index ⇒ Object
4
5
6
7
|
# File 'app/controllers/groups_controller.rb', line 4
def index
list
render :action => 'list'
end
|
#list ⇒ Object
13
14
15
|
# File 'app/controllers/groups_controller.rb', line 13
def list
@groups = Group.paginate({:page => params[:page]})
end
|
#new ⇒ Object
17
18
19
|
# File 'app/controllers/groups_controller.rb', line 17
def new
@group = Group.new
end
|
#set_member ⇒ Object
52
53
54
55
56
57
58
59
60
61
|
# File 'app/controllers/groups_controller.rb', line 52
def set_member
@group = Group.find(params[:id])
@user = User.find(params[:user_id])
if params[:value] == 'true'
@group.users << @user unless @group.users.include? @user
else
@group.users.delete @user
end
@users = User.find(:all)
end
|
#update ⇒ Object
37
38
39
40
41
42
43
44
45
|
# File 'app/controllers/groups_controller.rb', line 37
def update
@group = Group.find(params[:id])
if @group.update_attributes(params[:group])
flash[:notice] = 'Group was successfully updated.'
back_or_redirect_to :action => :edit, :id => @group
else
render :action => 'edit'
end
end
|