Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #9084 from EverythingMe/bugfix-no-more-more
Browse files Browse the repository at this point in the history
[Bug 860230] Fix "More" menu when there are no more suggestions [r=crdlc](cherry picked from commit 57ff1b0)

Conflicts:
	apps/homescreen/everything.me/js/Brain.js
  • Loading branch information
evyatron committed Jun 2, 2013
1 parent 79ce12f commit 0923389
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 15 deletions.
40 changes: 25 additions & 15 deletions apps/homescreen/everything.me/js/Brain.js
Expand Up @@ -1239,24 +1239,34 @@ Evme.Brain = new function Evme_Brain() {
requestSuggest = Evme.DoATAPI.Shortcuts.suggest({
"existing": arrCurrentShortcuts
}, function onSuccess(data) {
var suggestedShortcuts = data.response.shortcuts,
icons = data.response.icons;
for (var id in icons) {
currentIcons[id] = icons[id];
var suggestedShortcuts = data.response.shortcuts || [],
icons = data.response.icons || {};

if(!isRequesting) {
return;
}

Evme.ShortcutsCustomize.load({
"shortcuts": suggestedShortcuts,
"icons": currentIcons
});


isFirstShow = false;
isRequesting = false;
Evme.ShortcutsCustomize.show();
// setting timeout to give the select box enough time to show
// otherwise there's visible flickering
window.setTimeout(Evme.ShortcutsCustomize.Loading.hide, 300);

if (suggestedShortcuts.length === 0) {
window.alert(Evme.Utils.l10n(L10N_SYSTEM_ALERT, 'no-more-shortcuts'));
Evme.ShortcutsCustomize.Loading.hide();
} else {
for (var id in icons) {
currentIcons[id] = icons[id];
}

Evme.ShortcutsCustomize.load({
"shortcuts": suggestedShortcuts,
"icons": currentIcons
});

Evme.ShortcutsCustomize.show();
// setting timeout to give the select box enough time to show
// otherwise there's visible flickering
window.setTimeout(Evme.ShortcutsCustomize.Loading.hide, 300);
}
});
});
});
Expand Down
4 changes: 4 additions & 0 deletions apps/homescreen/everything.me/js/api/DoATAPI.js
Expand Up @@ -355,6 +355,10 @@ Evme.DoATAPI = new function Evme_DoATAPI() {
// check if a list of shortcuts contain the given shortcut
// not a simple indexOf since a shortcut is either a query or an experienceId
function contains(shortcuts, shortcut) {
if (!shortcuts) {
return false;
}

for (var i=0,shortcutToCheck; shortcutToCheck=shortcuts[i++];) {
var experienceId1 = shortcutToCheck.experienceId,
experienceId2 = shortcut.experienceId,
Expand Down
1 change: 1 addition & 0 deletions apps/homescreen/locales/homescreen.en-US.properties
Expand Up @@ -49,6 +49,7 @@ evme-appsmore-loading=Loading…
evme-alert-app-install-confirm=Add {{name}} to Home Screen?
evme-alert-app-install-exists={{name}} was already added to Home Screen
evme-alert-offline-shortcuts-more=Connect to the internet to add more shortcuts
evme-alert-no-more-shortcuts=No Shortcuts to add
evme-banner-app-install-success={{name}} added to Home Screen

# Shortcuts - AKA smart folders - evme homepage
Expand Down

0 comments on commit 0923389

Please sign in to comment.