Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
b1b8261f
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 搜索 >>
提交
b1b8261f
编写于
3月 17, 2015
作者:
D
Douwe Maan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add license and contribution guide links to project sidebar.
上级
5adb1128
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
65 addition
and
17 deletion
+65
-17
CHANGELOG
CHANGELOG
+1
-0
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+35
-2
app/models/repository.rb
app/models/repository.rb
+9
-1
app/views/projects/_issuable_form.html.haml
app/views/projects/_issuable_form.html.haml
+2
-2
app/views/projects/merge_requests/_new_submit.html.haml
app/views/projects/merge_requests/_new_submit.html.haml
+2
-2
app/views/projects/show.html.haml
app/views/projects/show.html.haml
+16
-10
未找到文件。
CHANGELOG
浏览文件 @
b1b8261f
...
@@ -2,6 +2,7 @@ Please view this file on the master branch, on stable branches it's out of date.
...
@@ -2,6 +2,7 @@ Please view this file on the master branch, on stable branches it's out of date.
v 7.10.0 (unreleased)
v 7.10.0 (unreleased)
- Add a service to support external wikis (Hannes Rosenögger)
- Add a service to support external wikis (Hannes Rosenögger)
- Add changelog, license and contribution guide links to project sidebar.
v 7.9.0 (unreleased)
v 7.9.0 (unreleased)
- Add HipChat integration documentation (Stan Hu)
- Add HipChat integration documentation (Stan Hu)
...
...
app/helpers/projects_helper.rb
浏览文件 @
b1b8261f
...
@@ -232,12 +232,45 @@ module ProjectsHelper
...
@@ -232,12 +232,45 @@ module ProjectsHelper
end
end
def
contribution_guide_url
(
project
)
def
contribution_guide_url
(
project
)
if
project
&&
project
.
repository
.
contribution_guide
if
project
&&
contribution_guide
=
project
.
repository
.
contribution_guide
namespace_project_blob_path
(
namespace_project_blob_path
(
project
.
namespace
,
project
.
namespace
,
project
,
project
,
tree_join
(
project
.
default_branch
,
tree_join
(
project
.
default_branch
,
project
.
repository
.
contribution_guide
.
name
)
contribution_guide
.
name
)
)
end
end
def
changelog_url
(
project
)
if
project
&&
changelog
=
project
.
repository
.
changelog
namespace_project_blob_path
(
project
.
namespace
,
project
,
tree_join
(
project
.
default_branch
,
changelog
.
name
)
)
end
end
def
license_url
(
project
)
if
project
&&
license
=
project
.
repository
.
license
namespace_project_blob_path
(
project
.
namespace
,
project
,
tree_join
(
project
.
default_branch
,
license
.
name
)
)
end
end
def
version_url
(
project
)
if
project
&&
version
=
project
.
repository
.
version
namespace_project_blob_path
(
project
.
namespace
,
project
,
tree_join
(
project
.
default_branch
,
version
.
name
)
)
)
end
end
end
end
...
...
app/models/repository.rb
浏览文件 @
b1b8261f
...
@@ -122,7 +122,7 @@ class Repository
...
@@ -122,7 +122,7 @@ class Repository
def
expire_cache
def
expire_cache
%i(size branch_names tag_names commit_count graph_log
%i(size branch_names tag_names commit_count graph_log
readme version contribution_guide changelog)
.
each
do
|
key
|
readme version contribution_guide changelog
license
)
.
each
do
|
key
|
cache
.
expire
(
key
)
cache
.
expire
(
key
)
end
end
end
end
...
@@ -212,6 +212,14 @@ class Repository
...
@@ -212,6 +212,14 @@ class Repository
end
end
end
end
def
license
cache
.
fetch
(
:license
)
do
tree
(
:head
).
blobs
.
find
do
|
file
|
file
.
name
=~
/^license/i
end
end
end
def
head_commit
def
head_commit
commit
(
self
.
root_ref
)
commit
(
self
.
root_ref
)
end
end
...
...
app/views/projects/_issuable_form.html.haml
浏览文件 @
b1b8261f
...
@@ -71,10 +71,10 @@
...
@@ -71,10 +71,10 @@
=
link_to
'Create new label'
,
new_namespace_project_label_path
(
issuable
.
project
.
namespace
,
issuable
.
project
),
target: :blank
=
link_to
'Create new label'
,
new_namespace_project_label_path
(
issuable
.
project
.
namespace
,
issuable
.
project
),
target: :blank
.form-actions
.form-actions
-
if
!
issuable
.
project
.
empty_repo?
&&
contribution_guide_url
(
issuable
.
project
)
&&
!
issuable
.
persisted?
-
if
!
issuable
.
project
.
empty_repo?
&&
(
guide_url
=
contribution_guide_url
(
issuable
.
project
)
)
&&
!
issuable
.
persisted?
%p
%p
Please review the
Please review the
%strong
#{
link_to
'guidelines for contribution'
,
contribution_guide_url
(
issuable
.
project
)
}
%strong
#{
link_to
'guidelines for contribution'
,
guide_url
}
to this repository.
to this repository.
-
if
issuable
.
new_record?
-
if
issuable
.
new_record?
=
f
.
submit
"Submit new
#{
issuable
.
class
.
model_name
.
human
.
downcase
}
"
,
class:
'btn btn-create'
=
f
.
submit
"Submit new
#{
issuable
.
class
.
model_name
.
human
.
downcase
}
"
,
class:
'btn btn-create'
...
...
app/views/projects/merge_requests/_new_submit.html.haml
浏览文件 @
b1b8261f
...
@@ -69,10 +69,10 @@
...
@@ -69,10 +69,10 @@
=
link_to
'Create new label'
,
new_namespace_project_label_path
(
@merge_request
.
target_project
.
namespace
,
@merge_request
.
target_project
),
target: :blank
=
link_to
'Create new label'
,
new_namespace_project_label_path
(
@merge_request
.
target_project
.
namespace
,
@merge_request
.
target_project
),
target: :blank
.form-actions
.form-actions
-
if
contribution_guide_url
(
@target_project
)
-
if
guide_url
=
contribution_guide_url
(
@target_project
)
%p
%p
Please review the
Please review the
%strong
#{
link_to
'guidelines for contribution'
,
contribution_guide_url
(
@target_project
)
}
%strong
#{
link_to
'guidelines for contribution'
,
guide_url
}
to this repository.
to this repository.
=
f
.
hidden_field
:source_project_id
=
f
.
hidden_field
:source_project_id
=
f
.
hidden_field
:source_branch
=
f
.
hidden_field
:source_branch
...
...
app/views/projects/show.html.haml
浏览文件 @
b1b8261f
...
@@ -47,21 +47,27 @@
...
@@ -47,21 +47,27 @@
=
link_to
@project
.
forked_from_project
.
name_with_namespace
,
namespace_project_path
(
@project
.
namespace
,
@project
.
forked_from_project
)
=
link_to
@project
.
forked_from_project
.
name_with_namespace
,
namespace_project_path
(
@project
.
namespace
,
@project
.
forked_from_project
)
-
unless
@project
.
empty_repo?
-
unless
@project
.
empty_repo?
=
link_to
namespace_project_compare_index_path
(
@project
.
namespace
,
@project
,
from:
@repository
.
root_ref
,
to:
@ref
||
@repository
.
root_ref
),
class:
'btn btn-block'
do
-
if
version
=
@repository
.
version
Compare code
-
detail_url
=
changelog_url
(
@project
)
||
version_url
(
@project
)
=
link_to
detail_url
,
class:
'btn btn-block'
do
-
version
=
@repository
.
version
-
changelog
=
@repository
.
changelog
-
if
version
-
detail_file
=
changelog
.
try
(
:name
)
||
version
.
name
=
link_to
namespace_project_blob_path
(
@project
.
namespace
,
@project
,
tree_join
(
@repository
.
root_ref
,
detail_file
)),
class:
'btn btn-block'
do
Version:
Version:
%span
.count
%span
.count
=
@repository
.
blob_by_oid
(
version
.
id
).
data
=
@repository
.
blob_by_oid
(
version
.
id
).
data
-
elsif
changelog
-
elsif
@repository
.
changelog
=
link_to
namespace_project_blob_path
(
@project
.
namespace
,
@project
,
tree_join
(
@repository
.
root_ref
,
changelog
.
name
)
),
class:
'btn btn-block'
do
=
link_to
changelog_url
(
@project
),
class:
'btn btn-block'
do
View changelog
View changelog
-
if
@repository
.
contribution_guide
=
link_to
contribution_guide_url
(
@project
),
class:
'btn btn-block'
do
View contribution guide
-
if
@repository
.
license
=
link_to
license_url
(
@project
),
class:
'btn btn-block'
do
View license
=
link_to
namespace_project_compare_index_path
(
@project
.
namespace
,
@project
,
from:
@repository
.
root_ref
,
to:
@ref
||
@repository
.
root_ref
),
class:
'btn btn-block'
do
Compare code
.prepend-top-10
.prepend-top-10
%p
%p
%span
.light
Created on
%span
.light
Created on
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录