Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
73c4c995
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,发现更多精彩内容 >>
未验证
提交
73c4c995
编写于
2月 23, 2018
作者:
J
James Lopez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
inline methods
上级
b8028c6c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
9 addition
and
25 deletion
+9
-25
app/helpers/blob_helper.rb
app/helpers/blob_helper.rb
+7
-23
app/views/projects/tree/_tree_header.html.haml
app/views/projects/tree/_tree_header.html.haml
+2
-2
未找到文件。
app/helpers/blob_helper.rb
浏览文件 @
73c4c995
...
...
@@ -23,32 +23,16 @@ module BlobHelper
edit_button_tag
(
blob
,
common_classes
,
edit_text
,
_
(
'Edit'
)
,
edit_blob_path
(
project
,
ref
,
path
,
options
),
project
,
ref
)
end
def
user_can_fork_project?
(
project
)
current_user
&&
can?
(
current_user
,
:fork_project
,
project
)
end
def
display_modify_blob?
(
blob
,
project
,
ref
)
!
current_user
||
(
current_user
&&
can_modify_blob?
(
blob
,
project
,
ref
))
end
def
ide_edit_path
(
project
=
@project
,
ref
=
@ref
,
path
=
@path
,
options
=
{})
"
#{
ide_path
}
/project
#{
edit_blob_path
(
project
,
ref
,
path
,
options
)
}
"
end
def
edit_text
_
(
'Edit'
)
end
def
ide_edit_text
_
(
'Web IDE'
)
end
def
ide_edit_button
(
project
=
@project
,
ref
=
@ref
,
path
=
@path
,
options
=
{})
return
unless
show_new_ide?
return
unless
blob
=
readable_blob
(
options
,
path
,
project
,
ref
)
...
...
@@ -57,13 +41,13 @@ module BlobHelper
edit_button_tag
(
blob
,
common_classes
,
ide_edit_text
,
ide_edit_path
(
project
,
ref
,
path
,
options
)
,
_
(
'Web IDE'
)
,
"
#{
ide_path
}
/project
#{
edit_blob_path
(
project
,
ref
,
path
,
options
)
}
"
,
project
,
ref
)
end
def
modify_file_
element
(
project
=
@project
,
ref
=
@ref
,
path
=
@path
,
label
:,
action
:,
btn_class
:,
modal_type
:)
def
modify_file_
button
(
project
=
@project
,
ref
=
@ref
,
path
=
@path
,
label
:,
action
:,
btn_class
:,
modal_type
:)
return
unless
current_user
blob
=
project
.
repository
.
blob_at
(
ref
,
path
)
rescue
nil
...
...
@@ -84,7 +68,7 @@ module BlobHelper
end
def
replace_blob_link
(
project
=
@project
,
ref
=
@ref
,
path
=
@path
)
modify_file_
element
(
modify_file_
button
(
project
,
ref
,
path
,
...
...
@@ -96,7 +80,7 @@ module BlobHelper
end
def
delete_blob_link
(
project
=
@project
,
ref
=
@ref
,
path
=
@path
)
modify_file_
element
(
modify_file_
button
(
project
,
ref
,
path
,
...
...
@@ -353,7 +337,7 @@ module BlobHelper
# Web IDE (Beta) requires the user to have this feature enabled
elsif
display_modify_blob?
(
blob
,
project
,
ref
)
edit_link_tag
(
text
,
edit_path
,
common_classes
)
elsif
user_can_fork_project?
(
project
)
elsif
current_user
&&
can?
(
current_user
,
:fork_project
,
project
)
edit_fork_button_tag
(
common_classes
,
project
,
text
,
edit_blob_fork_params
(
edit_path
))
end
end
...
...
app/views/projects/tree/_tree_header.html.haml
浏览文件 @
73c4c995
...
...
@@ -74,8 +74,8 @@
.tree-controls
-
if
show_new_ide?
=
succeed
" "
do
=
link_to
ide_edit_path
(
@project
,
@id
)
,
class:
'btn btn-default'
do
=
ide_edit_text
=
link_to
"
#{
ide_path
}
/project
#{
edit_blob_path
(
@project
,
@id
,
@path
,
{
}
)}"
,
class:
'btn btn-default'
do
=
_
(
'Web IDE'
)
=
link_to
s_
(
'Commits|History'
),
project_commits_path
(
@project
,
@id
),
class:
'btn'
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录