From a5731a5452751c77ef3e3aedbc0bb409a3616400 Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Tue, 1 Sep 2015 17:49:23 -0700 Subject: [PATCH] Removing search field on select2 fields used in inventory sources tab. This also fixes the behavior when the user hits escape while the select2 drop down menu is visible. --- awx/ui/client/src/shared/Utilities.js | 28 ++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/awx/ui/client/src/shared/Utilities.js b/awx/ui/client/src/shared/Utilities.js index d8233a316c..6d05ed7933 100644 --- a/awx/ui/client/src/shared/Utilities.js +++ b/awx/ui/client/src/shared/Utilities.js @@ -695,25 +695,27 @@ angular.module('Utilities', ['RestServices', 'Utilities', 'sanitizeFilter']) options = params.opts; $.fn.select2.amd.require([ - "select2/utils", - "select2/dropdown", - "select2/dropdown/attachContainer", - "select2/dropdown/search", - ], function (Utils, DropdownAdapter, AttachContainer, DropdownSearch) { + 'select2/utils', + 'select2/dropdown', + 'select2/dropdown/search', + 'select2/dropdown/attachContainer', + 'select2/dropdown/closeOnSelect', + 'select2/dropdown/minimumResultsForSearch' + ], function (Utils, Dropdown, Search, AttachContainer, CloseOnSelect, MinimumResultsForSearch) { - var CustomAdapter = Utils.Decorate( - Utils.Decorate( - DropdownAdapter, - DropdownSearch - ), - AttachContainer - ); + var CustomAdapter = + _.reduce([Search, AttachContainer, CloseOnSelect, MinimumResultsForSearch], + function(Adapter, Decorator) { + return Utils.Decorate(Adapter, Decorator); + }, Dropdown); $(element).select2({ dropdownAdapter: CustomAdapter, multiple: 'true', theme: "bootstrap", - width: '100%' + width: '100%', + minimumResultsForSearch: Infinity, + dropdownAdapter: CustomAdapter }); if(options){ for (var d = 0; d < $(element + " option").length; d++) {