From 3a9e5e69c6d079b3c2a5b383057ae924f1eea490 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Tue, 11 Feb 2014 11:56:37 -0800 Subject: [PATCH] CRM-13966 - Style select2 results with description field --- api/v3/Contact.php | 4 ++-- api/v3/Generic/Getlist.php | 2 +- css/civicrm.css | 21 +++++++++++++++++++++ js/Common.js | 4 ++-- 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/api/v3/Contact.php b/api/v3/Contact.php index 8dd4f7750d..4053530654 100644 --- a/api/v3/Contact.php +++ b/api/v3/Contact.php @@ -918,7 +918,7 @@ function _civicrm_api3_contact_getlist_params(&$request) { if(!in_array($searchField, $list)) { $list[] = $searchField; } - $request['params']['options']['return'] = $list; + $request['params']['return'] = $list; $request['params']['options']['sort'] = 'sort_name'; // Contact api doesn't support array(LIKE => 'foo') syntax $request['params'][$request['search_field']] = $request['input']; @@ -941,7 +941,7 @@ function _civicrm_api3_contact_getlist_output($result, $request) { 'label' => $row[$request['label_field']], ); $description = array(); - foreach ($request['params']['options']['return'] as $item) { + foreach ($request['params']['return'] as $item) { if (!strpos($item, '_name') && !empty($row[$item])) { $description[] = $row[$item]; } diff --git a/api/v3/Generic/Getlist.php b/api/v3/Generic/Getlist.php index 3d181b7917..c3388f9471 100644 --- a/api/v3/Generic/Getlist.php +++ b/api/v3/Generic/Getlist.php @@ -128,7 +128,7 @@ function _civicrm_api3_generic_getlist_params(&$request) { if (!empty($request['description_field'])) { $fieldsToReturn[] = $request['description_field']; } - $request['params']['options']['return'] = $fieldsToReturn; + $request['params']['return'] = $fieldsToReturn; } /** diff --git a/css/civicrm.css b/css/civicrm.css index 85ce033c6d..b333cefcb5 100644 --- a/css/civicrm.css +++ b/css/civicrm.css @@ -3835,6 +3835,27 @@ div.m ul#civicrm-menu, .crm-container .select2-dropdown-open .select2-choice .select2-arrow b { background-position: -18px 1px; } +/* Style autocomplete results */ +.select2-results table.crm-select2-row, +.select2-results table.crm-select2-row tbody, +.select2-results table.crm-select2-row tr, +.select2-results table.crm-select2-row td { + border: 0 none; + padding: 0; + margin: 0; + border-collapse: collapse; +} +.select2-results table.crm-select2-row .crm-select2-row-label { + font-size: 1.1em; +} +.select2-results table.crm-select2-row .crm-select2-row-description { + font-size: 0.8em; + line-height: 1.5em; + color: #696969; +} +.select2-results .select2-highlighted table.crm-select2-row .crm-select2-row-description { + color: #f0f0f0; +} /* Special styling for specific form buttons */ #crm-container span.crm-button_qf_Main_upload input, diff --git a/js/Common.js b/js/Common.js index d2bdace84b..6ec6e97e1c 100644 --- a/js/Common.js +++ b/js/Common.js @@ -276,9 +276,9 @@ CRM.validate = CRM.validate || { CRM.utils.formatSelect2Result = function(row) { var markup = ''; if (row.image !== undefined) { - markup += ''; + markup += ''; } - markup += '
' + row.label + '
'; + markup += '
' + row.label + '
'; markup += '
' + (row.description || '') + '
'; markup += '
'; return markup; -- 2.25.1