From: Effy Elden Date: Sun, 22 May 2016 05:19:32 +0000 (-0400) Subject: CRM-18652 - Show 'no matches' if quick search returns no results X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=106bb5dacd374708eaf44163696d4990c5419a5f;p=civicrm-core.git CRM-18652 - Show 'no matches' if quick search returns no results ---------------------------------------- * CRM-18652: Quick search should provide feedback to user if no matches are found https://issues.civicrm.org/jira/browse/CRM-18652 --- diff --git a/templates/CRM/common/navigation.js.tpl b/templates/CRM/common/navigation.js.tpl index fdce48e01b..54cbe9c313 100644 --- a/templates/CRM/common/navigation.js.tpl +++ b/templates/CRM/common/navigation.js.tpl @@ -103,10 +103,12 @@ $('#civicrm-menu').ready(function() { }; CRM.api3('contact', 'getquick', params).done(function(result) { var ret = []; - if (result.values) { + if (result.values.length > 0) { $.each(result.values, function(k, v) { ret.push({value: v.id, label: v.data}); - }) + }); + } else { + ret.push({value: '0', label: 'No matches'}); } response(ret); }) @@ -115,7 +117,9 @@ $('#civicrm-menu').ready(function() { return false; }, select: function (event, ui) { - document.location = CRM.url('civicrm/contact/view', {reset: 1, cid: ui.item.value}); + if (ui.item.value > 0) { + document.location = CRM.url('civicrm/contact/view', {reset: 1, cid: ui.item.value}); + } return false; }, create: function() {