Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
62ad0113
Commit
62ad0113
authored
Jul 10, 2017
by
Jacob Schatz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get single view working.
parent
714dac67
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
29 deletions
+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
No files found.
app/assets/javascripts/repo/repo_bundle.js
View file @
62ad0113
...
@@ -15,7 +15,7 @@ export default class RepoBundle {
...
@@ -15,7 +15,7 @@ export default class RepoBundle {
Store
.
tabs
=
new
Tabs
();
Store
.
tabs
=
new
Tabs
();
Store
.
sidebar
=
new
Sidebar
(
url
);
Store
.
sidebar
=
new
Sidebar
(
url
);
Store
.
editor
=
new
Editor
();
Store
.
editor
=
new
Editor
();
Store
.
toggler
=
new
ViewToggler
();
//
Store.toggler = new ViewToggler();
Store
.
binaryViewer
=
new
BinaryViewer
();
Store
.
binaryViewer
=
new
BinaryViewer
();
Helper
.
getContent
();
Helper
.
getContent
();
}
}
...
...
app/assets/javascripts/repo/repo_helper.js
View file @
62ad0113
...
@@ -78,9 +78,7 @@ let RepoHelper = {
...
@@ -78,9 +78,7 @@ let RepoHelper = {
});
});
if
(
file
.
binary
)
{
if
(
file
.
binary
)
{
Store
.
blobRaw
=
file
.
base64
;
Store
.
blobRaw
=
file
.
base64
;
console
.
log
(
'
binary
'
,
file
)
}
else
{
}
else
{
console
.
log
(
'
f
'
,
file
)
Store
.
blobRaw
=
file
.
plain
;
Store
.
blobRaw
=
file
.
plain
;
}
}
if
(
!
file
.
loading
){
if
(
!
file
.
loading
){
...
@@ -90,7 +88,6 @@ let RepoHelper = {
...
@@ -90,7 +88,6 @@ let RepoHelper = {
},
},
removeFromOpenedFiles
(
file
)
{
removeFromOpenedFiles
(
file
)
{
console
.
log
(
'
file remove
'
,
file
)
if
(
file
.
type
===
'
tree
'
)
return
;
if
(
file
.
type
===
'
tree
'
)
return
;
Store
.
openedFiles
=
Store
.
openedFiles
.
filter
((
openedFile
)
=>
{
Store
.
openedFiles
=
Store
.
openedFiles
.
filter
((
openedFile
)
=>
{
return
openedFile
.
url
!==
file
.
url
;
return
openedFile
.
url
!==
file
.
url
;
...
@@ -122,7 +119,6 @@ let RepoHelper = {
...
@@ -122,7 +119,6 @@ let RepoHelper = {
.
then
((
response
)
=>
{
.
then
((
response
)
=>
{
Store
.
blobRaw
=
response
;
Store
.
blobRaw
=
response
;
file
.
base64
=
response
file
.
base64
=
response
console
.
log
(
'
file
'
,
file
);
});
});
},
},
...
@@ -163,7 +159,11 @@ let RepoHelper = {
...
@@ -163,7 +159,11 @@ let RepoHelper = {
let
data
=
response
.
data
;
let
data
=
response
.
data
;
this
.
setLoading
(
false
,
loadingData
);
this
.
setLoading
(
false
,
loadingData
);
Store
.
isTree
=
this
.
isTree
(
data
);
Store
.
isTree
=
this
.
isTree
(
data
);
if
(
!
Store
.
isTree
)
{
if
(
!
Store
.
isTree
)
{
if
(
!
file
)
{
file
=
data
;
}
// it's a blob
// it's a blob
Store
.
binary
=
data
.
binary
;
Store
.
binary
=
data
.
binary
;
if
(
data
.
binary
)
{
if
(
data
.
binary
)
{
...
@@ -177,13 +177,17 @@ let RepoHelper = {
...
@@ -177,13 +177,17 @@ let RepoHelper = {
this
.
addToOpenedFiles
(
data
);
this
.
addToOpenedFiles
(
data
);
this
.
setActiveFile
(
data
);
this
.
setActiveFile
(
data
);
}
else
{
}
else
{
const
parentURL
=
this
.
blobURLtoParent
(
Service
.
url
);
Store
.
blobRaw
=
data
.
plain
;
Store
.
blobRaw
=
data
.
plain
;
Store
.
prevURL
=
this
.
blobURLtoParent
(
parentURL
);
data
.
url
=
file
.
url
;
data
.
url
=
file
.
url
;
data
.
binary
=
false
;
data
.
binary
=
false
;
this
.
addToOpenedFiles
(
data
);
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
{
}
else
{
// it's a tree
// it's a tree
...
@@ -221,30 +225,38 @@ let RepoHelper = {
...
@@ -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
)
{
dataToListOfFiles
(
data
)
{
let
a
=
[];
let
a
=
[];
//push in blobs
//push in blobs
data
.
blobs
.
forEach
((
blob
)
=>
{
data
.
blobs
.
forEach
((
blob
)
=>
{
a
.
push
({
a
.
push
(
this
.
blobToSimpleBlob
(
blob
))
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
})
});
});
data
.
trees
.
forEach
((
tree
)
=>
{
data
.
trees
.
forEach
((
tree
)
=>
{
a
.
push
({
a
.
push
(
this
.
treeToSimpleTree
(
tree
));
type
:
'
tree
'
,
name
:
tree
.
name
,
url
:
tree
.
url
,
icon
:
this
.
toFA
(
tree
.
icon
),
level
:
0
})
});
});
data
.
submodules
.
forEach
((
submodule
)
=>
{
data
.
submodules
.
forEach
((
submodule
)
=>
{
...
...
app/assets/stylesheets/pages/repo.scss
View file @
62ad0113
...
@@ -65,6 +65,7 @@ header {
...
@@ -65,6 +65,7 @@ header {
}
}
#ide
{
#ide
{
height
:
70vh
;
height
:
70vh
;
margin-top
:
-5px
;
}
}
}
}
...
...
app/controllers/projects/blob_controller.rb
View file @
62ad0113
...
@@ -37,12 +37,10 @@ class Projects::BlobController < Projects::ApplicationController
...
@@ -37,12 +37,10 @@ class Projects::BlobController < Projects::ApplicationController
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
do
format
.
html
do
environment_params
=
@repository
.
branch_exists?
(
@ref
)
?
{
ref:
@ref
}
:
{
commit:
@commit
}
assign_ref_vars
@
environment
=
EnvironmentsFinder
.
new
(
@project
,
current_user
,
environment_params
).
execute
.
las
t
@
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
'projects/tree/show'
render
'show'
end
end
format
.
json
do
format
.
json
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment