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
77fe503a
Commit
77fe503a
authored
Dec 25, 2016
by
Alex Braha Stoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove WikiPage.sort_by_directory
parent
645aaf6e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
22 deletions
+2
-22
app/models/wiki_page.rb
app/models/wiki_page.rb
+2
-22
No files found.
app/models/wiki_page.rb
View file @
77fe503a
...
...
@@ -17,10 +17,10 @@ class WikiPage
# pages - an array of WikiPage objects.
#
# Returns a hash whose keys are directories and whose values are WikiPage
# arrays.
See WikiPage.sort_by_directory for more info about the ordering.
# arrays.
def
self
.
group_by_directory
(
pages
)
return
{}
if
pages
.
blank?
pages
=
sort_by_directory
(
pages
)
pages
=
pages
.
sort_by
{
|
page
|
[
page
.
directory
,
page
.
slug
]
}
directories
=
{}
pages
.
each
do
|
page
|
...
...
@@ -206,26 +206,6 @@ class WikiPage
private
# Sorts an array of pages by directory and file alphabetical order.
# Pages at the root directory will come first. The next pages will be
# sorted by their directories. Within directories, pages are sorted by
# filename alphabetical order. Pages are sorted in such a fashion that
# nested directories will always follow their parents (e.g. pages in
# dir_1/nested_dir_1 will follow pages inside dir_1).
#
# pages - an array of WikiPage objects.
#
# Returns a sorted array of WikiPage objects.
def
self
.
sort_by_directory
(
pages
)
pages
.
sort
do
|
page
,
next_page
|
if
page
.
directory
==
next_page
.
directory
page
.
slug
<=>
next_page
.
slug
else
page
.
directory
<=>
next_page
.
directory
end
end
end
def
set_attributes
attributes
[
:slug
]
=
@page
.
url_path
attributes
[
:title
]
=
@page
.
title
...
...
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