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
16b54178
Commit
16b54178
authored
Jan 16, 2013
by
Riyad Preukschas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use image Urls for Emoji in GFM
Fixes #2617
parent
7635afd0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
1 deletion
+10
-1
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+5
-0
lib/gitlab/markdown.rb
lib/gitlab/markdown.rb
+1
-1
spec/helpers/gitlab_markdown_helper_spec.rb
spec/helpers/gitlab_markdown_helper_spec.rb
+4
-0
No files found.
app/helpers/application_helper.rb
View file @
16b54178
...
@@ -156,4 +156,9 @@ module ApplicationHelper
...
@@ -156,4 +156,9 @@ module ApplicationHelper
image_tag
(
"authbuttons/
#{
file_name
}
"
,
image_tag
(
"authbuttons/
#{
file_name
}
"
,
alt:
"Sign in with
#{
provider
.
to_s
.
titleize
}
"
)
alt:
"Sign in with
#{
provider
.
to_s
.
titleize
}
"
)
end
end
def
image_url
(
source
)
root_url
+
path_to_image
(
source
)
end
alias_method
:url_to_image
,
:image_url
end
end
lib/gitlab/markdown.rb
View file @
16b54178
...
@@ -119,7 +119,7 @@ module Gitlab
...
@@ -119,7 +119,7 @@ module Gitlab
# parse emoji
# parse emoji
text
.
gsub!
(
EMOJI_PATTERN
)
do
|
match
|
text
.
gsub!
(
EMOJI_PATTERN
)
do
|
match
|
if
valid_emoji?
(
$2
)
if
valid_emoji?
(
$2
)
image_tag
(
"emoji/
#{
$2
}
.png"
,
class:
'emoji'
,
title:
$1
,
alt:
$1
,
size:
"20x20"
)
image_tag
(
url_to_image
(
"emoji/
#{
$2
}
.png"
)
,
class:
'emoji'
,
title:
$1
,
alt:
$1
,
size:
"20x20"
)
else
else
match
match
end
end
...
...
spec/helpers/gitlab_markdown_helper_spec.rb
View file @
16b54178
...
@@ -343,5 +343,9 @@ describe GitlabMarkdownHelper do
...
@@ -343,5 +343,9 @@ describe GitlabMarkdownHelper do
it
"should generate absolute urls for refs"
do
it
"should generate absolute urls for refs"
do
markdown
(
"#
#{
issue
.
id
}
"
).
should
include
(
project_issue_url
(
project
,
issue
))
markdown
(
"#
#{
issue
.
id
}
"
).
should
include
(
project_issue_url
(
project
,
issue
))
end
end
it
"should generate absolute urls for emoji"
do
markdown
(
":smile:"
).
should
include
(
"src=
\"
#{
url_to_image
(
"emoji/smile"
)
}
"
)
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