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 {
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
View file @
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
View file @
62ad0113
...
...
@@ -65,6 +65,7 @@ header {
}
#ide
{
height
:
70vh
;
margin-top
:
-5px
;
}
}
...
...
app/controllers/projects/blob_controller.rb
View file @
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
...
...
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