Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
6ed59e12
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
6ed59e12
编写于
4月 06, 2017
作者:
D
Dmitriy Zaporozhets
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Hide header counters for issue/mr/todos if zero
Signed-off-by:
N
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
上级
30c88499
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
36 addition
and
15 deletion
+36
-15
app/views/layouts/header/_default.html.haml
app/views/layouts/header/_default.html.haml
+7
-5
changelogs/unreleased/dz-hide-zero-counter.yml
changelogs/unreleased/dz-hide-zero-counter.yml
+4
-0
spec/features/dashboard/issuables_counter_spec.rb
spec/features/dashboard/issuables_counter_spec.rb
+25
-10
未找到文件。
app/views/layouts/header/_default.html.haml
浏览文件 @
6ed59e12
...
...
@@ -47,17 +47,19 @@
%li
=
link_to
assigned_issues_dashboard_path
,
title:
'Issues'
,
aria:
{
label:
"Issues"
},
data:
{
toggle:
'tooltip'
,
placement:
'bottom'
,
container:
'body'
}
do
=
icon
(
'hashtag fw'
)
%span
.badge.issues-count
=
number_with_delimiter
(
cached_assigned_issuables_count
(
current_user
,
:issues
,
:opened
))
-
issues_count
=
cached_assigned_issuables_count
(
current_user
,
:issues
,
:opened
)
%span
.badge.issues-count
{
class:
(
'hidden'
if
issues_count
.
zero?
)
}
=
number_with_delimiter
(
issues_count
)
%li
=
link_to
assigned_mrs_dashboard_path
,
title:
'Merge requests'
,
aria:
{
label:
"Merge requests"
},
data:
{
toggle:
'tooltip'
,
placement:
'bottom'
,
container:
'body'
}
do
=
custom_icon
(
'mr_bold'
)
%span
.badge.merge-requests-count
=
number_with_delimiter
(
cached_assigned_issuables_count
(
current_user
,
:merge_requests
,
:opened
))
-
merge_requests_count
=
cached_assigned_issuables_count
(
current_user
,
:merge_requests
,
:opened
)
%span
.badge.merge-requests-count
{
class:
(
'hidden'
if
merge_requests_count
.
zero?
)
}
=
number_with_delimiter
(
merge_requests_count
)
%li
=
link_to
dashboard_todos_path
,
title:
'Todos'
,
aria:
{
label:
"Todos"
},
class:
'shortcuts-todos'
,
data:
{
toggle:
'tooltip'
,
placement:
'bottom'
,
container:
'body'
}
do
=
icon
(
'check-circle fw'
)
%span
.badge.todos-count
%span
.badge.todos-count
{
class:
(
'hidden'
if
todos_pending_count
.
zero?
)
}
=
todos_count_format
(
todos_pending_count
)
%li
.header-user.dropdown
=
link_to
current_user
,
class:
"header-user-dropdown-toggle"
,
data:
{
toggle:
"dropdown"
}
do
...
...
changelogs/unreleased/dz-hide-zero-counter.yml
0 → 100644
浏览文件 @
6ed59e12
---
title
:
Hide header counters for issue/mr/todos if zero
merge_request
:
10506
author
:
spec/features/dashboard/issuables_counter_spec.rb
浏览文件 @
6ed59e12
require
'spec_helper'
describe
'Navigation bar counter'
,
feature:
true
,
js:
true
,
caching:
true
do
describe
'Navigation bar counter'
,
feature:
true
,
caching:
true
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:empty_project
,
namespace:
user
.
namespace
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
...
...
@@ -13,33 +13,48 @@ describe 'Navigation bar counter', feature: true, js: true, caching: true do
end
it
'reflects dashboard issues count'
do
visit
issues_
dashboard_
path
visit
issues_path
expect_counters
(
'issues'
,
'1'
)
issue
.
update
(
assignee:
nil
)
visit
issues_dashboard_path
expect_counters
(
'issues'
,
'1'
)
Timecop
.
travel
(
3
.
minutes
.
from_now
)
do
visit
issues_path
expect_counters
(
'issues'
,
'0'
)
end
end
it
'reflects dashboard merge requests count'
do
visit
merge_requests_
dashboard_
path
visit
merge_requests_path
expect_counters
(
'merge_requests'
,
'1'
)
merge_request
.
update
(
assignee:
nil
)
visit
merge_requests_dashboard_path
expect_counters
(
'merge_requests'
,
'1'
)
Timecop
.
travel
(
3
.
minutes
.
from_now
)
do
visit
merge_requests_path
expect_counters
(
'merge_requests'
,
'0'
)
end
end
def
issues_path
issues_dashboard_path
(
assignee_id:
user
.
id
)
end
def
merge_requests_path
merge_requests_dashboard_path
(
assignee_id:
user
.
id
)
end
def
expect_counters
(
issuable_type
,
count
)
dashboard_count
=
find
(
'li.active'
)
find
(
'.global-dropdown-toggle'
).
click
dashboard_count
=
find
(
'.nav-links li.active'
)
nav_count
=
find
(
".dashboard-shortcuts-
#{
issuable_type
}
"
)
header_count
=
find
(
".header-content .
#{
issuable_type
.
tr
(
'_'
,
'-'
)
}
-count"
)
expect
(
nav_count
).
to
have_content
(
count
)
expect
(
dashboard_count
).
to
have_content
(
count
)
expect
(
nav_count
).
to
have_content
(
count
)
expect
(
header_count
).
to
have_content
(
count
)
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录