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
727c8a26
Commit
727c8a26
authored
Jul 26, 2017
by
Jacob Schatz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Alphabetizes the list of files.
parent
2bdf1d9f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
7 deletions
+16
-7
repo_helper.js
app/assets/javascripts/repo/repo_helper.js
+16
-7
No files found.
app/assets/javascripts/repo/repo_helper.js
View file @
727c8a26
...
@@ -73,17 +73,15 @@ const RepoHelper = {
...
@@ -73,17 +73,15 @@ const RepoHelper = {
},
},
getNewMergedList
(
inDirectory
,
currentList
,
newList
)
{
getNewMergedList
(
inDirectory
,
currentList
,
newList
)
{
if
(
!
inDirectory
)
return
newList
;
const
newListSorted
=
newList
.
sort
(
this
.
compareFilesCaseInsensitive
)
;
if
(
!
inDirectory
)
return
newListSorted
;
const
indexOfFile
=
currentList
.
findIndex
(
file
=>
file
.
url
===
inDirectory
.
url
);
const
indexOfFile
=
currentList
.
findIndex
(
file
=>
file
.
url
===
inDirectory
.
url
);
if
(
!
indexOfFile
)
return
newListSorted
;
if
(
!
indexOfFile
)
return
newList
;
return
RepoHelper
.
mergeNewListToOldList
(
newListSorted
,
currentList
,
inDirectory
,
indexOfFile
);
return
RepoHelper
.
mergeNewListToOldList
(
newList
,
currentList
,
inDirectory
,
indexOfFile
);
},
},
mergeNewListToOldList
(
newList
,
oldList
,
inDirectory
,
indexOfFile
)
{
mergeNewListToOldList
(
newList
,
oldList
,
inDirectory
,
indexOfFile
)
{
newList
.
forEach
((
newFile
)
=>
{
newList
.
reverse
().
forEach
((
newFile
)
=>
{
const
fileIndex
=
indexOfFile
+
1
;
const
fileIndex
=
indexOfFile
+
1
;
const
file
=
newFile
;
const
file
=
newFile
;
file
.
level
=
inDirectory
.
level
+
1
;
file
.
level
=
inDirectory
.
level
+
1
;
...
@@ -93,6 +91,17 @@ const RepoHelper = {
...
@@ -93,6 +91,17 @@ const RepoHelper = {
return
oldList
;
return
oldList
;
},
},
compareFilesCaseInsensitive
(
a
,
b
)
{
const
aName
=
a
.
name
.
toLowerCase
();
const
bName
=
b
.
name
.
toLowerCase
();
if
(
a
.
level
>
0
)
return
0
;
if
(
aName
<
bName
)
return
-
1
;
if
(
aName
>
bName
)
return
1
;
return
0
;
},
getContent
(
treeOrFile
,
cb
)
{
getContent
(
treeOrFile
,
cb
)
{
let
file
=
treeOrFile
;
let
file
=
treeOrFile
;
// const loadingData = RepoHelper.setLoading(true);
// const loadingData = RepoHelper.setLoading(true);
...
...
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