From 106bb5dacd374708eaf44163696d4990c5419a5f Mon Sep 17 00:00:00 2001 From: Effy Elden Date: Sun, 22 May 2016 01:19:32 -0400 Subject: [PATCH] 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 --- templates/CRM/common/navigation.js.tpl | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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() { -- 2.25.1