Skip to content

Commit 4604a74

Browse files
nickvergessenskjnldsv
authored andcommitted
Fix navigation layout for items that are added on a re-render
Signed-off-by: Joas Schilling <coding@schilljs.com>
1 parent def8af3 commit 4604a74

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

core/css/header.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,7 @@ nav[role='navigation'] {
532532
overflow-y: hidden;
533533

534534
/* App icon */
535+
img,
535536
svg,
536537
.icon-more-white {
537538
transition: transform var(--animation-quick) ease;
@@ -553,6 +554,7 @@ nav[role='navigation'] {
553554
li {
554555
/* Move up app icon */
555556
svg,
557+
img,
556558
.icon-more,
557559
.icon-more-white,
558560
.icon-loading-small,

settings/js/apps.js

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,22 @@ OC.Settings.Apps = OC.Settings.Apps || {
3131
if (container.children('li[data-id="' + entry.id + '"]').length === 0) {
3232
var li = $('<li></li>');
3333
li.attr('data-id', entry.id);
34-
var img = '<svg width="16" height="16" viewBox="0 0 16 16">';
35-
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>';
36-
img += '<image x="0" y="0" width="16" height="16" preserveAspectRatio="xMinYMin meet" filter="url(#invert)" xlink:href="' + entry.icon + '" class="app-icon" /></svg>';
34+
var img = '<svg width="20" height="20" viewBox="0 0 20 20" alt="">';
35+
if (OCA.Theming && OCA.Theming.inverted) {
36+
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>';
37+
img += '<image x="0" y="0" width="20" height="20" preserveAspectRatio="xMinYMin meet" filter="url(#invert)" xlink:href="' + entry.icon + '" class="app-icon" />';
38+
} else {
39+
img += '<image x="0" y="0" width="20" height="20" preserveAspectRatio="xMinYMin meet" xlink:href="' + entry.icon + '" class="app-icon" />';
40+
}
41+
img += '</svg>';
3742
var a = $('<a></a>').attr('href', entry.href);
3843
var filename = $('<span></span>');
3944
var loading = $('<div class="icon-loading-dark"></div>').css('display', 'none');
40-
filename.text(entry.name);
41-
a.prepend(filename);
45+
filename.text(entry.name); filename.text(entry.name);
4246
a.prepend(loading);
4347
a.prepend(img);
4448
li.append(a);
49+
li.append(filename);
4550

4651
// add app icon to the navigation
4752
var previousElement = $('#navigation li[data-id=' + previousEntry.id + ']');
@@ -65,20 +70,23 @@ OC.Settings.Apps = OC.Settings.Apps || {
6570
if ($('#appmenu').children('li[data-id="' + entry.id + '"]').length === 0) {
6671
var li = $('<li></li>');
6772
li.attr('data-id', entry.id);
68-
var img = '<img src="' + entry.icon + '" class="app-icon">';
73+
// Generating svg embedded image (see layout.user.php)
74+
var img = '<svg width="20" height="20" viewBox="0 0 20 20" alt="">';
6975
if (OCA.Theming && OCA.Theming.inverted) {
70-
img = '<svg width="20" height="20" viewBox="0 0 20 20">';
7176
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>';
72-
img += '<image x="0" y="0" width="20" height="20" preserveAspectRatio="xMinYMin meet" filter="url(#invert)" xlink:href="' + entry.icon + '" class="app-icon" /></svg>';
77+
img += '<image x="0" y="0" width="20" height="20" preserveAspectRatio="xMinYMin meet" filter="url(#invert)" xlink:href="' + entry.icon + '" class="app-icon" />';
78+
} else {
79+
img += '<image x="0" y="0" width="20" height="20" preserveAspectRatio="xMinYMin meet" xlink:href="' + entry.icon + '" class="app-icon" />';
7380
}
81+
img += '</svg>';
7482
var a = $('<a></a>').attr('href', entry.href);
7583
var filename = $('<span></span>');
7684
var loading = $('<div class="icon-loading-dark"></div>').css('display', 'none');
7785
filename.text(entry.name);
78-
a.prepend(filename);
7986
a.prepend(loading);
8087
a.prepend(img);
8188
li.append(a);
89+
li.append(filename);
8290

8391
// add app icon to the navigation
8492
var previousElement = $('#appmenu li[data-id=' + previousEntry.id + ']');
@@ -102,4 +110,4 @@ OC.Settings.Apps = OC.Settings.Apps || {
102110
}
103111
});
104112
}
105-
};
113+
};

0 commit comments

Comments
 (0)