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
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
20 deletions
+21
-20
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
+5
-4
_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 @@
const $target = $(e.target);
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
before_action
:authorize_admin_project_member!
,
except:
[
:index
,
:leave
,
:request_access
]
def
index
@groups
=
@project
.
project_group_links
.
all
@project_members
=
@project
.
team
.
members
.
all
@groups
=
@project
.
project_group_links
@project_members
=
@project
.
team
.
members
(
can?
(
current_user
,
:admin_project
,
@project
))
@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?
@project_members
=
@project_members
.
search
(
params
[
:search
])
...
...
@@ -20,7 +18,6 @@ class Projects::ProjectMembersController < Projects::ApplicationController
@requesters
=
@project
.
requesters
if
can?
(
current_user
,
:admin_project
,
@project
)
@project_member
=
@project
.
project_members
.
new
@project_group_links
=
@project
.
project_group_links
end
def
create
...
...
app/models/project_team.rb
View file @
e477ad44
...
...
@@ -52,8 +52,8 @@ class ProjectTeam
ProjectMember
.
truncate_team
(
project
)
end
def
members
@members
||=
fetch_members
def
members
(
non_invite
)
@members
||=
fetch_members
(
nil
,
non_invite
)
end
alias_method
:users
,
:members
...
...
@@ -197,7 +197,7 @@ class ProjectTeam
access
.
each
{
|
key
,
value
|
access
[
key
]
=
[
value
,
capped_access_level
].
min
}
end
def
fetch_members
(
level
=
nil
)
def
fetch_members
(
level
=
nil
,
non_invite
=
false
)
project_members
=
project
.
members
group_members
=
group
?
group
.
members
:
[]
invited_members
=
[]
...
...
@@ -236,7 +236,7 @@ class ProjectTeam
end
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
.
where
(
id:
user_ids
)
...
...
app/views/shared/members/_group.html.haml
View file @
e477ad44
...
...
@@ -13,14 +13,15 @@
Expires in
#{
distance_of_time_in_words_to_now
(
group_link
.
expires_at
)
}
.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
=
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
}
"
.prepend-left-5.
append-right-10.
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
}
"
=
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.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
}
"
,
disabled:
!
can?
(
current_user
,
action_member_permission
(
:admin
,
group
),
group
)
%i
.clear-icon.js-clear-input
-
if
can?
(
current_user
,
action_member_permission
(
:admin
,
group
),
group
)
=
link_to
namespace_project_group_link_path
(
@project
.
namespace
,
@project
,
group_link
),
remote:
true
,
method: :delete
,
class:
'btn btn-remove
'
do
class:
'btn btn-remove prepend-left-10
'
do
%span
.visible-xs-block
Delete
=
icon
(
'trash'
,
class:
'hidden-xs'
)
app/views/shared/members/_member.html.haml
View file @
e477ad44
...
...
@@ -47,7 +47,7 @@
-
if
user
!=
current_user
=
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
)
.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
)
%i
.clear-icon.js-clear-input
-
else
...
...
@@ -55,12 +55,12 @@
-
if
!
user
&&
can?
(
current_user
,
action_member_permission
(
:admin
,
member
),
member
.
source
)
=
link_to
'Resend invite'
,
polymorphic_path
([
:resend_invite
,
member
]),
method: :post
,
class:
'btn'
class:
'btn
btn-default prepend-left-10
'
-
if
member
.
request?
&&
can?
(
current_user
,
action_member_permission
(
:update
,
member
),
member
)
=
link_to
icon
(
'check inverse'
),
polymorphic_path
([
:approve_access_request
,
member
]),
method: :post
,
class:
'btn btn-success'
,
class:
'btn btn-success
prepend-left-10
'
,
title:
'Grant access'
-
if
can?
(
current_user
,
action_member_permission
(
:destroy
,
member
),
member
)
...
...
@@ -68,13 +68,13 @@
=
link_to
icon
(
'sign-out'
,
text:
'Leave'
),
polymorphic_path
([
:leave
,
member
.
source
,
:members
]),
method: :delete
,
data:
{
confirm:
leave_confirmation_message
(
member
.
source
)
},
class:
'btn btn-remove'
class:
'btn btn-remove
prepend-left-10
'
-
else
=
link_to
member
,
remote:
true
,
method: :delete
,
data:
{
confirm:
remove_member_message
(
member
)
},
class:
'btn btn-remove'
,
class:
'btn btn-remove
prepend-left-10
'
,
title:
remove_member_title
(
member
)
do
%span
.visible-xs-block
Delete
...
...
app/views/shared/members/_requests.html.haml
View file @
e477ad44
-
if
requesters
.
any?
.panel.panel-default
.panel-heading
Users requesting access to
%strong
=
membership_source
.
name
access requests
%span
.badge
=
requesters
.
size
%ul
.content-list
=
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