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
Jérome Perrin
gitlab-ce
Commits
ad58dec2
Commit
ad58dec2
authored
Dec 23, 2016
by
Jose Ivan Vargas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added groups to members section, added a members finder
parent
def6c43d
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
35 additions
and
20 deletions
+35
-20
app/assets/javascripts/dispatcher.js.es6
app/assets/javascripts/dispatcher.js.es6
+2
-5
app/assets/javascripts/member_expiration_date.js
app/assets/javascripts/member_expiration_date.js
+7
-3
app/controllers/projects/group_links_controller.rb
app/controllers/projects/group_links_controller.rb
+2
-5
app/controllers/projects/settings/members_controller.rb
app/controllers/projects/settings/members_controller.rb
+8
-5
app/finders/members_finder.rb
app/finders/members_finder.rb
+13
-0
app/views/projects/group_links/_index.html.haml
app/views/projects/group_links/_index.html.haml
+1
-1
app/views/projects/settings/members/show.html.haml
app/views/projects/settings/members/show.html.haml
+2
-1
No files found.
app/assets/javascripts/dispatcher.js.es6
View file @
ad58dec2
...
@@ -215,8 +215,9 @@
...
@@ -215,8 +215,9 @@
new gl.Members();
new gl.Members();
new UsersSelect();
new UsersSelect();
break;
break;
case 'projects:project_members:index':
case 'projects:members:show':
case 'projects:members:show':
new gl.MemberExpirationDate('.js-access-expiration-date-groups');
new GroupsSelect();
new gl.MemberExpirationDate();
new gl.MemberExpirationDate();
new gl.Members();
new gl.Members();
new UsersSelect();
new UsersSelect();
...
@@ -262,10 +263,6 @@
...
@@ -262,10 +263,6 @@
case 'projects:artifacts:browse':
case 'projects:artifacts:browse':
new BuildArtifacts();
new BuildArtifacts();
break;
break;
case 'projects:group_links:index':
new gl.MemberExpirationDate();
new GroupsSelect();
break;
case 'search:show':
case 'search:show':
new Search();
new Search();
break;
break;
...
...
app/assets/javascripts/member_expiration_date.js
View file @
ad58dec2
...
@@ -5,12 +5,16 @@
...
@@ -5,12 +5,16 @@
// `js-clear-input` element, then show that element when there is a value in the
// `js-clear-input` element, then show that element when there is a value in the
// datepicker, and make clicking on that element clear the field.
// datepicker, and make clicking on that element clear the field.
//
//
gl
.
MemberExpirationDate
=
function
()
{
gl
.
MemberExpirationDate
=
function
(
newSelector
)
{
function
toggleClearInput
()
{
function
toggleClearInput
()
{
$
(
this
).
closest
(
'
.clearable-input
'
).
toggleClass
(
'
has-value
'
,
$
(
this
).
val
()
!==
''
);
$
(
this
).
closest
(
'
.clearable-input
'
).
toggleClass
(
'
has-value
'
,
$
(
this
).
val
()
!==
''
);
}
}
var
inputs
=
$
(
'
.js-access-expiration-date
'
);
var
selector
=
'
.js-access-expiration-date
'
;
if
(
typeof
newSelector
!==
'
undefined
'
&&
newSelector
!==
''
)
{
selector
=
newSelector
;
}
var
inputs
=
$
(
selector
);
inputs
.
datepicker
({
inputs
.
datepicker
({
dateFormat
:
'
yy-mm-dd
'
,
dateFormat
:
'
yy-mm-dd
'
,
...
@@ -24,7 +28,7 @@
...
@@ -24,7 +28,7 @@
inputs
.
next
(
'
.js-clear-input
'
).
on
(
'
click
'
,
function
(
event
)
{
inputs
.
next
(
'
.js-clear-input
'
).
on
(
'
click
'
,
function
(
event
)
{
event
.
preventDefault
();
event
.
preventDefault
();
var
input
=
$
(
this
).
closest
(
'
.clearable-input
'
).
find
(
'
.js-access-expiration-date
'
);
var
input
=
$
(
this
).
closest
(
'
.clearable-input
'
).
find
(
selector
);
input
.
datepicker
(
'
setDate
'
,
null
)
input
.
datepicker
(
'
setDate
'
,
null
)
.
trigger
(
'
change
'
);
.
trigger
(
'
change
'
);
toggleClearInput
.
call
(
input
);
toggleClearInput
.
call
(
input
);
...
...
app/controllers/projects/group_links_controller.rb
View file @
ad58dec2
...
@@ -4,10 +4,7 @@ class Projects::GroupLinksController < Projects::ApplicationController
...
@@ -4,10 +4,7 @@ class Projects::GroupLinksController < Projects::ApplicationController
before_action
:authorize_admin_project_member!
,
only:
[
:update
]
before_action
:authorize_admin_project_member!
,
only:
[
:update
]
def
index
def
index
@group_links
=
project
.
project_group_links
.
all
redirect_to
namespace_project_settings_members_path
@skip_groups
=
@group_links
.
pluck
(
:group_id
)
@skip_groups
<<
project
.
namespace_id
unless
project
.
personal?
end
end
def
create
def
create
...
@@ -19,7 +16,7 @@ class Projects::GroupLinksController < Projects::ApplicationController
...
@@ -19,7 +16,7 @@ class Projects::GroupLinksController < Projects::ApplicationController
project
.
project_group_links
.
create
(
project
.
project_group_links
.
create
(
group:
group
,
group:
group
,
group_access:
params
[
:link_group_access
],
group_access:
params
[
:link_group_access
],
expires_at:
params
[
:expires_at
]
expires_at:
params
[
:expires_at
]
||
params
[
:expires_at_groups
]
)
)
else
else
flash
[
:alert
]
=
'Please select a group.'
flash
[
:alert
]
=
'Please select a group.'
...
...
app/controllers/projects/settings/members_controller.rb
View file @
ad58dec2
...
@@ -2,7 +2,7 @@ module Projects
...
@@ -2,7 +2,7 @@ module Projects
module
Settings
module
Settings
class
MembersController
<
Projects
::
ApplicationController
class
MembersController
<
Projects
::
ApplicationController
include
SortingHelper
include
SortingHelper
def
show
def
show
@sort
=
params
[
:sort
].
presence
||
sort_value_name
@sort
=
params
[
:sort
].
presence
||
sort_value_name
@group_links
=
@project
.
project_group_links
@group_links
=
@project
.
project_group_links
...
@@ -12,15 +12,18 @@ module Projects
...
@@ -12,15 +12,18 @@ module Projects
group
=
@project
.
group
group
=
@project
.
group
# group links
@group_links
=
@project
.
project_group_links
.
all
@skip_groups
=
@group_links
.
pluck
(
:group_id
)
@skip_groups
<<
@project
.
namespace_id
unless
project
.
personal?
if
group
if
group
# We need `.where.not(user_id: nil)` here otherwise when a group has an
# We need `.where.not(user_id: nil)` here otherwise when a group has an
# invitee, it would make the following query return 0 rows since a NULL
# invitee, it would make the following query return 0 rows since a NULL
# user_id would be present in the subquery
# user_id would be present in the subquery
# See http://stackoverflow.com/questions/129077/not-in-clause-and-null-values
# See http://stackoverflow.com/questions/129077/not-in-clause-and-null-values
# FIXME: This whole logic should be moved to a finder!
group_members
=
MembersFinder
.
new
(
@project
,
@group
)
non_null_user_ids
=
@project_members
.
where
.
not
(
user_id:
nil
).
select
(
:user_id
)
group_members
=
group
.
group_members
.
where
.
not
(
user_id:
non_null_user_ids
)
group_members
=
group_members
.
non_invite
unless
can?
(
current_user
,
:admin_group
,
@group
)
end
end
if
params
[
:search
].
present?
if
params
[
:search
].
present?
...
...
app/finders/members_finder.rb
0 → 100644
View file @
ad58dec2
class
MembersFinder
<
Projects
::
ApplicationController
def
initialize
(
project_members
,
group
)
@project_members
=
project_members
@group
=
group
end
def
execute
non_null_user_ids
=
@project_members
.
where
.
not
(
user_id:
nil
).
select
(
:user_id
)
group_members
=
@group
.
group_members
.
where
.
not
(
user_id:
non_null_user_ids
)
group_members
=
group_members
.
non_invite
unless
can?
(
current_user
,
:admin_group
,
@group
)
group_members
end
end
app/views/projects/group_links/index.html.haml
→
app/views/projects/group_links/
_
index.html.haml
View file @
ad58dec2
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
.form-group
.form-group
=
label_tag
:expires_at
,
'Access expiration date'
,
class:
'label-light'
=
label_tag
:expires_at
,
'Access expiration date'
,
class:
'label-light'
.clearable-input
.clearable-input
=
text_field_tag
:expires_at
,
nil
,
class:
'form-control js-access-expiration-date
'
,
placeholder:
'Select access expiration date'
=
text_field_tag
:expires_at
_groups
,
nil
,
class:
'form-control js-access-expiration-date-groups
'
,
placeholder:
'Select access expiration date'
%i
.clear-icon.js-clear-input
%i
.clear-icon.js-clear-input
.help-block
.help-block
On this date, all users in the group will automatically lose access to this project.
On this date, all users in the group will automatically lose access to this project.
...
...
app/views/projects/settings/members/show.html.haml
View file @
ad58dec2
-
page_title
"Members"
-
page_title
"Members"
=
render
"projects/project_members/index"
=
render
"projects/project_members/index"
=
render
"projects/group_links/index"
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