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
Jérome Perrin
gitlab-ce
Commits
d2b3fe45
Commit
d2b3fe45
authored
Dec 27, 2016
by
Alex Braha Stoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change WikiPage#directory
parent
104bfa2a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
8 deletions
+7
-8
app/models/wiki_page.rb
app/models/wiki_page.rb
+4
-5
spec/models/wiki_page_spec.rb
spec/models/wiki_page_spec.rb
+3
-3
No files found.
app/models/wiki_page.rb
View file @
d2b3fe45
...
...
@@ -25,10 +25,10 @@ class WikiPage
pages
.
sort_by
{
|
page
|
[
page
.
directory
,
page
.
slug
]
}.
group_by
{
|
page
|
page
.
directory
}.
map
do
|
dir
,
pages
|
if
dir
==
'/'
pages
else
if
dir
.
present?
WikiDirectory
.
new
(
dir
,
pages
)
else
pages
end
end
.
flatten
...
...
@@ -98,8 +98,7 @@ class WikiPage
# The hierarchy of the directory this page is contained in.
def
directory
dir
=
wiki
.
page_title_and_dir
(
slug
).
last
"/
#{
dir
}
"
wiki
.
page_title_and_dir
(
slug
).
last
end
# The processed/formatted content of this page.
...
...
spec/models/wiki_page_spec.rb
View file @
d2b3fe45
...
...
@@ -252,11 +252,11 @@ describe WikiPage, models: true do
describe
'#directory'
do
context
'when the page is at the root directory'
do
it
'returns
/
'
do
it
'returns
an empty string
'
do
create_page
(
'file'
,
'content'
)
page
=
wiki
.
find_page
(
'file'
)
expect
(
page
.
directory
).
to
eq
(
'
/
'
)
expect
(
page
.
directory
).
to
eq
(
''
)
end
end
...
...
@@ -265,7 +265,7 @@ describe WikiPage, models: true do
create_page
(
'dir_1/dir_1_1/file'
,
'content'
)
page
=
wiki
.
find_page
(
'dir_1/dir_1_1/file'
)
expect
(
page
.
directory
).
to
eq
(
'
/
dir_1/dir_1_1'
)
expect
(
page
.
directory
).
to
eq
(
'dir_1/dir_1_1'
)
end
end
end
...
...
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