diff options
author | Julius Härtl <jus@bitgrid.net> | 2018-07-03 12:14:34 +0200 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2018-07-03 12:14:39 +0200 |
commit | 7b87e00db1314a72d0878492a0cdda3d88182b8d (patch) | |
tree | 59b423002371fa8a257ccb70f19d1baebb698924 /settings/js | |
parent | aa64584d679d0d5836ce2e08197d58fe2f8f4a86 (diff) | |
download | nextcloud-server-7b87e00db1314a72d0878492a0cdda3d88182b8d.tar.gz nextcloud-server-7b87e00db1314a72d0878492a0cdda3d88182b8d.zip |
Properly insert app icons into navigation
If the app menu is rebuild with the first icon being updated, the whole
list was empty, therefore we need a fallback to properly insert the
element then.
Fixes https://github.com/nextcloud/dashboard/issues/10
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'settings/js')
-rw-r--r-- | settings/js/apps.js | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/settings/js/apps.js b/settings/js/apps.js index e860f1dbed1..c9b1ea6b8d4 100644 --- a/settings/js/apps.js +++ b/settings/js/apps.js @@ -6,7 +6,7 @@ OC.Settings.Apps = OC.Settings.Apps || { if(response.ocs.meta.status === 'ok') { var addedApps = {}; var navEntries = response.ocs.data; - var container = $('#apps ul'); + var container = $('#navigation #apps'); // remove disabled apps for (var i = 0; i < navEntries.length; i++) { @@ -43,7 +43,13 @@ OC.Settings.Apps = OC.Settings.Apps || { a.prepend(img); li.append(a); - $('#navigation li[data-id=' + previousEntry.id + ']').after(li); + // add app icon to the navigation + var previousElement = $('#navigation li[data-id=' + previousEntry.id + ']'); + if (previousElement.length > 0) { + previousElement.after(li); + } else { + $('#navigation #apps').prepend(li); + } // draw attention to the newly added app entry // by flashing twice the more apps menu @@ -73,7 +79,15 @@ OC.Settings.Apps = OC.Settings.Apps || { a.prepend(loading); a.prepend(img); li.append(a); - $('#appmenu li[data-id='+ previousEntry.id+']').after(li); + + // add app icon to the navigation + var previousElement = $('#appmenu li[data-id=' + previousEntry.id + ']'); + if (previousElement.length > 0) { + previousElement.after(li); + } else { + $('#appmenu').prepend(li); + } + if(addedApps[entry.id]) { li.animate({opacity: 0.5}) .animate({opacity: 1}) |