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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
b9928280
Commit
b9928280
authored
Nov 10, 2016
by
Fu Xu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix error links in help page
parent
0c99e5d0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
2 deletions
+44
-2
app/controllers/help_controller.rb
app/controllers/help_controller.rb
+2
-2
changelogs/unreleased/fix-help-page-links.yml
changelogs/unreleased/fix-help-page-links.yml
+4
-0
spec/controllers/help_controller_spec.rb
spec/controllers/help_controller_spec.rb
+38
-0
No files found.
app/controllers/help_controller.rb
View file @
b9928280
...
...
@@ -7,8 +7,8 @@ class HelpController < ApplicationController
@help_index
=
File
.
read
(
Rails
.
root
.
join
(
'doc'
,
'README.md'
))
# Prefix Markdown links with `help/` unless they already have been
# See http://rubular.com/r/
nwwhzH6Z8X
@help_index
.
gsub!
(
/(\]\()(
?!help\/)([^\)\(]+)(\))/
,
'\1help/\2
\3'
)
# See http://rubular.com/r/
ie2MlpdUMq
@help_index
.
gsub!
(
/(\]\()(
\/?help\/)?([^\)\(]+\))/
,
'\1/help/
\3'
)
end
def
show
...
...
changelogs/unreleased/fix-help-page-links.yml
0 → 100644
View file @
b9928280
---
title
:
Fix error links in help index page
merge_request
:
7396
author
:
Fu Xu
spec/controllers/help_controller_spec.rb
View file @
b9928280
...
...
@@ -7,6 +7,40 @@ describe HelpController do
sign_in
(
user
)
end
describe
'GET #index'
do
context
'when url prefixed without /help/'
do
it
'has correct url prefix'
do
stub_readme
(
"[API](api/README.md)"
)
get
:index
expect
(
assigns
[
:help_index
]).
to
eq
'[API](/help/api/README.md)'
end
end
context
'when url prefixed with help/'
do
it
'will be an absolute path'
do
stub_readme
(
"[API](help/api/README.md)"
)
get
:index
expect
(
assigns
[
:help_index
]).
to
eq
'[API](/help/api/README.md)'
end
end
context
'when url prefixed with help'
do
it
'will be an absolute path'
do
stub_readme
(
"[API](helpful_hints/README.md)"
)
get
:index
expect
(
assigns
[
:help_index
]).
to
eq
'[API](/help/helpful_hints/README.md)'
end
end
context
'when url prefixed with /help/'
do
it
'will not be changed'
do
stub_readme
(
"[API](/help/api/README.md)"
)
get
:index
expect
(
assigns
[
:help_index
]).
to
eq
'[API](/help/api/README.md)'
end
end
end
describe
'GET #show'
do
context
'for Markdown formats'
do
context
'when requested file exists'
do
...
...
@@ -72,4 +106,8 @@ describe HelpController do
end
end
end
def
stub_readme
(
content
)
allow
(
File
).
to
receive
(
:read
).
and_return
(
content
)
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