diff options
author | Phil Hughes <me@iamphill.com> | 2017-01-03 16:31:43 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-02-09 09:16:52 +0000 |
commit | cd5bee0d4438e4bb5158b721580cec8687e95e93 (patch) | |
tree | 16f3dcc1fb82f30cf1a0bde970e12259e2796cce /app/assets/javascripts/new_branch_form.js | |
parent | 059d1ae4c847aa9018c89900b39c2782aa9b623e (diff) | |
download | gitlab-ce-cd5bee0d4438e4bb5158b721580cec8687e95e93.tar.gz |
Removed jQuery UI highlight & autocompleteremove-jquery-ui-plugins
In an effort to tackle #18437 this removes 2 of the jQuery UI plugins. Highlight & autocomplete, both used once in our code. Highlight was just removed easily, autocomplete was replaced with GL dropdown
Diffstat (limited to 'app/assets/javascripts/new_branch_form.js')
-rw-r--r-- | app/assets/javascripts/new_branch_form.js | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/app/assets/javascripts/new_branch_form.js b/app/assets/javascripts/new_branch_form.js index 7f763c13b50..7c508446859 100644 --- a/app/assets/javascripts/new_branch_form.js +++ b/app/assets/javascripts/new_branch_form.js @@ -1,4 +1,4 @@ -/* eslint-disable func-names, space-before-function-paren, no-var, one-var, prefer-rest-params, max-len, vars-on-top, wrap-iife, consistent-return, comma-dangle, one-var-declaration-per-line, quotes, no-return-assign, prefer-arrow-callback, prefer-template, no-shadow, no-else-return, max-len */ +/* eslint-disable func-names, space-before-function-paren, no-var, one-var, prefer-rest-params, max-len, vars-on-top, wrap-iife, consistent-return, comma-dangle, one-var-declaration-per-line, quotes, no-return-assign, prefer-arrow-callback, prefer-template, no-shadow, no-else-return, max-len, object-shorthand */ (function() { var bind = function(fn, me) { return function() { return fn.apply(me, arguments); }; }, indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i += 1) { if (i in this && this[i] === item) return i; } return -1; }; @@ -20,15 +20,35 @@ }; NewBranchForm.prototype.init = function() { - if (this.name.val().length > 0) { + if (this.name.length && this.name.val().length > 0) { return this.name.trigger('blur'); } }; NewBranchForm.prototype.setupAvailableRefs = function(availableRefs) { - return this.ref.autocomplete({ - source: availableRefs, - minLength: 1 + var $branchSelect = $('.js-branch-select'); + + $branchSelect.glDropdown({ + data: availableRefs, + filterable: true, + filterByText: true, + remote: false, + fieldName: $branchSelect.data('field-name'), + selectable: true, + isSelectable: function(branch, $el) { + return !$el.hasClass('is-active'); + }, + text: function(branch) { + return branch; + }, + id: function(branch) { + return branch; + }, + toggleLabel: function(branch) { + if (branch) { + return branch; + } + } }); }; |