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
5607bb8f
Commit
5607bb8f
authored
Dec 18, 2016
by
Alex Braha Stoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change WikiPage#directory to always start a directory hierarchy with '/'
parent
904aa039
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
app/models/wiki_page.rb
app/models/wiki_page.rb
+2
-2
spec/models/wiki_page_spec.rb
spec/models/wiki_page_spec.rb
+2
-2
No files found.
app/models/wiki_page.rb
View file @
5607bb8f
...
@@ -89,7 +89,7 @@ class WikiPage
...
@@ -89,7 +89,7 @@ class WikiPage
# The hierarchy of the directory this page is contained in.
# The hierarchy of the directory this page is contained in.
def
directory
def
directory
dir
=
wiki
.
page_title_and_dir
(
slug
).
last
dir
=
wiki
.
page_title_and_dir
(
slug
).
last
dir
.
present?
?
dir
:
'/'
"/
#{
dir
}
"
end
end
# The processed/formatted content of this page.
# The processed/formatted content of this page.
...
@@ -106,7 +106,7 @@ class WikiPage
...
@@ -106,7 +106,7 @@ class WikiPage
# The full path for this page, including its filename and extension.
# The full path for this page, including its filename and extension.
def
full_path
def
full_path
"
/
#{
directory
}
/
#{
page
.
filename
}
"
.
gsub
(
/\/+/
,
'/'
)
"
#{
directory
}
/
#{
page
.
filename
}
"
.
gsub
(
/\/+/
,
'/'
)
end
end
# The commit message for this page version.
# The commit message for this page version.
...
...
spec/models/wiki_page_spec.rb
View file @
5607bb8f
...
@@ -27,7 +27,7 @@ describe WikiPage, models: true do
...
@@ -27,7 +27,7 @@ describe WikiPage, models: true do
page_2
=
wiki
.
find_page
(
'dir_1/page_2'
)
page_2
=
wiki
.
find_page
(
'dir_1/page_2'
)
page_3
=
wiki
.
find_page
(
'dir_1/dir_2/page_3'
)
page_3
=
wiki
.
find_page
(
'dir_1/dir_2/page_3'
)
expected_grouped_pages
=
{
expected_grouped_pages
=
{
'/'
=>
[
page_1
],
'
dir_1'
=>
[
page_2
],
'
dir_1/dir_2'
=>
[
page_3
]
'/'
=>
[
page_1
],
'
/dir_1'
=>
[
page_2
],
'/
dir_1/dir_2'
=>
[
page_3
]
}
}
grouped_pages
=
WikiPage
.
group_by_directory
(
wiki
.
pages
)
grouped_pages
=
WikiPage
.
group_by_directory
(
wiki
.
pages
)
...
@@ -239,7 +239,7 @@ describe WikiPage, models: true do
...
@@ -239,7 +239,7 @@ describe WikiPage, models: true do
create_page
(
'dir_1/dir_1_1/file'
,
'content'
)
create_page
(
'dir_1/dir_1_1/file'
,
'content'
)
page
=
wiki
.
find_page
(
'dir_1/dir_1_1/file'
)
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
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