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
Léo-Paul Géneau
gitlab-ce
Commits
f658d26c
Commit
f658d26c
authored
Jul 26, 2017
by
Jacob Schatz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Checks if we are on root dir.
parent
3d6c9783
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
0 deletions
+20
-0
app/assets/javascripts/repo/index.js
app/assets/javascripts/repo/index.js
+1
-0
app/assets/javascripts/repo/repo_helper.js
app/assets/javascripts/repo/repo_helper.js
+16
-0
app/assets/javascripts/repo/repo_sidebar.vue
app/assets/javascripts/repo/repo_sidebar.vue
+1
-0
app/assets/javascripts/repo/repo_store.js
app/assets/javascripts/repo/repo_store.js
+2
-0
No files found.
app/assets/javascripts/repo/index.js
View file @
f658d26c
...
...
@@ -23,6 +23,7 @@ function initRepo() {
Store
.
checkIsCommitable
();
Store
.
projectId
=
repo
.
dataset
.
projectId
;
Store
.
tempPrivateToken
=
repo
.
dataset
.
tempToken
;
Store
.
projectUrl
=
repo
.
dataset
.
projectUrl
;
this
.
vm
=
new
Vue
({
el
:
repo
,
...
...
app/assets/javascripts/repo/repo_helper.js
View file @
f658d26c
...
...
@@ -100,6 +100,21 @@ const RepoHelper = {
return
0
;
},
isRoot
(
url
)
{
// the url we are requesting -> split by the project URL. Grab the right side.
const
isRoot
=
!!
url
.
split
(
Store
.
projectUrl
)[
1
]
// remove the first "/"
.
slice
(
1
)
// split this by "/"
.
split
(
'
/
'
)
// remove the first two items of the array... usually /tree/master.
.
slice
(
2
)
// we want to know the length of the array.
// If greater than 0 not root.
.
length
;
return
isRoot
;
},
getContent
(
treeOrFile
,
cb
)
{
let
file
=
treeOrFile
;
// const loadingData = RepoHelper.setLoading(true);
...
...
@@ -139,6 +154,7 @@ const RepoHelper = {
}
}
else
{
// it's a tree
if
(
!
file
)
Store
.
isRoot
=
RepoHelper
.
isRoot
(
Service
.
url
);
file
=
RepoHelper
.
setDirectoryOpen
(
file
);
const
newDirectory
=
RepoHelper
.
dataToListOfFiles
(
data
);
Store
.
addFilesToDirectory
(
file
,
Store
.
files
,
newDirectory
);
...
...
app/assets/javascripts/repo/repo_sidebar.vue
View file @
f658d26c
...
...
@@ -82,6 +82,7 @@ export default RepoSidebar;
:is-mini=
"isMini"
:project-name=
"projectName"
/>
<repo-previous-directory
v-if=
"isRoot"
:prev-url=
"prevURL"
@
linkclicked=
"linkClicked(prevURL)"
/>
<repo-loading-file
...
...
app/assets/javascripts/repo/repo_store.js
View file @
f658d26c
...
...
@@ -11,9 +11,11 @@ const RepoStore = {
editButton
:
''
,
editMode
:
false
,
isTree
:
false
,
isRoot
:
false
,
prevURL
:
''
,
projectId
:
''
,
projectName
:
''
,
projectUrl
:
''
,
trees
:
[],
blobs
:
[],
submodules
:
[],
...
...
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