mirror of
https://github.com/ansible/awx.git
synced 2026-03-07 03:31:10 -03:30
Merge pull request #399 from jaredevantabor/inventory-source-select2-fix
Removing search field on select2 fields used in inventory sources tab.
This commit is contained in:
@@ -695,25 +695,26 @@ 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++) {
|
||||
|
||||
@@ -1117,15 +1117,18 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
||||
html += buildId(field, fld, this.form);
|
||||
html += (options.mode === 'edit' && field.editRequired) ? "required " : "";
|
||||
html += (options.mode === 'add' && field.addRequired) ? "required " : "";
|
||||
//used for select2 combo boxes
|
||||
html += (field.multiSelect) ? "multiple " : "";
|
||||
html += (field.readonly) ? "disabled " : "";
|
||||
html += (field.awRequiredWhen) ? "data-awrequired-init=\"" + field.awRequiredWhen.init + "\" aw-required-when=\"" +
|
||||
field.awRequiredWhen.variable + "\" " : "";
|
||||
html += ">\n";
|
||||
html += "<option value=\"\">";
|
||||
// Add a custom default select 'value' (default text)
|
||||
html += (field.defaultText) ? field.defaultText : "Choose a " + field.label.toLowerCase();
|
||||
html += "</option>\n";
|
||||
if(!field.multiSelect){
|
||||
html += "<option value=\"\">";
|
||||
// Add a custom default select 'value' (default text)
|
||||
html += (field.defaultText) ? field.defaultText : "Choose a " + field.label.toLowerCase();
|
||||
html += "</option>\n";
|
||||
}
|
||||
html += "</select>\n";
|
||||
// Add error messages
|
||||
if ((options.mode === 'add' && field.addRequired) || (options.mode === 'edit' && field.editRequired) ||
|
||||
|
||||
Reference in New Issue
Block a user