Skip to content

Commit cb10ca5

Browse files
authored
Merge pull request #569 from nextcloud/stable10-fix-theme-logo-position
[stable10] fix theme logo position
2 parents 010a8b4 + db755d7 commit cb10ca5

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

apps/theming/js/settings-admin.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ function preview(setting, value) {
7575
var logos = document.getElementsByClassName('logo-icon');
7676
var timestamp = new Date().getTime();
7777
if (value !== '') {
78-
logos[0].style.background = "url('" + OC.generateUrl('/apps/theming/logo') + "?v" + timestamp + "')";
79-
logos[0].style.backgroundSize = "62px 34px";
78+
logos[0].style.backgroundImage = "url('" + OC.generateUrl('/apps/theming/logo') + "?v" + timestamp + "')";
79+
logos[0].style.backgroundSize = "contain";
8080
} else {
81-
logos[0].style.background = "url('" + OC.getRootPath() + '/core/img/logo-icon.svg?v' + timestamp +"')";
82-
logos[0].style.backgroundSize = "62px 34px";
81+
logos[0].style.backgroundImage = "url('" + OC.getRootPath() + '/core/img/logo-icon.svg?v' + timestamp +"')";
82+
logos[0].style.backgroundSize = "contain";
8383
}
8484
}
8585
}

apps/theming/lib/controller/themingcontroller.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,11 @@ public function getStylesheet() {
224224
if($logo !== '') {
225225
$responseCss .= sprintf('#header .logo {
226226
background-image: url(\'./logo?v='.$cacheBusterValue.'\');
227+
background-size: contain;
227228
}
228229
#header .logo-icon {
229230
background-image: url(\'./logo?v='.$cacheBusterValue.'\');
230-
background-size: 62px 34px;
231+
background-size: contain;
231232
}'
232233
);
233234
}

apps/theming/tests/lib/controller/ThemingControllerTest.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -383,10 +383,11 @@ public function testGetStylesheetWithOnlyHeaderLogo() {
383383

384384
$expected = new Http\DataDownloadResponse('#header .logo {
385385
background-image: url(\'./logo?v=0\');
386+
background-size: contain;
386387
}
387388
#header .logo-icon {
388389
background-image: url(\'./logo?v=0\');
389-
background-size: 62px 34px;
390+
background-size: contain;
390391
}', 'style', 'text/css');
391392
$expected->cacheFor(3600);
392393
@$this->assertEquals($expected, $this->themingController->getStylesheet());
@@ -445,10 +446,11 @@ public function testGetStylesheetWithAllCombined() {
445446

446447
$expected = new Http\DataDownloadResponse('#body-user #header,#body-settings #header,#body-public #header {background-color: #000}#header .logo {
447448
background-image: url(\'./logo?v=0\');
449+
background-size: contain;
448450
}
449451
#header .logo-icon {
450452
background-image: url(\'./logo?v=0\');
451-
background-size: 62px 34px;
453+
background-size: contain;
452454
}#body-login {
453455
background-image: url(\'./loginbackground?v=0\');
454456
}', 'style', 'text/css');
@@ -479,10 +481,11 @@ public function testGetStylesheetWithAllCombinedInverted() {
479481

480482
$expected = new Http\DataDownloadResponse('#body-user #header,#body-settings #header,#body-public #header {background-color: #fff}#header .logo {
481483
background-image: url(\'./logo?v=0\');
484+
background-size: contain;
482485
}
483486
#header .logo-icon {
484487
background-image: url(\'./logo?v=0\');
485-
background-size: 62px 34px;
488+
background-size: contain;
486489
}#body-login {
487490
background-image: url(\'./loginbackground?v=0\');
488491
}#header .header-appname, #expandDisplayName { color: #000000; } #header .icon-caret { background-image: url(\'' . \OC::$WEBROOT . '/core/img/actions/caret-dark.svg\'); } .searchbox input[type="search"] { background: transparent url(\'' . \OC::$WEBROOT . '/core/img/actions/search.svg\') no-repeat 6px center; color: #000; }.searchbox input[type="search"]:focus,.searchbox input[type="search"]:active,.searchbox input[type="search"]:valid { color: #000; border: 1px solid rgba(0, 0, 0, .5); }', 'style', 'text/css');

core/css/header.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
background-image: url('../img/logo-icon.svg');
7272
background-repeat: no-repeat;
7373
background-size: 175px;
74-
background-position: center 30px;
74+
background-position: center;
7575
width: 252px;
7676
height: 120px;
7777
margin: 0 auto;
@@ -82,6 +82,7 @@
8282
display: inline-block;
8383
background-image: url('../img/logo-icon.svg');
8484
background-repeat: no-repeat;
85+
background-position: center center;
8586
width: 62px;
8687
height: 34px;
8788
}

0 commit comments

Comments
 (0)