BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
7e9100fc
Commit
7e9100fc
authored
Jun 19, 2017
by
Jacob Schatz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Gets parent directory after call to blob.
parent
2041ee57
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
3 deletions
+24
-3
repo_helper.js
app/assets/javascripts/repo/repo_helper.js
+10
-0
repo_service.js
app/assets/javascripts/repo/repo_service.js
+4
-1
repo_sidebar.js
app/assets/javascripts/repo/repo_sidebar.js
+10
-1
_blob.html.haml
app/views/projects/blob/_blob.html.haml
+0
-1
No files found.
app/assets/javascripts/repo/repo_helper.js
View file @
7e9100fc
let
RepoHelper
=
{
isTree
(
data
)
{
return
data
.
hasOwnProperty
(
'blobs'
);
},
blobURLtoParent
(
url
)
{
const
split
=
url
.
split
(
'/'
);
split
.
pop
();
const
blobIndex
=
split
.
indexOf
(
'blob'
);
if
(
blobIndex
>
-
1
)
{
split
[
blobIndex
]
=
'tree'
;
}
return
split
.
join
(
'/'
);
}
};
...
...
app/assets/javascripts/repo/repo_service.js
View file @
7e9100fc
...
...
@@ -7,7 +7,10 @@ let RepoService = {
this
.
url
=
url
;
},
getContent
()
{
getContent
(
url
)
{
if
(
url
){
return
axios
.
get
(
url
);
}
return
axios
.
get
(
this
.
url
);
}
};
...
...
app/assets/javascripts/repo/repo_sidebar.js
View file @
7e9100fc
...
...
@@ -2,7 +2,6 @@ import Service from './repo_service'
import
Helper
from
'./repo_helper'
import
Vue
from
'vue'
;
import
Store
from
'./repo_store'
export
default
class
RepoSidebar
{
constructor
(
url
)
{
this
.
url
=
url
;
...
...
@@ -16,7 +15,17 @@ export default class RepoSidebar {
let
data
=
response
.
data
;
Store
.
isTree
=
Helper
.
isTree
(
data
);
if
(
!
Store
.
isTree
)
{
// it's a blob
const
parentURL
=
Helper
.
blobURLtoParent
(
Service
.
url
);
Store
.
blobRaw
=
data
.
plain
;
Service
.
getContent
(
parentURL
+
'/?format=json'
)
.
then
((
response
)
=>
{
console
.
log
(
response
.
data
)
})
.
catch
((
response
)
=>
{
});
}
else
{
}
})
.
catch
((
response
)
=>
{
...
...
app/views/projects/blob/_blob.html.haml
View file @
7e9100fc
...
...
@@ -8,5 +8,4 @@
=
render
"projects/blob/auxiliary_viewer"
,
blob:
blob
#blob-content-holder
.blob-content-holder
%p
hi
#ide
{
data:
{
url:
repo_url
},
style:
"height:400px;"
}
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