Merge "Immediately provide default suggestions based on 0 results."

This commit is contained in:
Catrope 2012-11-30 17:27:59 +00:00 committed by Gerrit Code Review
commit d96b6a9622
2 changed files with 19 additions and 15 deletions

View file

@ -125,20 +125,19 @@
}
// Opens the MultiSuggest dropdown.
function open() {
if ( !visible ) {
// Call input method if cached value is stale
if (
$input.val() !== '' &&
$input.val() !== currentInput
) {
onInput();
} else {
// Show if there are suggestions.
if ( $multiSuggest.children().length > 0 ) {
visible = true;
$multiSuggest.show();
}
}
// Call onInput if cached value is stale
if (
$input.val() !== '' &&
$input.val() !== currentInput
) {
onInput();
}
if (
!visible &&
$multiSuggest.children().length > 0
) {
$multiSuggest.show();
visible = true;
}
}
// Closes the dropdown.

View file

@ -337,7 +337,12 @@ ve.ui.LinkInspector.prototype.initMultiSuggest = function () {
'results': suggestionCache[cKey]
} );
} else {
// No cache, build fresh api request.
// Load immediate suggestions
callback( {
'query': query,
'results': []
} );
// Build from fresh api request.
api.get( {
'action': 'opensearch',
'search': query