Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
e9fad8cf
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,发现更多精彩内容 >>
提交
e9fad8cf
编写于
2月 03, 2015
作者:
D
Dmitriy Zaporozhets
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'tune_commit_page' into 'master'
Tune commit page: async load of branch info See merge request !1462
上级
7bf20368
19f39b42
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
43 addition
and
21 deletion
+43
-21
CHANGELOG
CHANGELOG
+1
-1
app/controllers/projects/commit_controller.rb
app/controllers/projects/commit_controller.rb
+6
-2
app/views/projects/commit/_commit_box.html.haml
app/views/projects/commit/_commit_box.html.haml
+6
-17
app/views/projects/commit/branches.html.haml
app/views/projects/commit/branches.html.haml
+16
-0
config/routes.rb
config/routes.rb
+5
-1
spec/controllers/commit_controller_spec.rb
spec/controllers/commit_controller_spec.rb
+9
-0
未找到文件。
CHANGELOG
浏览文件 @
e9fad8cf
...
...
@@ -28,7 +28,7 @@ v 7.8.0
- Added Rubocop for code style checks
- Fix commits pagination
-
-
-
Async load a branch information at the commit page
-
-
- Add a commit calendar to the user profile (Hannes Rosenögger)
...
...
app/controllers/projects/commit_controller.rb
浏览文件 @
e9fad8cf
...
...
@@ -11,8 +11,6 @@ class Projects::CommitController < Projects::ApplicationController
return
git_not_found!
unless
@commit
@line_notes
=
@project
.
notes
.
for_commit_id
(
commit
.
id
).
inline
@branches
=
@project
.
repository
.
branch_names_contains
(
commit
.
id
)
@tags
=
@project
.
repository
.
tag_names_contains
(
commit
.
id
)
@diffs
=
@commit
.
diffs
@note
=
@project
.
build_commit_note
(
commit
)
@notes_count
=
@project
.
notes
.
for_commit_id
(
commit
.
id
).
count
...
...
@@ -31,6 +29,12 @@ class Projects::CommitController < Projects::ApplicationController
end
end
def
branches
@branches
=
@project
.
repository
.
branch_names_contains
(
commit
.
id
)
@tags
=
@project
.
repository
.
tag_names_contains
(
commit
.
id
)
render
layout:
false
end
def
commit
@commit
||=
@project
.
repository
.
commit
(
params
[
:id
])
end
...
...
app/views/projects/commit/_commit_box.html.haml
浏览文件 @
e9fad8cf
...
...
@@ -37,23 +37,8 @@
-
@commit
.
parents
.
each
do
|
parent
|
=
link_to
parent
.
short_id
,
project_commit_path
(
@project
,
parent
)
.commit-info-row
-
if
@branches
.
any?
%span
-
branch
=
commit_default_branch
(
@project
,
@branches
)
=
link_to
(
project_tree_path
(
@project
,
branch
))
do
%span
.label.label-gray
%i
.fa.fa-code-fork
=
branch
-
if
@branches
.
any?
||
@tags
.
any?
=
link_to
(
"#"
,
class:
"js-details-expand"
)
do
%span
.label.label-gray
\...
%span
.js-details-content.hide
-
if
@branches
.
any?
=
commit_branches_links
(
@project
,
@branches
)
-
if
@tags
.
any?
=
commit_tags_links
(
@project
,
@tags
)
.commit-info-row.branches
%i
.fa.fa-spinner.fa-spin
.commit-box
%h3
.commit-title
...
...
@@ -61,3 +46,7 @@
-
if
@commit
.
description
.
present?
%pre
.commit-description
=
preserve
(
gfm
(
escape_once
(
@commit
.
description
)))
:coffeescript
$ ->
$(".commit-info-row.branches").load("
#{
branches_project_commit_path
(
@project
,
@commit
.
id
)
}
")
\ No newline at end of file
app/views/projects/commit/branches.html.haml
0 → 100644
浏览文件 @
e9fad8cf
-
if
@branches
.
any?
%span
-
branch
=
commit_default_branch
(
@project
,
@branches
)
=
link_to
(
project_tree_path
(
@project
,
branch
))
do
%span
.label.label-gray
%i
.fa.fa-code-fork
=
branch
-
if
@branches
.
any?
||
@tags
.
any?
=
link_to
(
"#"
,
class:
"js-details-expand"
)
do
%span
.label.label-gray
\...
%span
.js-details-content.hide
-
if
@branches
.
any?
=
commit_branches_links
(
@project
,
@branches
)
-
if
@tags
.
any?
=
commit_tags_links
(
@project
,
@tags
)
\ No newline at end of file
config/routes.rb
浏览文件 @
e9fad8cf
...
...
@@ -228,7 +228,11 @@ Gitlab::Application.routes.draw do
resources
:raw
,
only:
[
:show
],
constraints:
{
id:
/.+/
}
resources
:tree
,
only:
[
:show
],
constraints:
{
id:
/.+/
,
format:
/(html|js)/
}
resource
:avatar
,
only:
[
:show
,
:destroy
]
resources
:commit
,
only:
[
:show
],
constraints:
{
id:
/[[:alnum:]]{6,40}/
}
resources
:commit
,
only:
[
:show
],
constraints:
{
id:
/[[:alnum:]]{6,40}/
}
do
get
:branches
,
on: :member
end
resources
:commits
,
only:
[
:show
],
constraints:
{
id:
/(?:[^.]|\.(?!atom$))+/
,
format:
/atom/
}
resources
:compare
,
only:
[
:index
,
:create
]
resources
:blame
,
only:
[
:show
],
constraints:
{
id:
/.+/
}
...
...
spec/controllers/commit_controller_spec.rb
浏览文件 @
e9fad8cf
...
...
@@ -70,4 +70,13 @@ describe Projects::CommitController do
end
end
end
describe
"#branches"
do
it
"contains branch and tags information"
do
get
:branches
,
project_id:
project
.
to_param
,
id:
commit
.
id
expect
(
assigns
(
:branches
)).
to
include
(
"master"
,
"feature_conflict"
)
expect
(
assigns
(
:tags
)).
to
include
(
"v1.1.0"
)
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录