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
0
Merge Requests
0
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
iv
gitlab-ce
Commits
ea6f46cb
Commit
ea6f46cb
authored
Jan 19, 2013
by
Andrey Kumanyaev
Committed by
Dmitriy Zaporozhets
Jan 24, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Team members public section
parent
360aa1b4
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
212 additions
and
0 deletions
+212
-0
app/controllers/teams/members_controller.rb
app/controllers/teams/members_controller.rb
+58
-0
app/views/teams/members/_form.html.haml
app/views/teams/members/_form.html.haml
+23
-0
app/views/teams/members/_show.html.haml
app/views/teams/members/_show.html.haml
+31
-0
app/views/teams/members/_team.html.haml
app/views/teams/members/_team.html.haml
+16
-0
app/views/teams/members/index.html.haml
app/views/teams/members/index.html.haml
+18
-0
app/views/teams/members/new.html.haml
app/views/teams/members/new.html.haml
+2
-0
app/views/teams/members/show.html.haml
app/views/teams/members/show.html.haml
+60
-0
config/routes.rb
config/routes.rb
+4
-0
No files found.
app/controllers/teams/members_controller.rb
0 → 100644
View file @
ea6f46cb
class
Teams::MembersController
<
Teams
::
ApplicationController
# Authorize
before_filter
:authorize_manage_user_team!
,
only:
[
:new
,
:edit
]
def
index
@members
=
@user_team
.
members
end
def
show
@team_member
=
@user_team
.
members
.
find
(
params
[
:id
])
@events
=
@team_member
.
recent_events
.
limit
(
7
)
end
def
new
@team_member
=
@user_team
.
members
.
new
end
def
create
users
=
User
.
where
(
id:
params
[
:user_ids
])
@project
.
team
<<
[
users
,
params
[
:default_project_access
]]
if
params
[
:redirect_to
]
redirect_to
params
[
:redirect_to
]
else
redirect_to
project_team_index_path
(
@project
)
end
end
def
update
@team_member
=
@user_team
.
members
.
find
(
params
[
:id
])
@team_member
.
update_attributes
(
params
[
:team_member
])
unless
@team_member
.
valid?
flash
[
:alert
]
=
"User should have at least one role"
end
redirect_to
team_member_path
(
@project
)
end
def
destroy
@team_member
=
project
.
users_projects
.
find
(
params
[
:id
])
@team_member
.
destroy
respond_to
do
|
format
|
format
.
html
{
redirect_to
project_team_index_path
(
@project
)
}
format
.
js
{
render
nothing:
true
}
end
end
def
apply_import
giver
=
Project
.
find
(
params
[
:source_project_id
])
status
=
@project
.
team
.
import
(
giver
)
notice
=
status
?
"Succesfully imported"
:
"Import failed"
redirect_to
project_team_members_path
(
project
),
notice:
notice
end
end
app/views/teams/members/_form.html.haml
0 → 100644
View file @
ea6f46cb
%h3
.page_title
=
"New Team member(s)"
%hr
=
form_for
@team_member
,
as: :team_member
,
url:
project_team_members_path
(
@project
,
@team_member
)
do
|
f
|
-
if
@team_member
.
errors
.
any?
.alert-message.block-message.error
%ul
-
@team_member
.
errors
.
full_messages
.
each
do
|
msg
|
%li
=
msg
%h6
1. Choose people you want in the team
.clearfix
=
f
.
label
:user_ids
,
"People"
.input
=
select_tag
(
:user_ids
,
options_from_collection_for_select
(
User
.
active
.
not_in_project
(
@project
).
alphabetically
,
:id
,
:name
),
{
data:
{
placeholder:
"Select users"
},
class:
"chosen xxlarge"
,
multiple:
true
})
%h6
2. Set access level for them
.clearfix
=
f
.
label
:project_access
,
"Project Access"
.input
=
select_tag
:project_access
,
options_for_select
(
Project
.
access_options
,
@team_member
.
project_access
),
class:
"project-access-select chosen"
.actions
=
f
.
submit
'Save'
,
class:
"btn save-btn"
=
link_to
"Cancel"
,
project_team_index_path
(
@project
),
class:
"btn cancel-btn"
app/views/teams/members/_show.html.haml
0 → 100644
View file @
ea6f46cb
-
user
=
member
.
user
-
allow_admin
=
can?
current_user
,
:manage_user_team
,
@user_team
%li
{
id:
dom_id
(
member
),
class:
"team_member_row user_#{user.id}"
}
.row
.span5
=
link_to
team_member_path
(
@user_team
,
user
),
title:
user
.
name
,
class:
"dark"
do
=
image_tag
gravatar_icon
(
user
.
email
,
40
),
class:
"avatar s32"
=
link_to
team_member_path
(
@user_team
,
user
),
title:
user
.
name
,
class:
"dark"
do
%strong
=
truncate
(
user
.
name
,
lenght:
40
)
%br
%small
.cgray
=
user
.
email
.span6.right
-
if
allow_admin
.left.span2
=
form_for
(
member
,
as: :team_member
,
url:
team_member_path
(
@user_team
,
user
))
do
|
f
|
=
f
.
select
:permission
,
options_for_select
(
UsersProject
.
access_roles
,
@user_team
.
default_projects_access
(
user
)),
{},
class:
"medium project-access-select span2"
.left.span2
%span
Admin access
=
check_box_tag
:group_admin
.right
-
if
current_user
==
user
%span
.btn.disabled
This is you!
-
if
@user_team
.
owner
==
user
%span
.btn.disabled.success
Owner
-
elsif
user
.
blocked
%span
.btn.disabled.blocked
Blocked
-
elsif
allow_admin
=
link_to
team_member_path
(
@user_team
,
user
),
confirm:
remove_from_team_message
(
@user_team
,
user
),
method: :delete
,
class:
"very_small btn danger"
do
%i
.icon-minus.icon-white
app/views/teams/members/_team.html.haml
0 → 100644
View file @
ea6f46cb
-
grouped_user_team_members
(
@user_team
).
each
do
|
access
,
members
|
.ui-box
%h5
.title
=
Project
.
access_options
.
key
(
access
).
pluralize
%small
=
members
.
size
%ul
.well-list
-
members
.
sort_by
(
&
:user_name
).
each
do
|
up
|
=
render
(
partial:
'teams/members/show'
,
locals:
{
member:
up
})
:javascript
$
(
function
(){
$
(
'
.repo-access-select, .project-access-select
'
).
live
(
"
change
"
,
function
()
{
$
(
this
.
form
).
submit
();
});
})
app/views/teams/members/index.html.haml
0 → 100644
View file @
ea6f46cb
=
render
"teams/team_head"
%h3
.page_title
Team Members
(
#{
@members
.
count
}
)
%small
Read more about project permissions
%strong
=
link_to
"here"
,
help_permissions_path
,
class:
"vlink"
-
if
can?
current_user
,
:manage_user_team
,
@user_team
%span
.right
=
link_to
new_team_member_path
(
@user_team
),
class:
"btn success small grouped"
,
title:
"New Team Member"
do
New Team Member
%hr
.clearfix
%div
.team-table
=
render
partial:
"teams/members/team"
,
locals:
{
project:
@user_team
}
app/views/teams/members/new.html.haml
0 → 100644
View file @
ea6f46cb
=
render
"projects/project_head"
=
render
"team_members/form"
app/views/teams/members/show.html.haml
0 → 100644
View file @
ea6f46cb
-
allow_admin
=
can?
current_user
,
:admin_project
,
@project
-
user
=
@team_member
.
user
.team_member_show
-
if
can?
current_user
,
:admin_project
,
@project
=
link_to
'Remove from team'
,
project_team_member_path
(
project_id:
@project
,
id:
@team_member
.
id
),
confirm:
'Are you sure?'
,
method: :delete
,
class:
"right btn danger"
.profile_avatar_holder
=
image_tag
gravatar_icon
(
user
.
email
,
60
),
class:
"borders"
%h3
.page_title
=
user
.
name
%small
(@
#{
user
.
username
}
)
%hr
.back_link
%br
=
link_to
project_team_index_path
(
@project
),
class:
""
do
←
To team list
%br
.row
.span6
%table
.lite
%tr
%td
Email
%td
=
mail_to
user
.
email
%tr
%td
Skype
%td
=
user
.
skype
-
unless
user
.
linkedin
.
blank?
%tr
%td
LinkedIn
%td
=
user
.
linkedin
-
unless
user
.
twitter
.
blank?
%tr
%td
Twitter
%td
=
user
.
twitter
-
unless
user
.
bio
.
blank?
%tr
%td
Bio
%td
=
user
.
bio
.span6
%table
.lite
%tr
%td
Member since
%td
=
@team_member
.
created_at
.
stamp
(
"Aug 21, 2011"
)
%tr
%td
Project Access:
%small
(
#{
link_to
"read more"
,
help_permissions_path
,
class:
"vlink"
}
)
%td
=
form_for
(
@team_member
,
as: :team_member
,
url:
project_team_member_path
(
@project
,
@team_member
))
do
|
f
|
=
f
.
select
:project_access
,
options_for_select
(
Project
.
access_options
,
@team_member
.
project_access
),
{},
class:
"project-access-select"
,
disabled:
!
allow_admin
%hr
=
render
@events
:javascript
$
(
function
(){
$
(
'
.repo-access-select, .project-access-select
'
).
live
(
"
change
"
,
function
()
{
$
(
this
.
form
).
submit
();
});
})
config/routes.rb
View file @
ea6f46cb
...
@@ -139,6 +139,10 @@ Gitlab::Application.routes.draw do
...
@@ -139,6 +139,10 @@ Gitlab::Application.routes.draw do
delete
:relegate_project
delete
:relegate_project
put
:update_access
put
:update_access
end
end
scope
module: :teams
do
resources
:members
end
end
collection
do
collection
do
get
:search
get
:search
end
end
...
...
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