Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
d4e070cf
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,发现更多精彩内容 >>
提交
d4e070cf
编写于
10月 29, 2012
作者:
R
randx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Improve styles. Add merge request completness to milestone percentage
上级
ecdf778e
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
37 addition
and
23 deletion
+37
-23
app/assets/stylesheets/common.scss
app/assets/stylesheets/common.scss
+5
-0
app/contexts/merge_requests_load_context.rb
app/contexts/merge_requests_load_context.rb
+10
-8
app/models/milestone.rb
app/models/milestone.rb
+9
-1
app/views/milestones/_milestone.html.haml
app/views/milestones/_milestone.html.haml
+13
-14
未找到文件。
app/assets/stylesheets/common.scss
浏览文件 @
d4e070cf
...
...
@@ -670,3 +670,8 @@ pre {
padding
:
0
;
}
}
.milestone
.progress
{
margin-bottom
:
0
;
margin-top
:
4px
;
}
app/contexts/merge_requests_load_context.rb
浏览文件 @
d4e070cf
# Build collection of Merge Requests
# based on filtering passed via params for @project
class
MergeRequestsLoadContext
<
BaseContext
def
execute
type
=
params
[
:f
]
merge_requests
=
@
project
.
merge_requests
merge_requests
=
project
.
merge_requests
merge_requests
=
case
type
when
'all'
then
merge_requests
when
'closed'
then
merge_requests
.
closed
when
'assigned-to-me'
then
merge_requests
.
opened
.
assigned
(
current_user
)
else
merge_requests
.
opened
end
.
page
(
params
[
:page
]).
per
(
20
)
merge_requests
.
includes
(
:author
,
:project
).
order
(
"closed, created_at desc"
)
end
@merge_requests
=
merge_requests
merge_requests
=
merge_requests
.
page
(
params
[
:page
]).
per
(
20
)
merge_requests
=
merge_requests
.
includes
(
:author
,
:project
).
order
(
"closed, created_at desc"
)
# Filter by specific assignee_id (or lack thereof)?
if
params
[
:assignee_id
].
present?
@
merge_requests
=
merge_requests
.
where
(
assignee_id:
(
params
[
:assignee_id
]
==
'0'
?
nil
:
params
[
:assignee_id
]))
merge_requests
=
merge_requests
.
where
(
assignee_id:
(
params
[
:assignee_id
]
==
'0'
?
nil
:
params
[
:assignee_id
]))
end
# Filter by specific milestone_id (or lack thereof)?
if
params
[
:milestone_id
].
present?
@
merge_requests
=
merge_requests
.
where
(
milestone_id:
(
params
[
:milestone_id
]
==
'0'
?
nil
:
params
[
:milestone_id
]))
merge_requests
=
merge_requests
.
where
(
milestone_id:
(
params
[
:milestone_id
]
==
'0'
?
nil
:
params
[
:milestone_id
]))
end
@merge_requests
merge_requests
end
end
app/models/milestone.rb
浏览文件 @
d4e070cf
...
...
@@ -16,8 +16,16 @@ class Milestone < ActiveRecord::Base
User
.
where
(
id:
issues
.
pluck
(
:assignee_id
))
end
def
percent_complete
def
issues_
percent_complete
((
self
.
issues
.
closed
.
count
*
100
)
/
self
.
issues
.
count
).
abs
end
def
merge_requests_percent_complete
((
self
.
merge_requests
.
closed
.
count
*
100
)
/
self
.
merge_requests
.
count
).
abs
end
def
percent_complete
(
issues_percent_complete
+
merge_requests_percent_complete
)
/
2
rescue
ZeroDivisionError
100
end
...
...
app/views/milestones/_milestone.html.haml
浏览文件 @
d4e070cf
%li
{
class:
"milestone"
,
id:
dom_id
(
milestone
)
}
.right
-
if
milestone
.
issues
.
any?
%span
.btn.small.disabled.grouped
=
pluralize
milestone
.
issues
.
count
,
'issues'
-
if
milestone
.
issues
.
count
>
0
=
link_to
'Browse Issues'
,
project_issues_path
(
milestone
.
project
,
milestone_id:
milestone
.
id
),
class:
"btn small grouped"
-
if
milestone
.
merge_requests
.
any?
%span
.btn.small.disabled.grouped
=
pluralize
milestone
.
issues
.
count
,
'Merge Requests'
-
if
milestone
.
merge_requests
.
count
>
0
=
link_to
'Browse Merge Requests'
,
project_merge_requests_path
(
milestone
.
project
,
milestone_id:
milestone
.
id
),
class:
"btn small grouped"
-
if
can?
current_user
,
:admin_milestone
,
milestone
.
project
=
link_to
'Edit'
,
edit_project_milestone_path
(
milestone
.
project
,
milestone
),
class:
"btn small edit-milestone-link grouped"
=
link_to
edit_project_milestone_path
(
milestone
.
project
,
milestone
),
class:
"btn small edit-milestone-link grouped"
do
%i
.icon-edit
Edit
%h4
=
link_to_gfm
truncate
(
milestone
.
title
,
length:
100
),
project_milestone_path
(
milestone
.
project
,
milestone
)
,
class:
"row_title"
=
link_to_gfm
truncate
(
milestone
.
title
,
length:
100
),
project_milestone_path
(
milestone
.
project
,
milestone
)
%small
=
milestone
.
expires_at
%br
.progress.progress-success.span
3
.row
.progress.progress-success.span
4
.bar
{
style:
"width: #{milestone.percent_complete}%;"
}
.span6
-
if
milestone
.
issues
.
any?
=
link_to
project_issues_path
(
milestone
.
project
,
milestone_id:
milestone
.
id
),
class:
"padded"
do
%strong
=
pluralize
milestone
.
issues
.
count
,
'Issue'
-
if
milestone
.
merge_requests
.
any?
=
link_to
project_merge_requests_path
(
milestone
.
project
,
milestone_id:
milestone
.
id
),
class:
"padded"
do
%strong
=
pluralize
milestone
.
issues
.
count
,
'Merge Request'
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录