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
Boxiang Sun
gitlab-ce
Commits
caf0e443
Commit
caf0e443
authored
Oct 11, 2018
by
Rene Hennig
Committed by
Douglas Barbosa Alexandre
Oct 11, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new sort option "most_stars" to "Group > Children" pages
parent
9da83baf
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
5 deletions
+36
-5
app/helpers/sorting_helper.rb
app/helpers/sorting_helper.rb
+10
-4
app/views/groups/show.html.haml
app/views/groups/show.html.haml
+1
-1
changelogs/unreleased/48684-sort-projects-by-stars-in-groups.yml
...ogs/unreleased/48684-sort-projects-by-stars-in-groups.yml
+4
-0
spec/features/groups/show_spec.rb
spec/features/groups/show_spec.rb
+21
-0
No files found.
app/helpers/sorting_helper.rb
View file @
caf0e443
...
...
@@ -48,15 +48,21 @@ module SortingHelper
def
groups_sort_options_hash
{
sort_value_name
=>
sort_title_name
,
sort_value_name_desc
=>
sort_title_name_desc
,
sort_value_name
=>
sort_title_name
,
sort_value_name_desc
=>
sort_title_name_desc
,
sort_value_recently_created
=>
sort_title_recently_created
,
sort_value_oldest_created
=>
sort_title_oldest_created
,
sort_value_oldest_created
=>
sort_title_oldest_created
,
sort_value_recently_updated
=>
sort_title_recently_updated
,
sort_value_oldest_updated
=>
sort_title_oldest_updated
sort_value_oldest_updated
=>
sort_title_oldest_updated
}
end
def
subgroups_sort_options_hash
groups_sort_options_hash
.
merge
(
sort_value_most_stars
=>
sort_title_most_stars
)
end
def
admin_groups_sort_options_hash
groups_sort_options_hash
.
merge
(
sort_value_largest_group
=>
sort_title_largest_group
...
...
app/views/groups/show.html.haml
View file @
caf0e443
...
...
@@ -53,7 +53,7 @@
=
_
(
"Archived projects"
)
.nav-controls
=
render
"shared/groups/dropdown"
=
render
"shared/groups/dropdown"
,
options_hash:
subgroups_sort_options_hash
.tab-content
#subgroups_and_projects
.tab-pane
...
...
changelogs/unreleased/48684-sort-projects-by-stars-in-groups.yml
0 → 100644
View file @
caf0e443
---
title
:
Add new sort option "most_stars" to "Group > Children" pages
merge_request
:
22121
author
:
Rene Hennig
spec/features/groups/show_spec.rb
View file @
caf0e443
...
...
@@ -101,4 +101,25 @@ describe 'Group show page' do
expect
(
page
).
to
have_emoji
(
'smile'
)
end
end
context
'where group has projects'
do
let
(
:user
)
{
create
(
:user
)
}
before
do
group
.
add_owner
(
user
)
sign_in
(
user
)
end
it
'allows users to sorts projects by most stars'
,
:js
do
project1
=
create
(
:project
,
namespace:
group
,
star_count:
2
)
project2
=
create
(
:project
,
namespace:
group
,
star_count:
3
)
project3
=
create
(
:project
,
namespace:
group
,
star_count:
0
)
visit
group_path
(
group
,
sort: :stars_desc
)
expect
(
find
(
'.group-row:nth-child(1) .namespace-title > a'
)).
to
have_content
(
project2
.
title
)
expect
(
find
(
'.group-row:nth-child(2) .namespace-title > a'
)).
to
have_content
(
project1
.
title
)
expect
(
find
(
'.group-row:nth-child(3) .namespace-title > a'
)).
to
have_content
(
project3
.
title
)
end
end
end
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