Commit 81a37ca1 authored by Phil Hughes's avatar Phil Hughes

Moved the title onto the emoji tag

This adds the description in all places emojis are used
parent 4bde6eae
...@@ -29,18 +29,11 @@ const categoryLabelMap = { ...@@ -29,18 +29,11 @@ const categoryLabelMap = {
flags: 'Flags', flags: 'Flags',
}; };
function createEmojiObject(alias) {
return {
alias,
description: emojiMap[alias].description,
};
};
function buildCategoryMap() { function buildCategoryMap() {
return Object.keys(emojiMap).reduce((currentCategoryMap, emojiNameKey) => { return Object.keys(emojiMap).reduce((currentCategoryMap, emojiNameKey) => {
const emojiInfo = emojiMap[emojiNameKey]; const emojiInfo = emojiMap[emojiNameKey];
if (currentCategoryMap[emojiInfo.category]) { if (currentCategoryMap[emojiInfo.category]) {
currentCategoryMap[emojiInfo.category].push(createEmojiObject(emojiNameKey)); currentCategoryMap[emojiInfo.category].push(emojiNameKey);
} }
return currentCategoryMap; return currentCategoryMap;
...@@ -62,10 +55,10 @@ function renderCategory(name, emojiList, opts = {}) { ...@@ -62,10 +55,10 @@ function renderCategory(name, emojiList, opts = {}) {
${name} ${name}
</h5> </h5>
<ul class="clearfix emoji-menu-list ${opts.menuListClass || ''}"> <ul class="clearfix emoji-menu-list ${opts.menuListClass || ''}">
${emojiList.map(emoji => ` ${emojiList.map(emojiName => `
<li class="emoji-menu-list-item"> <li class="emoji-menu-list-item">
<button class="emoji-menu-btn text-center js-emoji-btn" type="button" title="${emoji.description}"> <button class="emoji-menu-btn text-center js-emoji-btn" type="button">
${glEmojiTag(emoji.alias, { ${glEmojiTag(emojiName, {
sprite: true, sprite: true,
})} })}
</button> </button>
...@@ -505,7 +498,7 @@ AwardsHandler.prototype.getFrequentlyUsedEmojis = function getFrequentlyUsedEmoj ...@@ -505,7 +498,7 @@ AwardsHandler.prototype.getFrequentlyUsedEmojis = function getFrequentlyUsedEmoj
const frequentlyUsedEmojis = _.uniq((Cookies.get('frequently_used_emojis') || '').split(',')); const frequentlyUsedEmojis = _.uniq((Cookies.get('frequently_used_emojis') || '').split(','));
this.frequentlyUsedEmojis = frequentlyUsedEmojis.filter( this.frequentlyUsedEmojis = frequentlyUsedEmojis.filter(
inputName => isEmojiNameValid(inputName), inputName => isEmojiNameValid(inputName),
).map(emojiNameKey => createEmojiObject(emojiNameKey)); );
return this.frequentlyUsedEmojis; return this.frequentlyUsedEmojis;
})(); })();
......
...@@ -62,6 +62,7 @@ function glEmojiTag(inputName, options) { ...@@ -62,6 +62,7 @@ function glEmojiTag(inputName, options) {
data-fallback-src="${fallbackImageSrc}" data-fallback-src="${fallbackImageSrc}"
${fallbackSpriteAttribute} ${fallbackSpriteAttribute}
data-unicode-version="${emojiInfo.unicodeVersion}" data-unicode-version="${emojiInfo.unicodeVersion}"
title=${emojiInfo.description}
> >
${contents} ${contents}
</gl-emoji> </gl-emoji>
......
...@@ -54,7 +54,7 @@ module Gitlab ...@@ -54,7 +54,7 @@ module Gitlab
unicode_version: emoji_unicode_version(emoji_name) unicode_version: emoji_unicode_version(emoji_name)
} }
ActionController::Base.helpers.content_tag('gl-emoji', emoji_info['moji'], data: data) ActionController::Base.helpers.content_tag('gl-emoji', emoji_info['moji'], title: emoji_info['description'], data: data)
end end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment