Commit 681df101 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'feature/48684-default-sort-to-by-stars' into 'master'

Add new sort option "most_stars" to "Group > Children" pages

See merge request gitlab-org/gitlab-ce!22121
parents 9da83baf caf0e443
...@@ -57,6 +57,12 @@ module SortingHelper ...@@ -57,6 +57,12 @@ module SortingHelper
} }
end 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 def admin_groups_sort_options_hash
groups_sort_options_hash.merge( groups_sort_options_hash.merge(
sort_value_largest_group => sort_title_largest_group sort_value_largest_group => sort_title_largest_group
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
= _("Archived projects") = _("Archived projects")
.nav-controls .nav-controls
= render "shared/groups/dropdown" = render "shared/groups/dropdown", options_hash: subgroups_sort_options_hash
.tab-content .tab-content
#subgroups_and_projects.tab-pane #subgroups_and_projects.tab-pane
......
---
title: Add new sort option "most_stars" to "Group > Children" pages
merge_request: 22121
author: Rene Hennig
...@@ -101,4 +101,25 @@ describe 'Group show page' do ...@@ -101,4 +101,25 @@ describe 'Group show page' do
expect(page).to have_emoji('smile') expect(page).to have_emoji('smile')
end end
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 end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment