Class PeerGroupsController
In: app/controllers/peer_groups_controller.rb
Parent: ApplicationController

Methods

create   destroy   edit   find   index   new   update  

Public Instance methods

[Source]

    # File app/controllers/peer_groups_controller.rb, line 39
39:   def create
40:     @peer_group = PeerGroup.new(params[:peer_group])
41:     @peer_group.memberships.build(:user => current_user, :admin_settings => true)
42:     if @peer_group.save
43:       flash[:notice] = t 'c.peer_groups.created'
44:       redirect_to peer_group_ll_url(@peer_group)
45:     else
46:       flash[:error] = t 'c.peer_groups.error_creating'
47:       render :action => 'new'
48:     end
49:   end

[Source]

    # File app/controllers/peer_groups_controller.rb, line 60
60:   def destroy
61:     # Only site admin and group-admin can destroy it
62:     if @peer_group.admin_permissions?(current_user) and
63:         @peer_group != PeerGroup.public
64:       @peer_group.destroy
65:       session[:current_peer_group_id] = PeerGroup.public.id
66:       flash[:notice] = t 'c.peer_groups.deleted'
67:       redirect_to root_url
68:     else
69:       flash[:error] = t 'c.peer_groups.error_deleting'
70:       redirect_to peer_group_ll_url(@peer_group)
71:     end
72:   end

[Source]

    # File app/controllers/peer_groups_controller.rb, line 51
51:   def edit
52:   end

Methods

[Source]

    # File app/controllers/peer_groups_controller.rb, line 29
29:   def index
30:     @peer_groups = PeerGroup.paginate(:page => params[:page], :per_page => 10,
31:         :order => 'name ASC')
32:     render :layout => 'broad'
33:   end

[Source]

    # File app/controllers/peer_groups_controller.rb, line 35
35:   def new
36:     @peer_group = PeerGroup.new
37:   end

[Source]

    # File app/controllers/peer_groups_controller.rb, line 54
54:   def update
55:     render_to_confirm_delete :text => t('c.peer_groups.confirm_delete'),
56:         :url => peer_group_url(@peer_group),
57:         :cancel_url => edit_user_url(current_user)
58:   end

Protected Instance methods

Filter-methods

[Source]

    # File app/controllers/peer_groups_controller.rb, line 78
78:   def find
79:     @peer_group = PeerGroup.find(params[:id])
80:   end

[Validate]