BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
e477ad44
Commit
e477ad44
authored
Sep 02, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removes row from dom when deleting
Fixed spacing with buttons Disables group form when user doesnt have correct permissions
parent
15a3111a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
27 additions
and
26 deletions
+27
-26
project_members.js.es6
app/assets/javascripts/project_members.js.es6
+4
-1
project_members_controller.rb
app/controllers/projects/project_members_controller.rb
+2
-5
project_team.rb
app/models/project_team.rb
+4
-4
_group.html.haml
app/views/shared/members/_group.html.haml
+11
-10
_member.html.haml
app/views/shared/members/_member.html.haml
+5
-5
_requests.html.haml
app/views/shared/members/_requests.html.haml
+1
-1
No files found.
app/assets/javascripts/project_members.js.es6
View file @
e477ad44
...
@@ -29,7 +29,10 @@
...
@@ -29,7 +29,10 @@
const $target = $(e.target);
const $target = $(e.target);
if ($target.hasClass('btn-remove')) {
if ($target.hasClass('btn-remove')) {
$target.closest('.member').fadeOut();
$target.closest('.member')
.fadeOut(function () {
$(this).remove();
});
}
}
}
}
...
...
app/controllers/projects/project_members_controller.rb
View file @
e477ad44
...
@@ -5,11 +5,9 @@ class Projects::ProjectMembersController < Projects::ApplicationController
...
@@ -5,11 +5,9 @@ class Projects::ProjectMembersController < Projects::ApplicationController
before_action
:authorize_admin_project_member!
,
except:
[
:index
,
:leave
,
:request_access
]
before_action
:authorize_admin_project_member!
,
except:
[
:index
,
:leave
,
:request_access
]
def
index
def
index
@groups
=
@project
.
project_group_links
.
all
@groups
=
@project
.
project_group_links
@project_members
=
@project
.
team
.
members
.
all
@project_members
=
@project
.
team
.
members
(
can?
(
current_user
,
:admin_project
,
@project
))
@project_members_size
=
@project_members
.
size
@project_members_size
=
@project_members
.
size
@group_members
=
@project
.
group
.
group_members
@project_members
=
@project_members
.
non_invite
unless
can?
(
current_user
,
:admin_project
,
@project
)
if
params
[
:search
].
present?
if
params
[
:search
].
present?
@project_members
=
@project_members
.
search
(
params
[
:search
])
@project_members
=
@project_members
.
search
(
params
[
:search
])
...
@@ -20,7 +18,6 @@ class Projects::ProjectMembersController < Projects::ApplicationController
...
@@ -20,7 +18,6 @@ class Projects::ProjectMembersController < Projects::ApplicationController
@requesters
=
@project
.
requesters
if
can?
(
current_user
,
:admin_project
,
@project
)
@requesters
=
@project
.
requesters
if
can?
(
current_user
,
:admin_project
,
@project
)
@project_member
=
@project
.
project_members
.
new
@project_member
=
@project
.
project_members
.
new
@project_group_links
=
@project
.
project_group_links
end
end
def
create
def
create
...
...
app/models/project_team.rb
View file @
e477ad44
...
@@ -52,8 +52,8 @@ class ProjectTeam
...
@@ -52,8 +52,8 @@ class ProjectTeam
ProjectMember
.
truncate_team
(
project
)
ProjectMember
.
truncate_team
(
project
)
end
end
def
members
def
members
(
non_invite
)
@members
||=
fetch_members
@members
||=
fetch_members
(
nil
,
non_invite
)
end
end
alias_method
:users
,
:members
alias_method
:users
,
:members
...
@@ -197,7 +197,7 @@ class ProjectTeam
...
@@ -197,7 +197,7 @@ class ProjectTeam
access
.
each
{
|
key
,
value
|
access
[
key
]
=
[
value
,
capped_access_level
].
min
}
access
.
each
{
|
key
,
value
|
access
[
key
]
=
[
value
,
capped_access_level
].
min
}
end
end
def
fetch_members
(
level
=
nil
)
def
fetch_members
(
level
=
nil
,
non_invite
=
false
)
project_members
=
project
.
members
project_members
=
project
.
members
group_members
=
group
?
group
.
members
:
[]
group_members
=
group
?
group
.
members
:
[]
invited_members
=
[]
invited_members
=
[]
...
@@ -236,7 +236,7 @@ class ProjectTeam
...
@@ -236,7 +236,7 @@ class ProjectTeam
end
end
user_ids
=
project_members
.
pluck
(
:user_id
)
user_ids
=
project_members
.
pluck
(
:user_id
)
user_ids
.
push
(
*
invited_members
.
map
(
&
:user_id
))
if
invited_members
.
any?
user_ids
.
push
(
*
invited_members
.
map
(
&
:user_id
))
if
invited_members
.
any?
&&
!
non_invite
user_ids
.
push
(
*
group_members
.
pluck
(
:user_id
))
if
group
user_ids
.
push
(
*
group_members
.
pluck
(
:user_id
))
if
group
User
.
where
(
id:
user_ids
)
User
.
where
(
id:
user_ids
)
...
...
app/views/shared/members/_group.html.haml
View file @
e477ad44
...
@@ -13,14 +13,15 @@
...
@@ -13,14 +13,15 @@
Expires in
#{
distance_of_time_in_words_to_now
(
group_link
.
expires_at
)
}
Expires in
#{
distance_of_time_in_words_to_now
(
group_link
.
expires_at
)
}
.controls.member-controls
.controls.member-controls
=
form_tag
namespace_project_group_link_path
(
@project
.
namespace
,
@project
,
group_link
),
method: :put
,
remote:
true
,
class:
'form-horizontal js-edit-member-form'
do
=
form_tag
namespace_project_group_link_path
(
@project
.
namespace
,
@project
,
group_link
),
method: :put
,
remote:
true
,
class:
'form-horizontal js-edit-member-form'
do
=
select_tag
'group_link[group_access]'
,
options_for_select
(
ProjectGroupLink
.
access_options
,
group_link
.
group_access
),
class:
'form-control member-form-control append-right-5 js-member-update-control'
,
id:
"member_access_level_
#{
group
.
id
}
"
=
select_tag
'group_link[group_access]'
,
options_for_select
(
ProjectGroupLink
.
access_options
,
group_link
.
group_access
),
class:
'form-control member-form-control append-right-5 js-member-update-control'
,
id:
"member_access_level_
#{
group
.
id
}
"
,
disabled:
!
can?
(
current_user
,
action_member_permission
(
:admin
,
group
),
group
)
.prepend-left-5.
append-right-10.
clearable-input.member-form-control
.prepend-left-5.clearable-input.member-form-control
=
text_field_tag
'group_link[expires_at]'
,
group_link
.
expires_at
,
class:
'form-control js-access-expiration-date js-member-update-control'
,
placeholder:
'Expiration date'
,
id:
"member_expires_at_
#{
group
.
id
}
"
=
text_field_tag
'group_link[expires_at]'
,
group_link
.
expires_at
,
class:
'form-control js-access-expiration-date js-member-update-control'
,
placeholder:
'Expiration date'
,
id:
"member_expires_at_
#{
group
.
id
}
"
,
disabled:
!
can?
(
current_user
,
action_member_permission
(
:admin
,
group
),
group
)
%i
.clear-icon.js-clear-input
%i
.clear-icon.js-clear-input
=
link_to
namespace_project_group_link_path
(
@project
.
namespace
,
@project
,
group_link
),
-
if
can?
(
current_user
,
action_member_permission
(
:admin
,
group
),
group
)
remote:
true
,
=
link_to
namespace_project_group_link_path
(
@project
.
namespace
,
@project
,
group_link
),
method: :delete
,
remote:
true
,
class:
'btn btn-remove'
do
method: :delete
,
%span
.visible-xs-block
class:
'btn btn-remove prepend-left-10'
do
Delete
%span
.visible-xs-block
=
icon
(
'trash'
,
class:
'hidden-xs'
)
Delete
=
icon
(
'trash'
,
class:
'hidden-xs'
)
app/views/shared/members/_member.html.haml
View file @
e477ad44
...
@@ -47,7 +47,7 @@
...
@@ -47,7 +47,7 @@
-
if
user
!=
current_user
-
if
user
!=
current_user
=
form_for
member
,
remote:
true
,
html:
{
class:
'form-horizontal js-edit-member-form'
}
do
|
f
|
=
form_for
member
,
remote:
true
,
html:
{
class:
'form-horizontal js-edit-member-form'
}
do
|
f
|
=
f
.
select
:access_level
,
options_for_select
(
member
.
class
.
access_level_roles
,
member
.
access_level
),
{},
class:
'form-control member-form-control append-right-5 js-member-update-control'
,
id:
"member_access_level_
#{
member
.
id
}
"
,
disabled:
!
can?
(
current_user
,
action_member_permission
(
:update
,
member
),
member
)
=
f
.
select
:access_level
,
options_for_select
(
member
.
class
.
access_level_roles
,
member
.
access_level
),
{},
class:
'form-control member-form-control append-right-5 js-member-update-control'
,
id:
"member_access_level_
#{
member
.
id
}
"
,
disabled:
!
can?
(
current_user
,
action_member_permission
(
:update
,
member
),
member
)
.prepend-left-5.
append-right-10.
clearable-input.member-form-control
.prepend-left-5.clearable-input.member-form-control
=
f
.
text_field
:expires_at
,
class:
'form-control js-access-expiration-date js-member-update-control'
,
placeholder:
'Expiration date'
,
id:
"member_expires_at_
#{
member
.
id
}
"
,
disabled:
!
can?
(
current_user
,
action_member_permission
(
:update
,
member
),
member
)
=
f
.
text_field
:expires_at
,
class:
'form-control js-access-expiration-date js-member-update-control'
,
placeholder:
'Expiration date'
,
id:
"member_expires_at_
#{
member
.
id
}
"
,
disabled:
!
can?
(
current_user
,
action_member_permission
(
:update
,
member
),
member
)
%i
.clear-icon.js-clear-input
%i
.clear-icon.js-clear-input
-
else
-
else
...
@@ -55,12 +55,12 @@
...
@@ -55,12 +55,12 @@
-
if
!
user
&&
can?
(
current_user
,
action_member_permission
(
:admin
,
member
),
member
.
source
)
-
if
!
user
&&
can?
(
current_user
,
action_member_permission
(
:admin
,
member
),
member
.
source
)
=
link_to
'Resend invite'
,
polymorphic_path
([
:resend_invite
,
member
]),
=
link_to
'Resend invite'
,
polymorphic_path
([
:resend_invite
,
member
]),
method: :post
,
method: :post
,
class:
'btn'
class:
'btn
btn-default prepend-left-10
'
-
if
member
.
request?
&&
can?
(
current_user
,
action_member_permission
(
:update
,
member
),
member
)
-
if
member
.
request?
&&
can?
(
current_user
,
action_member_permission
(
:update
,
member
),
member
)
=
link_to
icon
(
'check inverse'
),
polymorphic_path
([
:approve_access_request
,
member
]),
=
link_to
icon
(
'check inverse'
),
polymorphic_path
([
:approve_access_request
,
member
]),
method: :post
,
method: :post
,
class:
'btn btn-success'
,
class:
'btn btn-success
prepend-left-10
'
,
title:
'Grant access'
title:
'Grant access'
-
if
can?
(
current_user
,
action_member_permission
(
:destroy
,
member
),
member
)
-
if
can?
(
current_user
,
action_member_permission
(
:destroy
,
member
),
member
)
...
@@ -68,13 +68,13 @@
...
@@ -68,13 +68,13 @@
=
link_to
icon
(
'sign-out'
,
text:
'Leave'
),
polymorphic_path
([
:leave
,
member
.
source
,
:members
]),
=
link_to
icon
(
'sign-out'
,
text:
'Leave'
),
polymorphic_path
([
:leave
,
member
.
source
,
:members
]),
method: :delete
,
method: :delete
,
data:
{
confirm:
leave_confirmation_message
(
member
.
source
)
},
data:
{
confirm:
leave_confirmation_message
(
member
.
source
)
},
class:
'btn btn-remove'
class:
'btn btn-remove
prepend-left-10
'
-
else
-
else
=
link_to
member
,
=
link_to
member
,
remote:
true
,
remote:
true
,
method: :delete
,
method: :delete
,
data:
{
confirm:
remove_member_message
(
member
)
},
data:
{
confirm:
remove_member_message
(
member
)
},
class:
'btn btn-remove'
,
class:
'btn btn-remove
prepend-left-10
'
,
title:
remove_member_title
(
member
)
do
title:
remove_member_title
(
member
)
do
%span
.visible-xs-block
%span
.visible-xs-block
Delete
Delete
...
...
app/views/shared/members/_requests.html.haml
View file @
e477ad44
-
if
requesters
.
any?
-
if
requesters
.
any?
.panel.panel-default
.panel.panel-default
.panel-heading
.panel-heading
Users requesting access to
%strong
=
membership_source
.
name
%strong
=
membership_source
.
name
access requests
%span
.badge
=
requesters
.
size
%span
.badge
=
requesters
.
size
%ul
.content-list
%ul
.content-list
=
render
partial:
'shared/members/member'
,
collection:
requesters
,
as: :member
=
render
partial:
'shared/members/member'
,
collection:
requesters
,
as: :member
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