Add user to team he creates
This commit is contained in:
parent
020078663e
commit
01a7250ba5
4 changed files with 22 additions and 6 deletions
|
@ -9,13 +9,11 @@ class TeamsController < ApplicationController
|
|||
layout 'user_team', except: [:new, :create]
|
||||
|
||||
def show
|
||||
user_team
|
||||
projects
|
||||
@events = Event.in_projects(user_team.project_ids).limit(20).offset(params[:offset] || 0)
|
||||
end
|
||||
|
||||
def edit
|
||||
user_team
|
||||
end
|
||||
|
||||
def update
|
||||
|
@ -41,6 +39,9 @@ class TeamsController < ApplicationController
|
|||
@team.path = @team.name.dup.parameterize if @team.name
|
||||
|
||||
if @team.save
|
||||
# Add current user as Master to the team
|
||||
@team.add_members([current_user.id], UsersProject::MASTER, true)
|
||||
|
||||
redirect_to team_path(@team)
|
||||
else
|
||||
render action: :new
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue