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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
6e051e66
Commit
6e051e66
authored
Dec 20, 2018
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
5abf83d7
8b32eb64
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
132 additions
and
16 deletions
+132
-16
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+14
-14
app/views/shared/projects/_project.html.haml
app/views/shared/projects/_project.html.haml
+2
-2
spec/features/users/overview_spec.rb
spec/features/users/overview_spec.rb
+6
-0
spec/helpers/projects_helper_spec.rb
spec/helpers/projects_helper_spec.rb
+110
-0
No files found.
app/helpers/projects_helper.rb
View file @
6e051e66
...
...
@@ -273,6 +273,20 @@ module ProjectsHelper
params
[
:legacy_render
]
?
{
markdown_engine: :redcarpet
}
:
{}
end
def
explore_projects_tab?
current_page?
(
explore_projects_path
)
||
current_page?
(
trending_explore_projects_path
)
||
current_page?
(
starred_explore_projects_path
)
end
def
show_merge_request_count?
(
disabled:
false
,
compact_mode:
false
)
!
disabled
&&
!
compact_mode
&&
Feature
.
enabled?
(
:project_list_show_mr_count
,
default_enabled:
true
)
end
def
show_issue_count?
(
disabled:
false
,
compact_mode:
false
)
!
disabled
&&
!
compact_mode
&&
Feature
.
enabled?
(
:project_list_show_issue_count
,
default_enabled:
true
)
end
private
def
get_project_nav_tabs
(
project
,
current_user
)
...
...
@@ -517,20 +531,6 @@ module ProjectsHelper
end
end
def
explore_projects_tab?
current_page?
(
explore_projects_path
)
||
current_page?
(
trending_explore_projects_path
)
||
current_page?
(
starred_explore_projects_path
)
end
def
show_merge_request_count?
(
merge_requests
,
compact_mode
)
merge_requests
&&
!
compact_mode
&&
Feature
.
enabled?
(
:project_list_show_mr_count
,
default_enabled:
true
)
end
def
show_issue_count?
(
issues
,
compact_mode
)
issues
&&
!
compact_mode
&&
Feature
.
enabled?
(
:project_list_show_issue_count
,
default_enabled:
true
)
end
def
sidebar_projects_paths
%w[
projects#show
...
...
app/views/shared/projects/_project.html.haml
View file @
6e051e66
...
...
@@ -72,13 +72,13 @@
title:
_
(
'Forks'
),
data:
{
container:
'body'
,
placement:
'top'
}
do
=
sprite_icon
(
'fork'
,
size:
14
,
css_class:
'append-right-4'
)
=
number_with_delimiter
(
project
.
forks_count
)
-
if
show_merge_request_count?
(
merge_requests
,
compact_mode
)
-
if
show_merge_request_count?
(
disabled:
!
merge_requests
,
compact_mode:
compact_mode
)
=
link_to
project_merge_requests_path
(
project
),
class:
"d-none d-lg-flex align-items-center icon-wrapper merge-requests has-tooltip"
,
title:
_
(
'Merge Requests'
),
data:
{
container:
'body'
,
placement:
'top'
}
do
=
sprite_icon
(
'git-merge'
,
size:
14
,
css_class:
'append-right-4'
)
=
number_with_delimiter
(
project
.
open_merge_requests_count
)
-
if
show_issue_count?
(
issues
,
compact_mode
)
-
if
show_issue_count?
(
disabled:
!
issues
,
compact_mode:
compact_mode
)
=
link_to
project_issues_path
(
project
),
class:
"d-none d-lg-flex align-items-center icon-wrapper issues has-tooltip"
,
title:
_
(
'Issues'
),
data:
{
container:
'body'
,
placement:
'top'
}
do
...
...
spec/features/users/overview_spec.rb
View file @
6e051e66
...
...
@@ -119,6 +119,12 @@ describe 'Overview tab on a user profile', :js do
it
'shows a link to the project list'
do
expect
(
find
(
'#js-overview .projects-block'
)).
to
have_selector
(
'.js-view-all'
,
visible:
true
)
end
it
'shows projects in "compact mode"'
do
page
.
within
(
'#js-overview .projects-block'
)
do
expect
(
find
(
'.js-projects-list-holder'
)).
to
have_selector
(
'.compact'
)
end
end
end
describe
'user has more than ten personal projects'
do
...
...
spec/helpers/projects_helper_spec.rb
View file @
6e051e66
...
...
@@ -528,4 +528,114 @@ describe ProjectsHelper do
expect
(
helper
.
legacy_render_context
({})).
to
be_empty
end
end
describe
'#explore_projects_tab?'
do
subject
{
helper
.
explore_projects_tab?
}
it
'returns true when on the "All" tab under "Explore projects"'
do
allow
(
@request
).
to
receive
(
:path
)
{
explore_projects_path
}
expect
(
subject
).
to
be_truthy
end
it
'returns true when on the "Trending" tab under "Explore projects"'
do
allow
(
@request
).
to
receive
(
:path
)
{
trending_explore_projects_path
}
expect
(
subject
).
to
be_truthy
end
it
'returns true when on the "Starred" tab under "Explore projects"'
do
allow
(
@request
).
to
receive
(
:path
)
{
starred_explore_projects_path
}
expect
(
subject
).
to
be_truthy
end
it
'returns false when on the "Your projects" tab'
do
allow
(
@request
).
to
receive
(
:path
)
{
dashboard_projects_path
}
expect
(
subject
).
to
be_falsey
end
end
describe
'#show_merge_request_count'
do
context
'when the feature flag is enabled'
do
before
do
stub_feature_flags
(
project_list_show_mr_count:
true
)
end
it
'returns true if compact mode is disabled'
do
expect
(
helper
.
show_merge_request_count?
).
to
be_truthy
end
it
'returns false if compact mode is enabled'
do
expect
(
helper
.
show_merge_request_count?
(
compact_mode:
true
)).
to
be_falsey
end
end
context
'when the feature flag is disabled'
do
before
do
stub_feature_flags
(
project_list_show_mr_count:
false
)
end
it
'always returns false'
do
expect
(
helper
.
show_merge_request_count?
(
disabled:
false
)).
to
be_falsy
expect
(
helper
.
show_merge_request_count?
(
disabled:
true
)).
to
be_falsy
end
end
context
'disabled flag'
do
before
do
stub_feature_flags
(
project_list_show_mr_count:
true
)
end
it
'returns false if disabled flag is true'
do
expect
(
helper
.
show_merge_request_count?
(
disabled:
true
)).
to
be_falsey
end
it
'returns true if disabled flag is false'
do
expect
(
helper
.
show_merge_request_count?
).
to
be_truthy
end
end
end
describe
'#show_issue_count?'
do
context
'when the feature flag is enabled'
do
before
do
stub_feature_flags
(
project_list_show_issue_count:
true
)
end
it
'returns true if compact mode is disabled'
do
expect
(
helper
.
show_issue_count?
).
to
be_truthy
end
it
'returns false if compact mode is enabled'
do
expect
(
helper
.
show_issue_count?
(
compact_mode:
true
)).
to
be_falsey
end
end
context
'when the feature flag is disabled'
do
before
do
stub_feature_flags
(
project_list_show_issue_count:
false
)
end
it
'always returns false'
do
expect
(
helper
.
show_issue_count?
(
disabled:
false
)).
to
be_falsy
expect
(
helper
.
show_issue_count?
(
disabled:
true
)).
to
be_falsy
end
end
context
'disabled flag'
do
before
do
stub_feature_flags
(
project_list_show_issue_count:
true
)
end
it
'returns false if disabled flag is true'
do
expect
(
helper
.
show_issue_count?
(
disabled:
true
)).
to
be_falsey
end
it
'returns true if disabled flag is false'
do
expect
(
helper
.
show_issue_count?
).
to
be_truthy
end
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