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
2cc84b5c
Commit
2cc84b5c
authored
Aug 21, 2019
by
Heinrich Lee Yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix epics count in sidebar
Only count open epics
parent
eebca4db
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
8 deletions
+38
-8
ee/app/helpers/ee/groups_helper.rb
ee/app/helpers/ee/groups_helper.rb
+7
-0
ee/app/views/layouts/nav/ee/_epic_link.html.haml
ee/app/views/layouts/nav/ee/_epic_link.html.haml
+4
-4
ee/changelogs/unreleased/8465-fix-epics-count.yml
ee/changelogs/unreleased/8465-fix-epics-count.yml
+5
-0
ee/spec/helpers/ee/groups_helper_spec.rb
ee/spec/helpers/ee/groups_helper_spec.rb
+22
-4
No files found.
ee/app/helpers/ee/groups_helper.rb
View file @
2cc84b5c
...
...
@@ -4,6 +4,13 @@ module EE
module
GroupsHelper
extend
::
Gitlab
::
Utils
::
Override
def
group_epics_count
(
state
:)
EpicsFinder
.
new
(
current_user
,
group_id:
@group
.
id
,
state:
state
)
.
execute
.
count
end
override
:group_overview_nav_link_paths
def
group_overview_nav_link_paths
super
+
%w[
...
...
ee/app/views/layouts/nav/ee/_epic_link.html.haml
View file @
2cc84b5c
-
return
unless
group_sidebar_link?
(
:epics
)
-
epics
=
EpicsFinder
.
new
(
current_user
,
group_id:
@group
.
id
).
execute
-
epics
_count
=
group_epics_count
(
state:
'opened'
)
-
epics_items
=
[
'epics#show'
,
'epics#index'
,
'roadmap#show'
]
=
nav_link
(
path:
epics_items
)
do
...
...
@@ -8,13 +8,13 @@
.nav-icon-container
=
sprite_icon
(
'epic'
)
%span
.nav-item-name
Epics
%span
.badge.badge-pill.count
=
number_with_delimiter
(
epics
.
count
)
=
_
(
'Epics'
)
%span
.badge.badge-pill.count
=
number_with_delimiter
(
epics
_
count
)
%ul
.sidebar-sub-level-items
=
nav_link
(
path:
epics_items
,
html_options:
{
class:
"fly-out-top-item"
}
)
do
=
link_to
group_epics_path
(
group
)
do
%strong
.fly-out-top-item-name
=
_
(
'Epics'
)
%span
.badge.badge-pill.count.epic_counter.fly-out-badge
=
number_with_delimiter
(
epics
.
count
)
%span
.badge.badge-pill.count.epic_counter.fly-out-badge
=
number_with_delimiter
(
epics
_
count
)
%li
.divider.fly-out-top-item
=
nav_link
(
path:
'epics#index'
,
html_options:
{
class:
'home'
})
do
=
link_to
group_epics_path
(
group
),
title:
'List'
do
...
...
ee/changelogs/unreleased/8465-fix-epics-count.yml
0 → 100644
View file @
2cc84b5c
---
title
:
Change epics count in sidebar to only count open epics
merge_request
:
15459
author
:
type
:
fixed
ee/spec/helpers/ee/groups_helper_spec.rb
View file @
2cc84b5c
require
'spec_helper'
describe
GroupsHelper
do
let
(
:user
)
{
create
(
:user
,
group_view: :security_dashboard
)
}
let
(
:group
)
{
create
(
:group
,
:private
)
}
before
do
allow
(
helper
).
to
receive
(
:current_user
)
{
user
}
helper
.
instance_variable_set
(
:@group
,
group
)
group
.
add_owner
(
user
)
end
let
(
:user
)
{
create
(
:user
,
group_view: :security_dashboard
)
}
let
(
:group
)
{
create
(
:group
,
:private
)
}
describe
'#group_epics_count'
do
before
do
stub_licensed_features
(
epics:
true
)
create_list
(
:epic
,
3
,
:opened
,
group:
group
)
create_list
(
:epic
,
2
,
:closed
,
group:
group
)
end
it
'returns open epics count'
do
expect
(
helper
.
group_epics_count
(
state:
'opened'
)).
to
eq
(
3
)
end
it
'returns closed epics count'
do
expect
(
helper
.
group_epics_count
(
state:
'closed'
)).
to
eq
(
2
)
end
end
describe
'#group_sidebar_links'
do
before
do
group
.
add_owner
(
user
)
helper
.
instance_variable_set
(
:@group
,
group
)
allow
(
helper
).
to
receive
(
:can?
)
{
|*
args
|
Ability
.
allowed?
(
*
args
)
}
allow
(
helper
).
to
receive
(
:show_promotions?
)
{
false
}
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