Module: Gitlab::Emoji
Constant Summary collapse
- EMOJI_VERSION =
When updating emoji assets increase the version below and update the version number in `app/assets/javascripts/emoji/index.js`
2
Instance Method Summary collapse
- #custom_emoji_tag(name, image_source) ⇒ Object
- #emoji_image_tag(name, src) ⇒ Object
-
#emoji_public_absolute_path ⇒ Pathname
Return a Pathname to emoji's current versioned folder.
-
#gl_emoji_tag(emoji, options = {}) ⇒ Object
CSS sprite fallback takes precedence over image fallback.
Instance Method Details
#custom_emoji_tag(name, image_source) ⇒ Object
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/gitlab/emoji.rb', line 47 def custom_emoji_tag(name, image_source) data = { name: name, fallback_src: image_source, unicode_version: 'custom' # Prevents frontend to check for Unicode support } = { title: name, data: data } ActionController::Base.helpers.content_tag('gl-emoji', "", ) end |
#emoji_image_tag(name, src) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/gitlab/emoji.rb', line 18 def emoji_image_tag(name, src) = { class: 'emoji', src: src, title: ":#{name}:", alt: ":#{name}:", height: 20, width: 20, align: 'absmiddle' } ActionController::Base.helpers.tag(:img, ) end |
#emoji_public_absolute_path ⇒ Pathname
Return a Pathname to emoji's current versioned folder
14 15 16 |
# File 'lib/gitlab/emoji.rb', line 14 def emoji_public_absolute_path Rails.root.join("public/-/emojis/#{EMOJI_VERSION}") end |
#gl_emoji_tag(emoji, options = {}) ⇒ Object
CSS sprite fallback takes precedence over image fallback
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/gitlab/emoji.rb', line 35 def gl_emoji_tag(emoji, = {}) return unless emoji data = { name: emoji.name, unicode_version: emoji.unicode_version } = { title: emoji.description, data: data }.merge() ActionController::Base.helpers.content_tag('gl-emoji', emoji.codepoints, ) end |