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
Léo-Paul Géneau
gitlab-ce
Commits
e649ea2f
Commit
e649ea2f
authored
Oct 14, 2013
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Links in Readme in tree view.
parent
ace9ff4a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
5 deletions
+31
-5
app/helpers/gitlab_markdown_helper.rb
app/helpers/gitlab_markdown_helper.rb
+10
-3
features/project/source/markdown_render.feature
features/project/source/markdown_render.feature
+6
-1
features/steps/project/project_markdown_render.rb
features/steps/project/project_markdown_render.rb
+15
-1
No files found.
app/helpers/gitlab_markdown_helper.rb
View file @
e649ea2f
...
@@ -129,11 +129,18 @@ module GitlabMarkdownHelper
...
@@ -129,11 +129,18 @@ module GitlabMarkdownHelper
# Covering a special case, when the link is referencing file in the same directory eg:
# Covering a special case, when the link is referencing file in the same directory eg:
# If we are at doc/api/README.md and the README.md contains relative links like [Users](users.md)
# If we are at doc/api/README.md and the README.md contains relative links like [Users](users.md)
# this takes the request path(doc/api/README.md), and replaces the README.md with users.md so the path looks like doc/api/users.md
# this takes the request path(doc/api/README.md), and replaces the README.md with users.md so the path looks like doc/api/users.md
# If we are at doc/api and the README.md shown in below the tree view
# this takes the rquest path(doc/api) and adds users.md so the path looks like doc/api/users.md
def
build_nested_path
(
path
,
request_path
)
def
build_nested_path
(
path
,
request_path
)
return
path
unless
request_path
return
path
unless
request_path
base
=
request_path
.
split
(
"/"
)
if
local_path
(
request_path
)
==
"tree"
base
.
pop
base
=
request_path
.
split
(
"/"
).
push
(
path
)
(
base
+
[
path
]).
join
(
"/"
)
base
.
join
(
"/"
)
else
base
=
request_path
.
split
(
"/"
)
base
.
pop
base
.
push
(
path
).
join
(
"/"
)
end
end
end
def
file_exists?
(
path
)
def
file_exists?
(
path
)
...
...
features/project/source/markdown_render.feature
View file @
e649ea2f
...
@@ -72,4 +72,9 @@ Feature: Project markdown render
...
@@ -72,4 +72,9 @@ Feature: Project markdown render
Scenario
:
I
visit the help page with markdown
Scenario
:
I
visit the help page with markdown
Given
I visit to the help page
Given
I visit to the help page
And
I select a page with markdown
And
I select a page with markdown
Then
I should see a help page with markdown
Then
I should see a help page with markdown
\ No newline at end of file
Scenario
:
Tree view should have correct links in README
Given
I go directory which contains README file
And
I click on a relative link in README
Then
I should see the correct markdown
features/steps/project/project_markdown_render.rb
View file @
e649ea2f
...
@@ -162,4 +162,18 @@ class Spinach::Features::ProjectMarkdownRender < Spinach::FeatureSteps
...
@@ -162,4 +162,18 @@ class Spinach::Features::ProjectMarkdownRender < Spinach::FeatureSteps
Then
'I should see a help page with markdown'
do
Then
'I should see a help page with markdown'
do
page
.
should
have_content
"GitLab provides some specific rake tasks to enable special features or perform maintenance tasks"
page
.
should
have_content
"GitLab provides some specific rake tasks to enable special features or perform maintenance tasks"
end
end
end
\ No newline at end of file
Given
'I go directory which contains README file'
do
visit
project_tree_path
(
@project
,
"master/doc/api"
)
current_path
.
should
==
project_tree_path
(
@project
,
"master/doc/api"
)
end
And
'I click on a relative link in README'
do
click_link
"Users"
end
Then
'I should see the correct markdown'
do
current_path
.
should
==
project_blob_path
(
@project
,
"master/doc/api/users.md"
)
page
.
should
have_content
"List users"
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