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
Tatuya Kamada
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
Show 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 @@
new gl.Members();
new UsersSelect();
break;
case 'projects:project_members:index':
case 'projects:members:show':
new gl.MemberExpirationDate('.js-access-expiration-date-groups');
new GroupsSelect();
new gl.MemberExpirationDate();
new gl.Members();
new UsersSelect();
...
...
@@ -262,10 +263,6 @@
case 'projects:artifacts:browse':
new BuildArtifacts();
break;
case 'projects:group_links:index':
new gl.MemberExpirationDate();
new GroupsSelect();
break;
case 'search:show':
new Search();
break;
...
...
app/assets/javascripts/member_expiration_date.js
View file @
ad58dec2
...
...
@@ -5,12 +5,16 @@
// `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.
//
gl
.
MemberExpirationDate
=
function
()
{
gl
.
MemberExpirationDate
=
function
(
newSelector
)
{
function
toggleClearInput
()
{
$
(
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
({
dateFormat
:
'
yy-mm-dd
'
,
...
...
@@ -24,7 +28,7 @@
inputs
.
next
(
'
.js-clear-input
'
).
on
(
'
click
'
,
function
(
event
)
{
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
)
.
trigger
(
'
change
'
);
toggleClearInput
.
call
(
input
);
...
...
app/controllers/projects/group_links_controller.rb
View file @
ad58dec2
...
...
@@ -4,10 +4,7 @@ class Projects::GroupLinksController < Projects::ApplicationController
before_action
:authorize_admin_project_member!
,
only:
[
:update
]
def
index
@group_links
=
project
.
project_group_links
.
all
@skip_groups
=
@group_links
.
pluck
(
:group_id
)
@skip_groups
<<
project
.
namespace_id
unless
project
.
personal?
redirect_to
namespace_project_settings_members_path
end
def
create
...
...
@@ -19,7 +16,7 @@ class Projects::GroupLinksController < Projects::ApplicationController
project
.
project_group_links
.
create
(
group:
group
,
group_access:
params
[
:link_group_access
],
expires_at:
params
[
:expires_at
]
expires_at:
params
[
:expires_at
]
||
params
[
:expires_at_groups
]
)
else
flash
[
:alert
]
=
'Please select a group.'
...
...
app/controllers/projects/settings/members_controller.rb
View file @
ad58dec2
...
...
@@ -12,15 +12,18 @@ module Projects
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
# 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
# user_id would be present in the subquery
# See http://stackoverflow.com/questions/129077/not-in-clause-and-null-values
# FIXME: This whole logic should be moved to a finder!
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
=
MembersFinder
.
new
(
@project
,
@group
)
end
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 @@
.form-group
=
label_tag
:expires_at
,
'Access expiration date'
,
class:
'label-light'
.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
.help-block
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"
=
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