diff options
author | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 13:34:23 -0600 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 13:34:23 -0600 |
commit | 6438df3a1e0fb944485cebf07976160184697d72 (patch) | |
tree | 00b09bfd170e77ae9391b1a2f5a93ef6839f2597 /app/assets/javascripts/awards_handler.js | |
parent | 42bcd54d971da7ef2854b896a7b34f4ef8601067 (diff) | |
download | gitlab-ce-6438df3a1e0fb944485cebf07976160184697d72.tar.gz |
Add latest changes from gitlab-org/gitlab@13-8-stable-eev13.8.0-rc42
Diffstat (limited to 'app/assets/javascripts/awards_handler.js')
-rw-r--r-- | app/assets/javascripts/awards_handler.js | 45 |
1 files changed, 17 insertions, 28 deletions
diff --git a/app/assets/javascripts/awards_handler.js b/app/assets/javascripts/awards_handler.js index d937060536a..22717a3f84c 100644 --- a/app/assets/javascripts/awards_handler.js +++ b/app/assets/javascripts/awards_handler.js @@ -56,13 +56,13 @@ export class AwardsHandler { } }, ); - this.registerEventListener('on', $parentEl, 'click', this.toggleButtonSelector, e => { + this.registerEventListener('on', $parentEl, 'click', this.toggleButtonSelector, (e) => { e.stopPropagation(); e.preventDefault(); this.showEmojiMenu($(e.currentTarget)); }); - this.registerEventListener('on', $('html'), 'click', e => { + this.registerEventListener('on', $('html'), 'click', (e) => { const $target = $(e.target); if (!$target.closest(`.${this.menuClass}`).length) { $('.js-awards-block.current').removeClass('current'); @@ -74,7 +74,7 @@ export class AwardsHandler { }); const emojiButtonSelector = `.js-awards-block .js-emoji-btn, .${this.menuClass} .js-emoji-btn`; - this.registerEventListener('on', $parentEl, 'click', emojiButtonSelector, e => { + this.registerEventListener('on', $parentEl, 'click', emojiButtonSelector, (e) => { e.preventDefault(); const $target = $(e.currentTarget); const $glEmojiElement = $target.find('gl-emoji'); @@ -98,10 +98,7 @@ export class AwardsHandler { showEmojiMenu($addBtn) { if ($addBtn.hasClass('js-note-emoji')) { - $addBtn - .closest('.note') - .find('.js-awards-block') - .addClass('current'); + $addBtn.closest('.note').find('.js-awards-block').addClass('current'); } else { $addBtn.closest('.js-awards-block').addClass('current'); } @@ -193,7 +190,7 @@ export class AwardsHandler { (promiseChain, categoryNameKey) => promiseChain.then( () => - new Promise(resolve => { + new Promise((resolve) => { const emojisInCategory = categoryMap[categoryNameKey]; const categoryMarkup = this.renderCategory( categoryLabelMap[categoryNameKey], @@ -216,7 +213,7 @@ export class AwardsHandler { menu.dispatchEvent(new CustomEvent('build-emoji-menu-finish')); } }) - .catch(err => { + .catch((err) => { emojiContentElement.insertAdjacentHTML( 'beforeend', '<p>We encountered an error while adding the remaining categories</p>', @@ -233,7 +230,7 @@ export class AwardsHandler { <ul class="clearfix emoji-menu-list ${opts.menuListClass || ''}"> ${emojiList .map( - emojiName => ` + (emojiName) => ` <li class="emoji-menu-list-item"> <button class="emoji-menu-btn text-center js-emoji-btn" type="button"> ${this.emoji.glEmojiTag(emojiName, { @@ -466,7 +463,7 @@ export class AwardsHandler { const className = 'pulse animated once short'; $emoji.addClass(className); - this.registerEventListener('on', $emoji, animationEndEventString, e => { + this.registerEventListener('on', $emoji, animationEndEventString, (e) => { $(e.currentTarget).removeClass(className); }); } @@ -518,7 +515,7 @@ export class AwardsHandler { this.frequentlyUsedEmojis || (() => { const frequentlyUsedEmojis = uniq((Cookies.get('frequently_used_emojis') || '').split(',')); - this.frequentlyUsedEmojis = frequentlyUsedEmojis.filter(inputName => + this.frequentlyUsedEmojis = frequentlyUsedEmojis.filter((inputName) => this.emoji.isEmojiNameValid(inputName), ); @@ -530,15 +527,13 @@ export class AwardsHandler { setupSearch() { const $search = $('.js-emoji-menu-search'); - this.registerEventListener('on', $search, 'input', e => { - const term = $(e.target) - .val() - .trim(); + this.registerEventListener('on', $search, 'input', (e) => { + const term = $(e.target).val().trim(); this.searchEmojis(term); }); const $menu = $(`.${this.menuClass}`); - this.registerEventListener('on', $menu, transitionEndEventString, e => { + this.registerEventListener('on', $menu, transitionEndEventString, (e) => { if (e.target === e.currentTarget) { // Clear the search this.searchEmojis(''); @@ -556,17 +551,11 @@ export class AwardsHandler { // Generate a search result block const h5 = $('<h5 class="emoji-search-title"/>').text('Search results'); const foundEmojis = this.findMatchingEmojiElements(term).show(); - const ul = $('<ul>') - .addClass('emoji-menu-list emoji-menu-search') - .append(foundEmojis); + const ul = $('<ul>').addClass('emoji-menu-list emoji-menu-search').append(foundEmojis); $('.emoji-menu-content ul, .emoji-menu-content h5').hide(); - $('.emoji-menu-content') - .append(h5) - .append(ul); + $('.emoji-menu-content').append(h5).append(ul); } else { - $('.emoji-menu-content') - .children() - .show(); + $('.emoji-menu-content').children().show(); } } @@ -594,7 +583,7 @@ export class AwardsHandler { } hideMenuElement($emojiMenu) { - $emojiMenu.on(transitionEndEventString, e => { + $emojiMenu.on(transitionEndEventString, (e) => { if (e.currentTarget === e.target) { // eslint-disable-next-line @gitlab/no-global-event-off $emojiMenu.removeClass(IS_RENDERED).off(transitionEndEventString); @@ -605,7 +594,7 @@ export class AwardsHandler { } destroy() { - this.eventListeners.forEach(entry => { + this.eventListeners.forEach((entry) => { entry.element.off.call(entry.element, ...entry.args); }); $(`.${this.menuClass}`).remove(); |