Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
62ad0113
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,发现更多精彩内容 >>
提交
62ad0113
编写于
7月 10, 2017
作者:
J
Jacob Schatz
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Get single view working.
上级
714dac67
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
40 addition
and
29 deletion
+40
-29
app/assets/javascripts/repo/repo_bundle.js
app/assets/javascripts/repo/repo_bundle.js
+1
-1
app/assets/javascripts/repo/repo_helper.js
app/assets/javascripts/repo/repo_helper.js
+35
-23
app/assets/stylesheets/pages/repo.scss
app/assets/stylesheets/pages/repo.scss
+1
-0
app/controllers/projects/blob_controller.rb
app/controllers/projects/blob_controller.rb
+3
-5
未找到文件。
app/assets/javascripts/repo/repo_bundle.js
浏览文件 @
62ad0113
...
...
@@ -15,7 +15,7 @@ export default class RepoBundle {
Store
.
tabs
=
new
Tabs
();
Store
.
sidebar
=
new
Sidebar
(
url
);
Store
.
editor
=
new
Editor
();
Store
.
toggler
=
new
ViewToggler
();
//
Store.toggler = new ViewToggler();
Store
.
binaryViewer
=
new
BinaryViewer
();
Helper
.
getContent
();
}
...
...
app/assets/javascripts/repo/repo_helper.js
浏览文件 @
62ad0113
...
...
@@ -78,9 +78,7 @@ let RepoHelper = {
});
if
(
file
.
binary
)
{
Store
.
blobRaw
=
file
.
base64
;
console
.
log
(
'
binary
'
,
file
)
}
else
{
console
.
log
(
'
f
'
,
file
)
Store
.
blobRaw
=
file
.
plain
;
}
if
(
!
file
.
loading
){
...
...
@@ -90,7 +88,6 @@ let RepoHelper = {
},
removeFromOpenedFiles
(
file
)
{
console
.
log
(
'
file remove
'
,
file
)
if
(
file
.
type
===
'
tree
'
)
return
;
Store
.
openedFiles
=
Store
.
openedFiles
.
filter
((
openedFile
)
=>
{
return
openedFile
.
url
!==
file
.
url
;
...
...
@@ -122,7 +119,6 @@ let RepoHelper = {
.
then
((
response
)
=>
{
Store
.
blobRaw
=
response
;
file
.
base64
=
response
console
.
log
(
'
file
'
,
file
);
});
},
...
...
@@ -163,7 +159,11 @@ let RepoHelper = {
let
data
=
response
.
data
;
this
.
setLoading
(
false
,
loadingData
);
Store
.
isTree
=
this
.
isTree
(
data
);
if
(
!
Store
.
isTree
)
{
if
(
!
file
)
{
file
=
data
;
}
// it's a blob
Store
.
binary
=
data
.
binary
;
if
(
data
.
binary
)
{
...
...
@@ -177,13 +177,17 @@ let RepoHelper = {
this
.
addToOpenedFiles
(
data
);
this
.
setActiveFile
(
data
);
}
else
{
const
parentURL
=
this
.
blobURLtoParent
(
Service
.
url
);
Store
.
blobRaw
=
data
.
plain
;
Store
.
prevURL
=
this
.
blobURLtoParent
(
parentURL
);
data
.
url
=
file
.
url
;
data
.
binary
=
false
;
this
.
addToOpenedFiles
(
data
);
this
.
setActiveFile
(
data
);
this
.
setActiveFile
(
data
);
}
// if the file tree is empty
if
(
Store
.
files
.
length
===
0
)
{
const
parentURL
=
this
.
blobURLtoParent
(
Service
.
url
);
Service
.
url
=
parentURL
;
this
.
getContent
();
}
}
else
{
// it's a tree
...
...
@@ -221,30 +225,38 @@ let RepoHelper = {
},
blobToSimpleBlob
(
blob
)
{
return
{
type
:
'
blob
'
,
name
:
blob
.
name
,
url
:
blob
.
url
,
icon
:
this
.
toFA
(
blob
.
icon
),
lastCommitMessage
:
blob
.
last_commit
.
message
,
lastCommitUpdate
:
blob
.
last_commit
.
committed_date
,
level
:
0
}
},
treeToSimpleTree
(
tree
)
{
return
{
type
:
'
tree
'
,
name
:
tree
.
name
,
url
:
tree
.
url
,
icon
:
this
.
toFA
(
tree
.
icon
),
level
:
0
}
},
dataToListOfFiles
(
data
)
{
let
a
=
[];
//push in blobs
data
.
blobs
.
forEach
((
blob
)
=>
{
a
.
push
({
type
:
'
blob
'
,
name
:
blob
.
name
,
url
:
blob
.
url
,
icon
:
this
.
toFA
(
blob
.
icon
),
lastCommitMessage
:
blob
.
last_commit
.
message
,
lastCommitUpdate
:
blob
.
last_commit
.
committed_date
,
level
:
0
})
a
.
push
(
this
.
blobToSimpleBlob
(
blob
))
});
data
.
trees
.
forEach
((
tree
)
=>
{
a
.
push
({
type
:
'
tree
'
,
name
:
tree
.
name
,
url
:
tree
.
url
,
icon
:
this
.
toFA
(
tree
.
icon
),
level
:
0
})
a
.
push
(
this
.
treeToSimpleTree
(
tree
));
});
data
.
submodules
.
forEach
((
submodule
)
=>
{
...
...
app/assets/stylesheets/pages/repo.scss
浏览文件 @
62ad0113
...
...
@@ -65,6 +65,7 @@ header {
}
#ide
{
height
:
70vh
;
margin-top
:
-5px
;
}
}
...
...
app/controllers/projects/blob_controller.rb
浏览文件 @
62ad0113
...
...
@@ -37,12 +37,10 @@ class Projects::BlobController < Projects::ApplicationController
respond_to
do
|
format
|
format
.
html
do
environment_params
=
@repository
.
branch_exists?
(
@ref
)
?
{
ref:
@ref
}
:
{
commit:
@commit
}
@
environment
=
EnvironmentsFinder
.
new
(
@project
,
current_user
,
environment_params
).
execute
.
las
t
assign_ref_vars
@
last_commit
=
@repository
.
last_commit_for_path
(
@commit
.
id
,
tree
.
path
)
||
@commi
t
@last_commit
=
@repository
.
last_commit_for_path
(
@commit
.
id
,
@blob
.
path
)
render
'show'
render
'projects/tree/show'
end
format
.
json
do
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录