Skip to content

Commit

Permalink
Merge pull request #570 from nextcloud/stable9-fix-theme-logo-position
Browse files Browse the repository at this point in the history
[stable9] fix theme logo position
  • Loading branch information
William Bargent authored Jul 27, 2016
2 parents fa361ba + 608dbc6 commit 9002673
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
10 changes: 5 additions & 5 deletions apps/theming/js/settings-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ function preview(setting, value) {
console.log(setting);
var logos = document.getElementsByClassName('logo-icon');
var timestamp = new Date().getTime();
if(value !== '') {
logos[0].style.background = "url('" + OC.generateUrl('/apps/theming/logo') + "?v" + timestamp + "')";
logos[0].style.backgroundSize = "62px 34px";
if (value !== '') {
logos[0].style.backgroundImage = "url('" + OC.generateUrl('/apps/theming/logo') + "?v" + timestamp + "')";
logos[0].style.backgroundSize = "contain";
} else {
logos[0].style.background = "url('" + OC.getRootPath() + '/core/img/logo-icon.svg?v' + timestamp +"')";
logos[0].style.backgroundSize = "62px 34px";
logos[0].style.backgroundImage = "url('" + OC.getRootPath() + '/core/img/logo-icon.svg?v' + timestamp +"')";
logos[0].style.backgroundSize = "contain";
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion apps/theming/lib/controller/themingcontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,11 @@ public function getStylesheet() {
if($logo !== '') {
$responseCss .= sprintf('#header .logo {
background-image: url(\'./logo?v='.$cacheBusterValue.'\');
background-size: contain;
}
#header .logo-icon {
background-image: url(\'./logo?v='.$cacheBusterValue.'\');
background-size: 62px 34px;
background-size: contain;
}'
);
}
Expand Down
6 changes: 4 additions & 2 deletions apps/theming/tests/lib/controller/ThemingControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -355,10 +355,11 @@ public function testGetStylesheetWithOnlyHeaderLogo() {

$expected = new Http\DataDownloadResponse('#header .logo {
background-image: url(\'./logo?v=0\');
background-size: contain;
}
#header .logo-icon {
background-image: url(\'./logo?v=0\');
background-size: 62px 34px;
background-size: contain;
}', 'style', 'text/css');
$expected->cacheFor(3600);
@$this->assertEquals($expected, $this->themingController->getStylesheet());
Expand Down Expand Up @@ -417,10 +418,11 @@ public function testGetStylesheetWithAllCombined() {

$expected = new Http\DataDownloadResponse('#body-user #header,#body-settings #header,#body-public #header {background-color: #abc}#header .logo {
background-image: url(\'./logo?v=0\');
background-size: contain;
}
#header .logo-icon {
background-image: url(\'./logo?v=0\');
background-size: 62px 34px;
background-size: contain;
}#body-login {
background-image: url(\'./loginbackground?v=0\');
}', 'style', 'text/css');
Expand Down
3 changes: 2 additions & 1 deletion core/css/header.css
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
background-image: url('../img/logo-icon.svg?v=1');
background-repeat: no-repeat;
background-size: 175px;
background-position: center 30px;
background-position: center;
width: 252px;
height: 120px;
margin: 0 auto;
Expand All @@ -82,6 +82,7 @@
display: inline-block;
background-image: url('../img/logo-icon.svg?v=1');
background-repeat: no-repeat;
background-position: center center;
width: 62px;
height: 34px;
}
Expand Down

0 comments on commit 9002673

Please sign in to comment.