Commit dfb66469 authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab-ce master

parents 259a6d1a d3561721
...@@ -53,6 +53,9 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController ...@@ -53,6 +53,9 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
def load_projects(finder_params) def load_projects(finder_params)
@total_user_projects_count = ProjectsFinder.new(params: { non_public: true }, current_user: current_user).execute
@total_starred_projects_count = ProjectsFinder.new(params: { starred: true }, current_user: current_user).execute
projects = ProjectsFinder projects = ProjectsFinder
.new(params: finder_params, current_user: current_user) .new(params: finder_params, current_user: current_user)
.execute .execute
......
...@@ -55,6 +55,9 @@ class Explore::ProjectsController < Explore::ApplicationController ...@@ -55,6 +55,9 @@ class Explore::ProjectsController < Explore::ApplicationController
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
def load_projects def load_projects
@total_user_projects_count = ProjectsFinder.new(params: { non_public: true }, current_user: current_user).execute
@total_starred_projects_count = ProjectsFinder.new(params: { starred: true }, current_user: current_user).execute
projects = ProjectsFinder.new(current_user: current_user, params: params) projects = ProjectsFinder.new(current_user: current_user, params: params)
.execute .execute
.includes(:route, :creator, :group, namespace: [:route, :owner]) .includes(:route, :creator, :group, namespace: [:route, :owner])
......
...@@ -15,9 +15,11 @@ ...@@ -15,9 +15,11 @@
= nav_link(page: [dashboard_projects_path, root_path]) do = nav_link(page: [dashboard_projects_path, root_path]) do
= link_to dashboard_projects_path, class: 'shortcuts-activity', data: {placement: 'right'} do = link_to dashboard_projects_path, class: 'shortcuts-activity', data: {placement: 'right'} do
Your projects Your projects
%span.badge.badge-pill= limited_counter_with_delimiter(@total_user_projects_count)
= nav_link(page: starred_dashboard_projects_path) do = nav_link(page: starred_dashboard_projects_path) do
= link_to starred_dashboard_projects_path, data: {placement: 'right'} do = link_to starred_dashboard_projects_path, data: {placement: 'right'} do
Starred projects Starred projects
%span.badge.badge-pill= limited_counter_with_delimiter(@total_starred_projects_count)
= nav_link(page: [explore_root_path, trending_explore_projects_path, starred_explore_projects_path, explore_projects_path]) do = nav_link(page: [explore_root_path, trending_explore_projects_path, starred_explore_projects_path, explore_projects_path]) do
= link_to explore_root_path, data: {placement: 'right'} do = link_to explore_root_path, data: {placement: 'right'} do
Explore projects Explore projects
......
---
title: Add badge count to projects and groups
merge_request: 18425
author: George Tsiolis
type: changed
...@@ -93,6 +93,7 @@ describe 'Dashboard Projects' do ...@@ -93,6 +93,7 @@ describe 'Dashboard Projects' do
visit dashboard_projects_path visit dashboard_projects_path
expect(page).to have_content(project.name) expect(page).to have_content(project.name)
expect(find('.nav-links li:nth-child(1) .badge-pill')).to have_content(1)
end end
it 'shows personal projects on personal projects tab', :js do it 'shows personal projects on personal projects tab', :js do
...@@ -123,6 +124,8 @@ describe 'Dashboard Projects' do ...@@ -123,6 +124,8 @@ describe 'Dashboard Projects' do
expect(page).not_to have_content(project.name) expect(page).not_to have_content(project.name)
expect(page).to have_content(project2.name) expect(page).to have_content(project2.name)
expect(find('.nav-links li:nth-child(1) .badge-pill')).to have_content(1)
expect(find('.nav-links li:nth-child(2) .badge-pill')).to have_content(1)
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