From 9575981900dd2ae8b7e8bfafcd02db1d1146a971 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Wed, 14 Dec 2016 09:27:41 -0500 Subject: [PATCH] API Explorer: Remove redundant clear button for selected options --- templates/CRM/Admin/Page/APIExplorer.js | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/templates/CRM/Admin/Page/APIExplorer.js b/templates/CRM/Admin/Page/APIExplorer.js index 9efeafe13f..1343980621 100644 --- a/templates/CRM/Admin/Page/APIExplorer.js +++ b/templates/CRM/Admin/Page/APIExplorer.js @@ -150,6 +150,7 @@ var $row = $('tr:last-child', '#api-params'); $('input.api-param-name', $row).crmSelect2({ data: selectFields, + allowClear: false, formatSelection: function(field) { return field.text + (field.required ? ' *' : ''); @@ -172,16 +173,19 @@ $('#api-params').append($(optionsTpl({}))); } var $row = $('.api-options-row:last', '#api-params'); - $('.api-option-name', $row).crmSelect2({data: [ - {id: 'limit', text: 'limit'}, - {id: 'offset', text: 'offset'}, - {id: 'match', text: 'match'}, - {id: 'match-mandatory', text: 'match-mandatory'}, - {id: 'metadata', text: 'metadata'}, - {id: 'reload', text: 'reload'}, - {id: 'sort', text: 'sort'}, - {id: '-', text: ts('Other') + '...'} - ]}) + $('.api-option-name', $row).crmSelect2({ + data: [ + {id: 'limit', text: 'limit'}, + {id: 'offset', text: 'offset'}, + {id: 'match', text: 'match'}, + {id: 'match-mandatory', text: 'match-mandatory'}, + {id: 'metadata', text: 'metadata'}, + {id: 'reload', text: 'reload'}, + {id: 'sort', text: 'sort'}, + {id: '-', text: ts('Other') + '...'} + ], + allowClear: false + }) .select2('open'); } @@ -197,6 +201,7 @@ ($(item.element).hasClass('strikethrough') ? '' + item.text + '' : item.text); }, placeholder: ' ' + ts('Entity'), + allowClear: false, escapeMarkup: function(m) {return m;} }) .select2('open'); -- 2.25.1