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
Léo-Paul Géneau
gitlab-ce
Commits
3a2905f5
Commit
3a2905f5
authored
Nov 16, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sort group/project members alphabetically by default
parent
4b7a3d0c
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
3 deletions
+17
-3
app/controllers/groups/group_members_controller.rb
app/controllers/groups/group_members_controller.rb
+3
-1
app/views/shared/members/_sort_dropdown.html.haml
app/views/shared/members/_sort_dropdown.html.haml
+0
-2
spec/features/groups/members/sorting_spec.rb
spec/features/groups/members/sorting_spec.rb
+7
-0
spec/features/projects/members/sorting_spec.rb
spec/features/projects/members/sorting_spec.rb
+7
-0
No files found.
app/controllers/groups/group_members_controller.rb
View file @
3a2905f5
class
Groups::GroupMembersController
<
Groups
::
ApplicationController
include
MembershipActions
include
SortingHelper
# Authorize
before_action
:authorize_admin_group_member!
,
except:
[
:index
,
:leave
,
:request_access
]
def
index
@sort
=
params
[
:sort
].
presence
||
sort_value_name
@project
=
@group
.
projects
.
find
(
params
[
:project_id
])
if
params
[
:project_id
]
@members
=
@group
.
group_members
@members
=
@members
.
non_invite
unless
can?
(
current_user
,
:admin_group
,
@group
)
@members
=
@members
.
search
(
params
[
:search
])
if
params
[
:search
].
present?
@members
=
@members
.
sort
(
@sort
=
params
[
:sort
])
if
params
[
:sort
].
present?
@members
=
@members
.
sort
(
@sort
)
@members
=
@members
.
page
(
params
[
:page
]).
per
(
50
)
@requesters
=
AccessRequestsFinder
.
new
(
@group
).
execute
(
current_user
)
...
...
app/views/shared/members/_sort_dropdown.html.haml
View file @
3a2905f5
-
@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
...
...
spec/features/groups/members/sorting_spec.rb
View file @
3a2905f5
...
...
@@ -12,6 +12,13 @@ feature 'Groups > Members > Sorting', feature: true do
login_as
(
owner
)
end
scenario
'sorts alphabetically by default'
do
visit_members_list
(
sort:
nil
)
expect
(
first_member
).
to
include
(
owner
.
name
)
expect
(
second_member
).
to
include
(
developer
.
name
)
end
scenario
'sorts by access level ascending'
do
visit_members_list
(
sort: :access_level_asc
)
...
...
spec/features/projects/members/sorting_spec.rb
View file @
3a2905f5
...
...
@@ -12,6 +12,13 @@ feature 'Projects > Members > Sorting', feature: true do
login_as
(
master
)
end
scenario
'sorts alphabetically by default'
do
visit_members_list
(
sort:
nil
)
expect
(
first_member
).
to
include
(
master
.
name
)
expect
(
second_member
).
to
include
(
developer
.
name
)
end
scenario
'sorts by access level ascending'
do
visit_members_list
(
sort: :access_level_asc
)
...
...
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