Fix adding/removing apps
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
parent
7548825743
commit
673b58ef09
1 changed files with 6 additions and 19 deletions
|
@ -487,22 +487,22 @@ OC.Settings.Apps = OC.Settings.Apps || {
|
|||
container.children('li[data-id]').each(function (index, el) {
|
||||
var id = $(el).data('id');
|
||||
// remove all apps that are not in the correct order
|
||||
if ((navEntries[index] && navEntries[index].id !== $(el).data('id'))) {
|
||||
if (!navEntries[index] || (navEntries[index] && navEntries[index].id !== $(el).data('id'))) {
|
||||
$(el).remove();
|
||||
$('#appmenu li[data-id='+id+']').remove();
|
||||
}
|
||||
});
|
||||
|
||||
var previousEntry;
|
||||
var previousEntry = {};
|
||||
// add enabled apps to #navigation and #appmenu
|
||||
for (var i = 0; i < navEntries.length; i++) {
|
||||
var entry = navEntries[i];
|
||||
if (container.children('li[data-id="' + entry.id + '"]').length === 0) {
|
||||
var li = $('<li></li>');
|
||||
li.attr('data-id', entry.id);
|
||||
var img = '<svg width="32" height="32" viewBox="0 0 32 32">';
|
||||
var img = '<svg width="16" height="16" viewBox="0 0 16 16">';
|
||||
img += '<defs><filter id="invert"><feColorMatrix in="SourceGraphic" type="matrix" values="-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 0 0 0 1 0" /></filter></defs>';
|
||||
img += '<image x="0" y="0" width="32" height="32" preserveAspectRatio="xMinYMin meet" filter="url(#invert)" xlink:href="' + entry.icon + '" class="app-icon" /></svg>';
|
||||
img += '<image x="0" y="0" width="16" height="16" preserveAspectRatio="xMinYMin meet" filter="url(#invert)" xlink:href="' + entry.icon + '" class="app-icon" /></svg>';
|
||||
var a = $('<a></a>').attr('href', entry.href);
|
||||
var filename = $('<span></span>');
|
||||
var loading = $('<div class="icon-loading-dark"></div>').css('display', 'none');
|
||||
|
@ -526,9 +526,7 @@ OC.Settings.Apps = OC.Settings.Apps || {
|
|||
}
|
||||
}
|
||||
|
||||
if ($('#appmenu ul').children('li[data-id="' + entry.id + '"]').length === 0) {
|
||||
// add apps to #appmenu until it is full
|
||||
if ($('#appmenu li').not('.hidden').length < 8) {
|
||||
if ($('#appmenu').children('li[data-id="' + entry.id + '"]').length === 0) {
|
||||
var li = $('<li></li>');
|
||||
li.attr('data-id', entry.id);
|
||||
var img = '<img src="' + entry.icon + '" class="app-icon">';
|
||||
|
@ -547,22 +545,11 @@ OC.Settings.Apps = OC.Settings.Apps || {
|
|||
.animate({opacity: 0.5})
|
||||
.animate({opacity: 1});
|
||||
}
|
||||
}
|
||||
}
|
||||
previousEntry = entry;
|
||||
// do not show apps from #appmenu in #navigation
|
||||
if(i <= 7) {
|
||||
$('#navigation li').eq(i).addClass('in-header');
|
||||
} else {
|
||||
$('#navigation li').eq(i).removeClass('in-header');
|
||||
}
|
||||
}
|
||||
|
||||
if (navEntries.length > 8) {
|
||||
$('#more-apps').show();
|
||||
} else {
|
||||
$('#more-apps').hide();
|
||||
}
|
||||
$(window).trigger('resize');
|
||||
}
|
||||
});
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue