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
09388b20
Commit
09388b20
authored
Oct 18, 2016
by
Nur Rony
Committed by
Douglas Barbosa Alexandre
Dec 16, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds sort dropdown for group members
parent
12a7e717
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
127 additions
and
26 deletions
+127
-26
app/assets/stylesheets/pages/members.scss
app/assets/stylesheets/pages/members.scss
+42
-12
app/controllers/groups/group_members_controller.rb
app/controllers/groups/group_members_controller.rb
+7
-3
app/controllers/projects/project_members_controller.rb
app/controllers/projects/project_members_controller.rb
+4
-1
app/helpers/members_helper.rb
app/helpers/members_helper.rb
+21
-9
app/helpers/sorting_helper.rb
app/helpers/sorting_helper.rb
+40
-1
app/views/groups/group_members/index.html.haml
app/views/groups/group_members/index.html.haml
+1
-0
app/views/projects/project_members/index.html.haml
app/views/projects/project_members/index.html.haml
+1
-0
app/views/shared/members/_sort_dropdown.html.haml
app/views/shared/members/_sort_dropdown.html.haml
+11
-0
No files found.
app/assets/stylesheets/pages/members.scss
View file @
09388b20
...
@@ -78,6 +78,20 @@
...
@@ -78,6 +78,20 @@
float
:
right
;
float
:
right
;
}
}
.dropdown
{
width
:
100%
;
margin-top
:
5px
;
.dropdown-menu-toggle
{
width
:
100%
;
}
@media
(
min-width
:
$screen-sm-min
)
{
top
:
2
.4px
;
width
:
155px
;
}
}
.form-control
{
.form-control
{
width
:
100%
;
width
:
100%
;
padding-right
:
35px
;
padding-right
:
35px
;
...
@@ -85,12 +99,21 @@
...
@@ -85,12 +99,21 @@
@media
(
min-width
:
$screen-sm-min
)
{
@media
(
min-width
:
$screen-sm-min
)
{
width
:
350px
;
width
:
350px
;
}
}
&
.input-short
{
@media
(
min-width
:
$screen-md-min
)
{
width
:
170px
;
}
@media
(
min-width
:
$screen-lg-min
)
{
width
:
210px
;
}
}
}
}
}
.member-search-btn
{
.member-search-btn
{
position
:
absolute
;
position
:
absolute
;
right
:
0
;
right
:
4px
;
top
:
0
;
top
:
0
;
height
:
35px
;
height
:
35px
;
padding-left
:
10px
;
padding-left
:
10px
;
...
@@ -99,4 +122,11 @@
...
@@ -99,4 +122,11 @@
background
:
transparent
;
background
:
transparent
;
border
:
0
;
border
:
0
;
outline
:
0
;
outline
:
0
;
@media
(
min-width
:
$screen-sm-min
)
{
right
:
160px
;
top
:
8px
;
}
}
}
}
app/controllers/groups/group_members_controller.rb
View file @
09388b20
...
@@ -10,11 +10,15 @@ class Groups::GroupMembersController < Groups::ApplicationController
...
@@ -10,11 +10,15 @@ class Groups::GroupMembersController < Groups::ApplicationController
@members
=
@members
.
non_invite
unless
can?
(
current_user
,
:admin_group
,
@group
)
@members
=
@members
.
non_invite
unless
can?
(
current_user
,
:admin_group
,
@group
)
if
params
[
:search
].
present?
if
params
[
:search
].
present?
users
=
@group
.
users
.
search
(
params
[
:search
]).
to_a
@members
=
@members
.
joins
(
:user
).
merge
(
User
.
search
(
params
[
:search
]))
@members
=
@members
.
where
(
user_id:
users
)
end
end
@members
=
@members
.
order
(
'access_level DESC'
).
page
(
params
[
:page
]).
per
(
50
)
if
params
[
:sort
].
present?
@members
=
@members
.
joins
(
:user
).
merge
(
User
.
sort
(
@sort
=
params
[
:sort
]))
end
@members
=
@members
.
page
(
params
[
:page
]).
per
(
50
)
@requesters
=
AccessRequestsFinder
.
new
(
@group
).
execute
(
current_user
)
@requesters
=
AccessRequestsFinder
.
new
(
@group
).
execute
(
current_user
)
@group_member
=
@group
.
group_members
.
new
@group_member
=
@group
.
group_members
.
new
...
...
app/controllers/projects/project_members_controller.rb
View file @
09388b20
class
Projects::ProjectMembersController
<
Projects
::
ApplicationController
class
Projects::ProjectMembersController
<
Projects
::
ApplicationController
include
MembershipActions
include
MembershipActions
include
SortingHelper
# Authorize
# Authorize
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
@sort
=
params
[
:sort
].
presence
||
sort_value_name
@group_links
=
@project
.
project_group_links
@group_links
=
@project
.
project_group_links
@project_members
=
@project
.
project_members
@project_members
=
@project
.
project_members
...
@@ -40,7 +42,8 @@ class Projects::ProjectMembersController < Projects::ApplicationController
...
@@ -40,7 +42,8 @@ class Projects::ProjectMembersController < Projects::ApplicationController
@project_members
=
Member
.
@project_members
=
Member
.
where
(
wheres
.
join
(
' OR '
)).
where
(
wheres
.
join
(
' OR '
)).
order
(
access_level: :desc
).
page
(
params
[
:page
])
sort
(
@sort
).
page
(
params
[
:page
])
@requesters
=
AccessRequestsFinder
.
new
(
@project
).
execute
(
current_user
)
@requesters
=
AccessRequestsFinder
.
new
(
@project
).
execute
(
current_user
)
...
...
app/helpers/members_helper.rb
View file @
09388b20
...
@@ -36,4 +36,16 @@ module MembersHelper
...
@@ -36,4 +36,16 @@ module MembersHelper
"Are you sure you want to leave the "
\
"Are you sure you want to leave the "
\
"
\"
#{
member_source
.
human_name
}
\"
#{
member_source
.
class
.
to_s
.
humanize
(
capitalize:
false
)
}
?"
"
\"
#{
member_source
.
human_name
}
\"
#{
member_source
.
class
.
to_s
.
humanize
(
capitalize:
false
)
}
?"
end
end
def
filter_group_project_member_path
(
options
=
{})
exist_opts
=
{
search:
params
[
:search
],
sort:
params
[
:sort
]
}
options
=
exist_opts
.
merge
(
options
)
path
=
request
.
path
path
<<
"?
#{
options
.
to_param
}
"
path
end
end
end
app/helpers/sorting_helper.rb
View file @
09388b20
...
@@ -25,7 +25,7 @@ module SortingHelper
...
@@ -25,7 +25,7 @@ module SortingHelper
sort_value_recently_updated
=>
sort_title_recently_updated
,
sort_value_recently_updated
=>
sort_title_recently_updated
,
sort_value_oldest_updated
=>
sort_title_oldest_updated
,
sort_value_oldest_updated
=>
sort_title_oldest_updated
,
sort_value_recently_created
=>
sort_title_recently_created
,
sort_value_recently_created
=>
sort_title_recently_created
,
sort_value_oldest_created
=>
sort_title_oldest_created
,
sort_value_oldest_created
=>
sort_title_oldest_created
}
}
if
current_controller?
(
'admin/projects'
)
if
current_controller?
(
'admin/projects'
)
...
@@ -35,6 +35,17 @@ module SortingHelper
...
@@ -35,6 +35,17 @@ module SortingHelper
options
options
end
end
def
member_sort_options_hash
{
sort_value_last_joined
=>
sort_title_last_joined
,
sort_value_oldest_joined
=>
sort_title_oldest_joined
,
sort_value_name
=>
sort_title_name_asc
,
sort_value_name_desc
=>
sort_title_name_desc
,
sort_value_recently_signin
=>
sort_title_recently_signin
,
sort_value_oldest_signin
=>
sort_title_oldest_signin
}
end
def
sort_title_priority
def
sort_title_priority
'Priority'
'Priority'
end
end
...
@@ -95,6 +106,34 @@ module SortingHelper
...
@@ -95,6 +106,34 @@ module SortingHelper
'Most popular'
'Most popular'
end
end
def
sort_title_last_joined
'Last joined'
end
def
sort_title_oldest_joined
'Oldest joined'
end
def
sort_title_name_asc
'Name, ascending'
end
def
sort_title_name_desc
'Name, descending'
end
def
sort_value_last_joined
'last_joined'
end
def
sort_value_oldest_joined
'oldest_joined'
end
def
sort_value_name_desc
'name_desc'
end
def
sort_value_priority
def
sort_value_priority
'priority'
'priority'
end
end
...
...
app/views/groups/group_members/index.html.haml
View file @
09388b20
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
=
search_field_tag
:search
,
params
[
:search
],
{
placeholder:
'Find existing members by name'
,
class:
'form-control'
,
spellcheck:
false
}
=
search_field_tag
:search
,
params
[
:search
],
{
placeholder:
'Find existing members by name'
,
class:
'form-control'
,
spellcheck:
false
}
%button
.member-search-btn
{
type:
"submit"
,
"aria-label"
=>
"Submit search"
}
%button
.member-search-btn
{
type:
"submit"
,
"aria-label"
=>
"Submit search"
}
=
icon
(
"search"
)
=
icon
(
"search"
)
=
render
'shared/members/sort_dropdown'
.panel.panel-default
.panel.panel-default
.panel-heading
.panel-heading
Users with access to
Users with access to
...
...
app/views/projects/project_members/index.html.haml
View file @
09388b20
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
=
search_field_tag
:search
,
params
[
:search
],
{
placeholder:
'Find existing members by name'
,
class:
'form-control'
,
spellcheck:
false
}
=
search_field_tag
:search
,
params
[
:search
],
{
placeholder:
'Find existing members by name'
,
class:
'form-control'
,
spellcheck:
false
}
%button
.member-search-btn
{
type:
"submit"
,
"aria-label"
=>
"Submit search"
}
%button
.member-search-btn
{
type:
"submit"
,
"aria-label"
=>
"Submit search"
}
=
icon
(
"search"
)
=
icon
(
"search"
)
=
render
'shared/members/sort_dropdown'
-
if
@group_links
.
any?
-
if
@group_links
.
any?
=
render
'groups'
,
group_links:
@group_links
=
render
'groups'
,
group_links:
@group_links
...
...
app/views/shared/members/_sort_dropdown.html.haml
0 → 100644
View file @
09388b20
-
@sort
||=
sort_value_last_joined
.dropdown.inline
=
dropdown_toggle
(
member_sort_options_hash
[
@sort
],
{
toggle:
'dropdown'
},
{
id:
'sort-members-dropdown'
})
%ul
.dropdown-menu.dropdown-menu-align-right.dropdown-menu-selectable
%li
.dropdown-header
Sort by
-
member_sort_options_hash
.
each
do
|
value
,
title
|
%li
=
link_to
filter_group_project_member_path
(
sort:
value
),
class:
(
"is-active"
if
@sort
==
value
)
do
=
title
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