From 15220e8ff8627c43c3304016588d1958352a5fe7 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Sun, 5 Jun 2016 15:54:33 -0600 Subject: [PATCH] CRM-18652 - Improve style of no-results item --- css/civicrmNavigation.css | 9 +++++++++ templates/CRM/common/navigation.js.tpl | 8 +++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/css/civicrmNavigation.css b/css/civicrmNavigation.css index c5c94c2c38..c257260a54 100644 --- a/css/civicrmNavigation.css +++ b/css/civicrmNavigation.css @@ -162,3 +162,12 @@ li.menu-separator{ #civicrm-menu > li.menumain { height: 19px !important; } + +/* No results */ +.crm-quickSearch-results.ui-menu-disabled { + opacity: .9; + background-color: #f8f8f8; +} +.crm-quickSearch-results.ui-menu-disabled li { + cursor: default; +} diff --git a/templates/CRM/common/navigation.js.tpl b/templates/CRM/common/navigation.js.tpl index d762766970..06129b3686 100644 --- a/templates/CRM/common/navigation.js.tpl +++ b/templates/CRM/common/navigation.js.tpl @@ -104,10 +104,12 @@ $('#civicrm-menu').ready(function() { CRM.api3('contact', 'getquick', params).done(function(result) { var ret = []; if (result.values.length > 0) { + $('#sort_name_navigation').autocomplete('widget').menu('option', 'disabled', false); $.each(result.values, function(k, v) { ret.push({value: v.id, label: v.data}); }); } else { + $('#sort_name_navigation').autocomplete('widget').menu('option', 'disabled', true); ret.push({value: '0', label: {/literal}'{ts escape='js'}None found.{/ts}'{literal}}); } response(ret); @@ -119,14 +121,14 @@ $('#civicrm-menu').ready(function() { select: function (event, ui) { if (ui.item.value > 0) { document.location = CRM.url('civicrm/contact/view', {reset: 1, cid: ui.item.value}); - } else { - document.location = CRM.url('civicrm/contact/search/advanced', {reset: 1}); } return false; }, create: function() { // Place menu in front - $(this).autocomplete('widget').css('z-index', $('#civicrm-menu').css('z-index')); + $(this).autocomplete('widget') + .addClass('crm-quickSearch-results') + .css('z-index', $('#civicrm-menu').css('z-index')); } }) .keydown(function() { -- 2.25.1