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
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
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
7 deletions
+16
-7
app/assets/javascripts/repo/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 = {
},
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
);
if
(
!
indexOfFile
)
return
newList
;
return
RepoHelper
.
mergeNewListToOldList
(
newList
,
currentList
,
inDirectory
,
indexOfFile
);
if
(
!
indexOfFile
)
return
newListSorted
;
return
RepoHelper
.
mergeNewListToOldList
(
newListSorted
,
currentList
,
inDirectory
,
indexOfFile
);
},
mergeNewListToOldList
(
newList
,
oldList
,
inDirectory
,
indexOfFile
)
{
newList
.
forEach
((
newFile
)
=>
{
newList
.
reverse
().
forEach
((
newFile
)
=>
{
const
fileIndex
=
indexOfFile
+
1
;
const
file
=
newFile
;
file
.
level
=
inDirectory
.
level
+
1
;
...
...
@@ -93,6 +91,17 @@ const RepoHelper = {
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
)
{
let
file
=
treeOrFile
;
// 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