Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
aeb9db67
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 搜索 >>
提交
aeb9db67
编写于
1月 10, 2017
作者:
O
Oswaldo Ferreira
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Present group and dashboard MR list without grouping by project
上级
ac662684
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
32 addition
and
44 deletion
+32
-44
app/controllers/dashboard_controller.rb
app/controllers/dashboard_controller.rb
+5
-0
app/models/issue.rb
app/models/issue.rb
+2
-2
app/models/project.rb
app/models/project.rb
+11
-16
app/views/projects/issues/_issue.html.haml
app/views/projects/issues/_issue.html.haml
+1
-6
app/views/projects/merge_requests/_merge_request.html.haml
app/views/projects/merge_requests/_merge_request.html.haml
+2
-1
app/views/shared/_merge_requests.html.haml
app/views/shared/_merge_requests.html.haml
+3
-11
spec/models/issue_spec.rb
spec/models/issue_spec.rb
+4
-4
spec/models/project_spec.rb
spec/models/project_spec.rb
+4
-4
未找到文件。
app/controllers/dashboard_controller.rb
浏览文件 @
aeb9db67
...
...
@@ -4,6 +4,7 @@ class DashboardController < Dashboard::ApplicationController
before_action
:event_filter
,
only: :activity
before_action
:projects
,
only:
[
:issues
,
:merge_requests
]
before_action
:set_show_full_reference
,
only:
[
:issues
,
:merge_requests
]
respond_to
:html
...
...
@@ -34,4 +35,8 @@ class DashboardController < Dashboard::ApplicationController
@events
=
@event_filter
.
apply_filter
(
@events
).
with_associations
@events
=
@events
.
limit
(
20
).
offset
(
params
[
:offset
]
||
0
)
end
def
set_show_full_reference
@show_full_reference
=
true
end
end
app/models/issue.rb
浏览文件 @
aeb9db67
...
...
@@ -97,10 +97,10 @@ class Issue < ActiveRecord::Base
end
end
def
to_reference
(
from
=
nil
,
full
_path
:
false
)
def
to_reference
(
from
=
nil
,
full:
false
)
reference
=
"
#{
self
.
class
.
reference_prefix
}#{
iid
}
"
"
#{
project
.
to_reference
(
from
,
full
_path:
full_path
)
}#{
reference
}
"
"
#{
project
.
to_reference
(
from
,
full
:
full
)
}#{
reference
}
"
end
def
referenced_merge_requests
(
current_user
=
nil
)
...
...
app/models/project.rb
浏览文件 @
aeb9db67
...
...
@@ -591,10 +591,12 @@ class Project < ActiveRecord::Base
end
end
def
to_reference
(
from
=
nil
,
full_path:
false
)
return
path_with_namespace
if
full_path
path_from
(
from
)
def
to_reference
(
from
=
nil
,
full:
false
)
if
full
||
cross_namespace_reference?
(
from
)
path_with_namespace
elsif
cross_project_reference?
(
from
)
path
end
end
def
to_human_reference
(
from_project
=
nil
)
...
...
@@ -1289,19 +1291,12 @@ class Project < ActiveRecord::Base
private
def
path_from
(
from
)
if
cross_namespace_reference?
(
from
)
path_with_namespace
elsif
cross_project_reference?
(
from
)
path
end
end
def
cross_namespace_reference?
(
from
)
if
from
.
is_a?
(
Project
)
from
&&
namespace
!=
from
.
namespace
else
from
&&
namespace
!=
from
case
from
when
Project
namespace
!=
from
.
namespace
when
Namespace
namespace
!=
from
end
end
...
...
app/views/projects/issues/_issue.html.haml
浏览文件 @
aeb9db67
...
...
@@ -34,13 +34,8 @@
=
note_count
.issue-info
-
if
controller_name
==
"dashboard"
#{
issue
.
to_reference
(
full_path:
true
)
}
-
else
#{
issue
.
to_reference
(
@group
||
@project
)
}
=
@show_full_reference
?
issue
.
to_reference
(
full:
true
)
:
issue
.
to_reference
(
@group
||
@project
)
·
opened
#{
time_ago_with_tooltip
(
issue
.
created_at
,
placement:
'bottom'
)
}
by
#{
link_to_member
(
@project
,
issue
.
author
,
avatar:
false
)
}
-
if
issue
.
milestone
...
...
app/views/projects/merge_requests/_merge_request.html.haml
浏览文件 @
aeb9db67
...
...
@@ -46,7 +46,8 @@
=
note_count
.merge-request-info
#{
merge_request
.
to_reference
}
·
=
@show_full_reference
?
merge_request
.
to_reference
(
full:
true
)
:
merge_request
.
to_reference
(
@group
||
@project
)
·
opened
#{
time_ago_with_tooltip
(
merge_request
.
created_at
,
placement:
'bottom'
)
}
by
#{
link_to_member
(
@project
,
merge_request
.
author
,
avatar:
false
)
}
-
if
merge_request
.
target_project
.
default_branch
!=
merge_request
.
target_branch
...
...
app/views/shared/_merge_requests.html.haml
浏览文件 @
aeb9db67
-
if
@merge_requests
.
to_a
.
any?
-
@merge_requests
.
group_by
(
&
:target_project
).
each
do
|
group
|
.panel.panel-default.panel-small
-
project
=
group
[
0
]
.panel-heading
=
link_to
project
.
name_with_namespace
,
namespace_project_merge_requests_path
(
project
.
namespace
,
project
)
-
if
can?
(
current_user
,
:create_merge_request
,
project
)
.pull-right
=
link_to
'New merge request'
,
new_namespace_project_merge_request_path
(
project
.
namespace
,
project
)
.panel.panel-default.panel-small
%ul
.content-list.mr-list
=
render
partial:
'projects/merge_requests/merge_request'
,
collection:
@merge_requests
%ul
.content-list.mr-list
-
group
[
1
].
each
do
|
merge_request
|
=
render
'projects/merge_requests/merge_request'
,
merge_request:
merge_request
=
paginate
@merge_requests
,
theme:
"gitlab"
-
else
...
...
spec/models/issue_spec.rb
浏览文件 @
aeb9db67
...
...
@@ -34,11 +34,11 @@ describe Issue, models: true do
end
end
context
'when full
_path
is true'
do
context
'when full is true'
do
it
'returns complete path to the issue'
do
expect
(
issue
.
to_reference
(
full
_path
:
true
)).
to
eq
'sample-namespace/sample-project#1'
expect
(
issue
.
to_reference
(
project
,
full
_path
:
true
)).
to
eq
'sample-namespace/sample-project#1'
expect
(
issue
.
to_reference
(
group
,
full
_path
:
true
)).
to
eq
'sample-namespace/sample-project#1'
expect
(
issue
.
to_reference
(
full:
true
)).
to
eq
'sample-namespace/sample-project#1'
expect
(
issue
.
to_reference
(
project
,
full:
true
)).
to
eq
'sample-namespace/sample-project#1'
expect
(
issue
.
to_reference
(
group
,
full:
true
)).
to
eq
'sample-namespace/sample-project#1'
end
end
...
...
spec/models/project_spec.rb
浏览文件 @
aeb9db67
...
...
@@ -293,11 +293,11 @@ describe Project, models: true do
end
end
context
'when full
_path
is true'
do
context
'when full is true'
do
it
'returns complete path to the project'
do
expect
(
project
.
to_reference
(
full
_path
:
true
)).
to
eq
'sample-namespace/sample-project'
expect
(
project
.
to_reference
(
project
,
full
_path
:
true
)).
to
eq
'sample-namespace/sample-project'
expect
(
project
.
to_reference
(
group
,
full
_path
:
true
)).
to
eq
'sample-namespace/sample-project'
expect
(
project
.
to_reference
(
full:
true
)).
to
eq
'sample-namespace/sample-project'
expect
(
project
.
to_reference
(
project
,
full:
true
)).
to
eq
'sample-namespace/sample-project'
expect
(
project
.
to_reference
(
group
,
full:
true
)).
to
eq
'sample-namespace/sample-project'
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录