From 29956c5957702a0b8d345d5ebb4b70fc4ccb003f Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Tue, 17 Mar 2015 09:28:50 -0400 Subject: [PATCH] Api Explorer - Show marker for required fields --- templates/CRM/Admin/Page/APIExplorer.js | 10 ++++++++-- templates/CRM/Admin/Page/APIExplorer.tpl | 8 ++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/templates/CRM/Admin/Page/APIExplorer.js b/templates/CRM/Admin/Page/APIExplorer.js index b83eab833b..b28273168b 100644 --- a/templates/CRM/Admin/Page/APIExplorer.js +++ b/templates/CRM/Admin/Page/APIExplorer.js @@ -56,8 +56,14 @@ var $row = $('tr:last-child', '#api-params'); $('input.api-param-name', $row).crmSelect2({ data: fields.concat({id: '-', text: ts('Other') + '...', description: ts('Choose a field not in this list')}), + formatSelection: function(field) { + return field.text + + (field.required ? ' *' : ''); + }, formatResult: function(field) { - return field.text + '
' + field.description + '
'; + return field.text + + (field.required ? ' *' : '') + + '
' + field.description + '
'; } }).change(); } @@ -184,7 +190,7 @@ params.placeholder = ts('Select field'); params.multiple = false; } - $('#api-params').prepend($(returnTpl({title: title}))); + $('#api-params').prepend($(returnTpl({title: title, required: action == 'getvalue'}))); $('#api-return-value').crmSelect2(params); } diff --git a/templates/CRM/Admin/Page/APIExplorer.tpl b/templates/CRM/Admin/Page/APIExplorer.tpl index e6d5865e15..98cea80bc7 100644 --- a/templates/CRM/Admin/Page/APIExplorer.tpl +++ b/templates/CRM/Admin/Page/APIExplorer.tpl @@ -92,7 +92,8 @@ color: #828282; line-height: 1.3em; } - .select2-highlighted .api-field-desc { + .select2-highlighted .api-field-desc, + .select2-highlighted .crm-marker { color: #fcfcfc; } .api-param-op[readonly] { @@ -281,7 +282,10 @@