diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-23 15:10:26 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-23 15:10:26 +0300 |
commit | 5c9f6c66fabf22927e862b2b60362e4ea25b250b (patch) | |
tree | 6ff391dcb7fdd3126f71af9fa4ca5e776a9ecbe3 /app/assets/javascripts/deprecated_jquery_dropdown | |
parent | 65fdda8d39a9af414dbe5aa3a385b9bcba00960b (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/deprecated_jquery_dropdown')
4 files changed, 9 insertions, 29 deletions
diff --git a/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown.js b/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown.js index fe57dd2dc8f..3d35ab2432f 100644 --- a/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown.js +++ b/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown.js @@ -123,10 +123,7 @@ export class GitLabDropdown { if ($(this.el).is('input')) { currentIndex = -1; } else { - $(selector, this.dropdown) - .first() - .find('a') - .addClass('is-focused'); + $(selector, this.dropdown).first().find('a').addClass('is-focused'); currentIndex = 0; } } @@ -493,10 +490,7 @@ export class GitLabDropdown { if (!this.options.multiSelect || el.hasClass('dropdown-clear-active')) { this.dropdown.find(`.${ACTIVE_CLASS}`).removeClass(ACTIVE_CLASS); if (!isInput) { - this.dropdown - .parent() - .find(`input[name='${fieldName}']`) - .remove(); + this.dropdown.parent().find(`input[name='${fieldName}']`).remove(); } } if (field && field.length && value == null) { @@ -536,10 +530,7 @@ export class GitLabDropdown { $(`input[name="${fieldName}"]`).remove(); } - const $input = $('<input>') - .attr('type', 'hidden') - .attr('name', fieldName) - .val(value); + const $input = $('<input>').attr('type', 'hidden').attr('name', fieldName).val(value); if (this.options.inputId != null) { $input.attr('id', this.options.inputId); } @@ -678,9 +669,7 @@ export class GitLabDropdown { toggleText = this.options.updateLabel; } - return $(this.el) - .find('.dropdown-toggle-text') - .text(toggleText); + return $(this.el).find('.dropdown-toggle-text').text(toggleText); } // eslint-disable-next-line class-methods-use-this diff --git a/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown_filter.js b/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown_filter.js index 89ffb5f5f79..7b69a5f6308 100644 --- a/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown_filter.js +++ b/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown_filter.js @@ -22,10 +22,7 @@ export class GitLabDropdownFilter { // Clear click e.preventDefault(); e.stopPropagation(); - return this.input - .val('') - .trigger('input') - .focus(); + return this.input.val('').trigger('input').focus(); }); // Key events timeout = ''; @@ -113,7 +110,7 @@ export class GitLabDropdownFilter { const elements = this.options.elements(); if (searchText) { // eslint-disable-next-line func-names - elements.each(function() { + elements.each(function () { const $el = $(this); const matches = fuzzaldrinPlus.match($el.text().trim(), searchText); if (!$el.is('.dropdown-header')) { diff --git a/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown_input.js b/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown_input.js index d857071d05f..29185bb5a4d 100644 --- a/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown_input.js +++ b/app/assets/javascripts/deprecated_jquery_dropdown/gl_dropdown_input.js @@ -9,10 +9,7 @@ export class GitLabDropdownInput { // Clear click e.preventDefault(); e.stopPropagation(); - return this.input - .val('') - .trigger('input') - .focus(); + return this.input.val('').trigger('input').focus(); }); this.input @@ -31,10 +28,7 @@ export class GitLabDropdownInput { .toLowerCase() // replace non alphanumeric .replace(/(-)\1+/g, '-'); // replace repeated dashes this.cb(this.options.fieldName, val, {}, true); - this.input - .closest('.dropdown') - .find('.dropdown-toggle-text') - .text(val); + this.input.closest('.dropdown').find('.dropdown-toggle-text').text(val); }); } diff --git a/app/assets/javascripts/deprecated_jquery_dropdown/index.js b/app/assets/javascripts/deprecated_jquery_dropdown/index.js index 90e7f15b5b7..6a3d2026192 100644 --- a/app/assets/javascripts/deprecated_jquery_dropdown/index.js +++ b/app/assets/javascripts/deprecated_jquery_dropdown/index.js @@ -3,7 +3,7 @@ import { GitLabDropdown } from './gl_dropdown'; export default function initDeprecatedJQueryDropdown($el, opts) { // eslint-disable-next-line func-names - return $el.each(function() { + return $el.each(function () { if (!$.data(this, 'deprecatedJQueryDropdown')) { $.data(this, 'deprecatedJQueryDropdown', new GitLabDropdown(this, opts)); } |