X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=js%2Fcrm.menubar.js;h=a9177bb5b2ced16a5bcff09953e02aa41d9acc2c;hb=6c85ac1e7edf6c79d054ce9719f0d1f2da3ee1a2;hp=1d4f753838ae2549258e3b5906a8033446a7681a;hpb=d111a110d99397070c6f3ee38c9f1525c30eb767;p=civicrm-core.git diff --git a/js/crm.menubar.js b/js/crm.menubar.js index 1d4f753838..a9177bb5b2 100644 --- a/js/crm.menubar.js +++ b/js/crm.menubar.js @@ -336,7 +336,33 @@ CRM.menubar.open('QuickSearch'); } } - }); + }) + .autocomplete( "instance" )._renderItem = function( ul, item ) { + var uiMenuItemWrapper = $("
"); + if (item.value == 0) { + uiMenuItemWrapper.text(item.label); + } + else { + uiMenuItemWrapper.append($('') + .attr('href', CRM.url('civicrm/contact/view', {reset: 1, cid: item.value})) + .css({ display: 'block' }) + .text(item.label) + .click(function(e) { + if (e.ctrlKey || e.shiftKey || e.altKey) { + // Special-clicking lets you open several tabs. + e.stopPropagation(); + } + else { + // Fall back to original behaviour. + e.preventDefault(); + } + })); + } + + return $( "
  • " ) + .append(uiMenuItemWrapper) + .appendTo( ul ); + }; $('#crm-qsearch > a').keyup(function(e) { if ($(e.target).is(this)) { $('#crm-qsearch-input').focus(); @@ -365,10 +391,6 @@ var $selection = $('.crm-quickSearchField input:checked'), label = $selection.parent().text(), value = $selection.val(); - // These fields are not supported by advanced search - if (!value || value === 'first_name' || value === 'last_name') { - value = 'sort_name'; - } $('#crm-qsearch-input').attr({name: value, placeholder: '\uf002 ' + label}); } $('.crm-quickSearchField').click(function() {