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
Tatuya Kamada
gitlab-ce
Commits
07fd736d
Commit
07fd736d
authored
May 15, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce
parents
735fbb43
9c6f4a23
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
50 additions
and
33 deletions
+50
-33
CHANGELOG
CHANGELOG
+2
-0
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+12
-4
app/helpers/events_helper.rb
app/helpers/events_helper.rb
+2
-2
app/helpers/gitlab_markdown_helper.rb
app/helpers/gitlab_markdown_helper.rb
+8
-6
app/views/events/_event_issue.atom.haml
app/views/events/_event_issue.atom.haml
+1
-1
app/views/events/_event_merge_request.atom.haml
app/views/events/_event_merge_request.atom.haml
+1
-1
app/views/events/_event_note.atom.haml
app/views/events/_event_note.atom.haml
+1
-1
app/views/events/_event_push.atom.haml
app/views/events/_event_push.atom.haml
+1
-1
app/views/events/event/_note.html.haml
app/views/events/event/_note.html.haml
+1
-1
app/views/projects/commits/_head.html.haml
app/views/projects/commits/_head.html.haml
+1
-1
app/views/projects/merge_requests/show/_mr_ci.html.haml
app/views/projects/merge_requests/show/_mr_ci.html.haml
+6
-6
lib/gitlab/markdown.rb
lib/gitlab/markdown.rb
+9
-7
lib/redcarpet/render/gitlab_html.rb
lib/redcarpet/render/gitlab_html.rb
+4
-1
spec/helpers/gitlab_markdown_helper_spec.rb
spec/helpers/gitlab_markdown_helper_spec.rb
+1
-1
No files found.
CHANGELOG
View file @
07fd736d
...
...
@@ -64,6 +64,8 @@ v 7.11.0 (unreleased)
- Use SIGKILL by default in Sidekiq::MemoryKiller
- Fix mentioning of private groups.
- Add style for <kbd> element in markdown
- Spin spinner icon next to "Checking for CI status..." on MR page.
- Fix reference links in dashboard activity and ATOM feeds.
v 7.10.2
- Fix CI links on MR page
...
...
app/helpers/application_helper.rb
View file @
07fd736d
...
...
@@ -324,12 +324,20 @@ module ApplicationHelper
count
=
if
project
.
nil?
""
nil
elsif
current_controller?
(
:issues
)
" (
#{
project
.
issues
.
send
(
entity
).
count
}
)"
project
.
issues
.
send
(
entity
).
count
elsif
current_controller?
(
:merge_requests
)
" (
#{
project
.
merge_requests
.
send
(
entity
).
count
}
)"
project
.
merge_requests
.
send
(
entity
).
count
end
"
#{
entity_title
}#{
count
}
"
html
=
content_tag
:span
,
entity_title
if
count
.
present?
html
+=
" "
html
+=
content_tag
:span
,
number_with_delimiter
(
count
),
class:
'badge'
end
html
.
html_safe
end
end
app/helpers/events_helper.rb
View file @
07fd736d
...
...
@@ -168,8 +168,8 @@ module EventsHelper
end
end
def
event_note
(
text
)
text
=
first_line_in_markdown
(
text
,
150
)
def
event_note
(
text
,
options
=
{}
)
text
=
first_line_in_markdown
(
text
,
150
,
options
)
sanitize
(
text
,
tags:
%w(a img b pre code p span)
)
end
...
...
app/helpers/gitlab_markdown_helper.rb
View file @
07fd736d
...
...
@@ -19,7 +19,7 @@ module GitlabMarkdownHelper
escape_once
(
body
)
end
gfm_body
=
gfm
(
escaped_body
,
@project
,
html_options
)
gfm_body
=
gfm
(
escaped_body
,
{}
,
html_options
)
gfm_body
.
gsub!
(
%r{<a.*?>.*?</a>}m
)
do
|
match
|
"</a>
#{
match
}#{
link_to
(
""
,
url
,
html_options
)[
0
..-
5
]
}
"
# "</a>".length +1
...
...
@@ -32,11 +32,13 @@ module GitlabMarkdownHelper
unless
@markdown
&&
options
==
@options
@options
=
options
# see https://github.com/vmg/redcarpet#darling-i-packed-you-a-couple-renderers-for-lunch
rend
=
Redcarpet
::
Render
::
GitlabHTML
.
new
(
self
,
user_color_scheme_class
,
{
options
.
merge!
(
# Handled further down the line by Gitlab::Markdown::SanitizationFilter
escape_html:
false
}.
merge
(
options
))
)
# see https://github.com/vmg/redcarpet#darling-i-packed-you-a-couple-renderers-for-lunch
rend
=
Redcarpet
::
Render
::
GitlabHTML
.
new
(
self
,
user_color_scheme_class
,
options
)
# see https://github.com/vmg/redcarpet#and-its-like-really-simple-to-use
@markdown
=
Redcarpet
::
Markdown
.
new
(
rend
,
...
...
@@ -58,8 +60,8 @@ module GitlabMarkdownHelper
# as Markdown. HTML tags in the parsed output are not counted toward the
# +max_chars+ limit. If the length limit falls within a tag's contents, then
# the tag contents are truncated without removing the closing tag.
def
first_line_in_markdown
(
text
,
max_chars
=
nil
)
md
=
markdown
(
text
).
strip
def
first_line_in_markdown
(
text
,
max_chars
=
nil
,
options
=
{}
)
md
=
markdown
(
text
,
options
).
strip
truncate_visible
(
md
,
max_chars
||
md
.
length
)
if
md
.
present?
end
...
...
app/views/events/_event_issue.atom.haml
View file @
07fd736d
%div
{
xmlns:
"http://www.w3.org/1999/xhtml"
}
-
if
issue
.
description
.
present?
=
markdown
(
issue
.
description
,
xhtml:
true
)
=
markdown
(
issue
.
description
,
xhtml:
true
,
reference_only_path:
false
,
project:
issue
.
project
)
app/views/events/_event_merge_request.atom.haml
View file @
07fd736d
%div
{
xmlns:
"http://www.w3.org/1999/xhtml"
}
-
if
merge_request
.
description
.
present?
=
markdown
(
merge_request
.
description
,
xhtml:
true
)
=
markdown
(
merge_request
.
description
,
xhtml:
true
,
reference_only_path:
false
,
project:
merge_request
.
project
)
app/views/events/_event_note.atom.haml
View file @
07fd736d
%div
{
xmlns:
"http://www.w3.org/1999/xhtml"
}
=
markdown
(
note
.
note
,
xhtml:
true
)
=
markdown
(
note
.
note
,
xhtml:
true
,
reference_only_path:
false
,
project:
note
.
project
)
app/views/events/_event_push.atom.haml
View file @
07fd736d
...
...
@@ -6,7 +6,7 @@
%i
at
=
commit
[
:timestamp
].
to_time
.
to_s
(
:short
)
%blockquote
=
markdown
(
escape_once
(
commit
[
:message
]),
xhtml:
true
)
%blockquote
=
markdown
(
escape_once
(
commit
[
:message
]),
xhtml:
true
,
reference_only_path:
false
,
project:
note
.
project
)
-
if
event
.
commits_count
>
15
%p
%i
...
...
app/views/events/event/_note.html.haml
View file @
07fd736d
...
...
@@ -14,7 +14,7 @@
.event-note
.md
%i
.fa.fa-comment-o.event-note-icon
=
event_note
(
event
.
target
.
note
)
=
event_note
(
event
.
target
.
note
,
project:
event
.
project
)
-
note
=
event
.
target
-
if
note
.
attachment
.
url
-
if
note
.
attachment
.
image?
...
...
app/views/projects/commits/_head.html.haml
View file @
07fd736d
...
...
@@ -3,7 +3,7 @@
=
link_to
namespace_project_commits_path
(
@project
.
namespace
,
@project
,
@ref
||
@repository
.
root_ref
)
do
=
icon
(
"history"
)
Commits
%span
.badge
=
number_with_
precision
(
@repository
.
commit_count
,
precision:
0
,
delimiter:
','
)
%span
.badge
=
number_with_
delimiter
(
@repository
.
commit_count
)
=
nav_link
(
controller: :compare
)
do
=
link_to
namespace_project_compare_index_path
(
@project
.
namespace
,
@project
,
from:
@repository
.
root_ref
,
to:
@ref
||
@repository
.
root_ref
)
do
=
icon
(
"exchange"
)
...
...
app/views/projects/merge_requests/show/_mr_ci.html.haml
View file @
07fd736d
-
if
@commits
.
any?
.ci_widget.ci-success
{
style:
"display:none"
}
%i
.fa.fa-check
=
icon
(
"check"
)
%span
CI build passed
for
#{
@merge_request
.
last_commit_short_sha
}
.
=
link_to
"View build page"
,
ci_build_details_path
(
@merge_request
),
:"data-no-turbolink"
=>
"data-no-turbolink"
.ci_widget.ci-failed
{
style:
"display:none"
}
%i
.fa.fa-times
=
icon
(
"times"
)
%span
CI build failed
for
#{
@merge_request
.
last_commit_short_sha
}
.
=
link_to
"View build page"
,
ci_build_details_path
(
@merge_request
),
:"data-no-turbolink"
=>
"data-no-turbolink"
-
[
:running
,
:pending
].
each
do
|
status
|
.ci_widget
{
class:
"ci-#{status}"
,
style:
"display:none"
}
%i
.fa.fa-clock-o
=
icon
(
"clock-o"
)
%span
CI build
#{
status
}
for
#{
@merge_request
.
last_commit_short_sha
}
.
=
link_to
"View build page"
,
ci_build_details_path
(
@merge_request
),
:"data-no-turbolink"
=>
"data-no-turbolink"
.ci_widget
%i
.fa.fa-spinner
=
icon
(
"spinner spin"
)
Checking for CI status for
#{
@merge_request
.
last_commit_short_sha
}
.ci_widget.ci-canceled
{
style:
"display:none"
}
%i
.fa.fa-times
=
icon
(
"times"
)
%span
CI build canceled
for
#{
@merge_request
.
last_commit_short_sha
}
.
=
link_to
"View build page"
,
ci_build_details_path
(
@merge_request
),
:"data-no-turbolink"
=>
"data-no-turbolink"
.ci_widget.ci-error
{
style:
"display:none"
}
%i
.fa.fa-times
=
icon
(
"times"
)
%span
Cannot connect to the CI server. Please check your settings and try again.
lib/gitlab/markdown.rb
View file @
07fd736d
...
...
@@ -24,10 +24,10 @@ module Gitlab
# Public: Parse the provided text with GitLab-Flavored Markdown
#
# text - the source text
#
project - the project
#
options - options
# html_options - extra options for the reference links as given to link_to
def
gfm
(
text
,
project
=
@project
,
html_options
=
{})
gfm_with_options
(
text
,
{},
project
,
html_options
)
def
gfm
(
text
,
options
=
{}
,
html_options
=
{})
gfm_with_options
(
text
,
options
,
html_options
)
end
# Public: Parse the provided text with GitLab-Flavored Markdown
...
...
@@ -38,7 +38,7 @@ module Gitlab
# :reference_only_path - Use relative path for reference links
# project - the project
# html_options - extra options for the reference links as given to link_to
def
gfm_with_options
(
text
,
options
=
{},
project
=
@project
,
html_options
=
{})
def
gfm_with_options
(
text
,
options
=
{},
html_options
=
{})
return
text
if
text
.
nil?
# Duplicate the string so we don't alter the original, then call to_str
...
...
@@ -48,7 +48,9 @@ module Gitlab
options
.
reverse_merge!
(
xhtml:
false
,
reference_only_path:
true
reference_only_path:
true
,
project:
@project
,
current_user:
current_user
)
pipeline
=
HTML
::
Pipeline
.
new
(
filters
)
...
...
@@ -62,9 +64,9 @@ module Gitlab
no_header_anchors:
options
[
:no_header_anchors
],
# ReferenceFilter
current_user:
current_user
,
current_user:
options
[
:current_user
]
,
only_path:
options
[
:reference_only_path
],
project:
project
,
project:
options
[
:project
]
,
reference_class:
html_options
[
:class
],
# RelativeLinkFilter
...
...
lib/redcarpet/render/gitlab_html.rb
View file @
07fd736d
...
...
@@ -7,9 +7,12 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML
def
initialize
(
template
,
color_scheme
,
options
=
{})
@template
=
template
@color_scheme
=
color_scheme
@project
=
@template
.
instance_variable_get
(
"@project"
)
@options
=
options
.
dup
@options
.
reverse_merge!
(
project:
@template
.
instance_variable_get
(
"@project"
)
)
super
(
options
)
end
...
...
spec/helpers/gitlab_markdown_helper_spec.rb
View file @
07fd736d
...
...
@@ -21,7 +21,7 @@ describe GitlabMarkdownHelper do
describe
"#gfm"
do
it
"should forward HTML options to links"
do
expect
(
gfm
(
"Fixed in
#{
commit
.
id
}
"
,
@project
,
class:
'foo'
)).
expect
(
gfm
(
"Fixed in
#{
commit
.
id
}
"
,
{
project:
@project
}
,
class:
'foo'
)).
to
have_selector
(
'a.gfm.foo'
)
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