| Class | ProfileMembersController |
| In: |
app/controllers/my_profile/profile_members_controller.rb
|
| Parent: | MyProfileController |
# File app/controllers/my_profile/profile_members_controller.rb, line 27
27: def add_role
28: @person = Person.find(params[:person])
29: @role = Role.find(params[:role])
30: if @profile.affiliate(@person, @role)
31: redirect_to :action => 'index'
32: else
33: @member = Person.find(params[:person])
34: @roles = Role.find(:all).select{ |r| r.has_kind?('Profile') }
35: render :action => 'affiliate'
36: end
37: end
# File app/controllers/my_profile/profile_members_controller.rb, line 21
21: def change_role
22: @roles = profile.roles
23: @member = Person.find(params[:id])
24: @associations = @member.find_roles(@profile)
25: end
# File app/controllers/my_profile/profile_members_controller.rb, line 4 4: def index 5: @members = profile.members 6: @member_role = Role.find_by_name('member') 7: end
# File app/controllers/my_profile/profile_members_controller.rb, line 39
39: def remove_role
40: @association = RoleAssignment.find(params[:id])
41: if @association.destroy
42: flash[:notice] = 'Member succefully unassociated'
43: else
44: flash[:notice] = 'Failed to unassociate member'
45: end
46: redirect_to :aciton => 'index'
47: end
# File app/controllers/my_profile/profile_members_controller.rb, line 49
49: def unassociate
50: @association = RoleAssignment.find(params[:id])
51: if @association.destroy
52: flash[:notice] = 'Member succefully unassociated'
53: else
54: flash[:notice] = 'Failed to unassociate member'
55: end
56: redirect_to :aciton => 'index'
57: end
# File app/controllers/my_profile/profile_members_controller.rb, line 9
9: def update_roles
10: @roles = params[:roles] ? Role.find(params[:roles]) : []
11: @roles = @roles.select{|r| r.has_kind?('Profile') }
12: @person = Person.find(params[:person])
13: if @person.define_roles(@roles, profile)
14: flash[:notice] = _('Roles successfuly updated')
15: else
16: flash[:notice] = _('Couldn\'t change the roles')
17: end
18: redirect_to :action => :index
19: end