Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
01a7250b
Commit
01a7250b
authored
Feb 18, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add user to team he creates
parent
02007866
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
6 deletions
+22
-6
app/controllers/teams_controller.rb
app/controllers/teams_controller.rb
+3
-2
app/models/ability.rb
app/models/ability.rb
+1
-1
app/views/teams/members/_show.html.haml
app/views/teams/members/_show.html.haml
+4
-3
app/views/teams/new.html.haml
app/views/teams/new.html.haml
+14
-0
No files found.
app/controllers/teams_controller.rb
View file @
01a7250b
...
...
@@ -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
...
...
app/models/ability.rb
View file @
01a7250b
...
...
@@ -123,7 +123,7 @@ class Ability
def
user_team_abilities
user
,
team
rules
=
[]
# Only group owner and administrators can manage
group
# Only group owner and administrators can manage
team
if
team
.
owner
==
user
||
team
.
admin?
(
user
)
||
user
.
admin?
rules
<<
[
:manage_user_team
]
end
...
...
app/views/teams/members/_show.html.haml
View file @
01a7250b
...
...
@@ -17,13 +17,14 @@
=
f
.
select
:permission
,
options_for_select
(
UsersProject
.
access_roles
,
@team
.
default_projects_access
(
user
)),
{},
class:
"medium project-access-select span2"
.left.span2
%span
=
check_box_tag
:group_admin
,
true
,
@team
.
admin?
(
user
)
Admin access
-
if
@team
.
admin?
(
user
)
%i
.icon-check
Admin access
.pull-right
-
if
current_user
==
user
%span
.btn.disabled
This is you!
-
if
@team
.
owner
==
user
%span
.btn.disabled
.btn-success
Owner
%span
.btn.disabled
Owner
-
elsif
user
.
blocked
%span
.btn.disabled.blocked
Blocked
-
elsif
allow_admin
...
...
app/views/teams/new.html.haml
View file @
01a7250b
...
...
@@ -17,3 +17,17 @@
%li
All created teams are public (users can view who enter into team and which project are assigned for this team)
%li
People within a team see only projects they have access to
%li
You will be able to assign existing projects for team
%hr
-
if
current_user
.
can_create_group?
.clearfix
.input.light
Need a group for several dependent projects?
=
link_to
new_group_path
,
class:
"btn btn-tiny"
do
Create a group
-
if
current_user
.
can_create_project?
.clearfix
.input.light
Want to create a project?
=
link_to
new_project_path
,
class:
"btn btn-tiny"
do
Create a project
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment