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
539b4192
Commit
539b4192
authored
Jan 07, 2016
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Milestone reference is a Markdown link
parent
b38eabda
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
3 deletions
+8
-3
app/models/milestone.rb
app/models/milestone.rb
+5
-1
spec/fixtures/markdown.md.erb
spec/fixtures/markdown.md.erb
+0
-1
spec/lib/banzai/filter/milestone_reference_filter_spec.rb
spec/lib/banzai/filter/milestone_reference_filter_spec.rb
+3
-1
No files found.
app/models/milestone.rb
View file @
539b4192
...
...
@@ -71,8 +71,12 @@ class Milestone < ActiveRecord::Base
end
def
to_reference
(
from_project
=
nil
)
escaped_title
=
self
.
title
.
gsub
(
"]"
,
"
\\
]"
)
h
=
Gitlab
::
Application
.
routes
.
url_helpers
h
.
namespace_project_milestone_url
(
self
.
project
.
namespace
,
self
.
project
,
self
)
url
=
h
.
namespace_project_milestone_url
(
self
.
project
.
namespace
,
self
.
project
,
self
)
"[
#{
escaped_title
}
](
#{
url
}
)"
end
def
reference_link_text
(
from_project
=
nil
)
...
...
spec/fixtures/markdown.md.erb
View file @
539b4192
...
...
@@ -219,7 +219,6 @@ References should be parseable even inside _<%= merge_request.to_reference %>_ e
- Milestone:
<%=
milestone
.
to_reference
%>
- Milestone in another project:
<%=
xmilestone
.
to_reference
(
project
)
%>
- Ignored in code: `
<%=
milestone
.
to_reference
%>
`
- Ignored in links: [Link to
<%=
milestone
.
to_reference
%>
](#milestone-link)
- Link to milestone by URL: [Milestone](
<%=
urls
.
namespace_project_milestone_url
(
milestone
.
project
.
namespace
,
milestone
.
project
,
milestone
)
%>
)
### Task Lists
...
...
spec/lib/banzai/filter/milestone_reference_filter_spec.rb
View file @
539b4192
...
...
@@ -18,7 +18,9 @@ describe Banzai::Filter::MilestoneReferenceFilter, lib: true do
end
context
'internal reference'
do
let
(
:reference
)
{
milestone
.
to_reference
}
# Convert the Markdown link to only the URL, since these tests aren't run through the regular Markdown pipeline.
# Milestone reference behavior in the full Markdown pipeline is tested elsewhere.
let
(
:reference
)
{
milestone
.
to_reference
.
gsub
(
/\[([^\]]+)\]\(([^)]+)\)/
,
'\2'
)
}
it
'links to a valid reference'
do
doc
=
reference_filter
(
"See
#{
reference
}
"
)
...
...
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