From 70c750dacc5636f81c38878ddaf463ff397a6a66 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Tue, 16 May 2017 15:53:54 +0200 Subject: [PATCH 1/2] Fix logo being too big on log in page, fix #4585 Signed-off-by: Jan-Christoph Borchardt --- apps/theming/css/theming.scss | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apps/theming/css/theming.scss b/apps/theming/css/theming.scss index 2d0afa2d29..6057a15f42 100644 --- a/apps/theming/css/theming.scss +++ b/apps/theming/css/theming.scss @@ -44,7 +44,6 @@ /* override styles for login screen in guest.css */ #header .logo, #header .logo-icon { - background-size: contain; background-image: url(#{$image-logo}); } @@ -111,4 +110,4 @@ input.primary { } } } -} \ No newline at end of file +} From 52f10c436e98733a552d8e2ab7a03a68653a2215 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Fri, 19 May 2017 16:11:42 +0200 Subject: [PATCH 2/2] Scale logo only for custom ones MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- apps/theming/css/theming.scss | 3 +++ apps/theming/lib/ThemingDefaults.php | 2 ++ apps/theming/tests/ThemingDefaultsTest.php | 14 +++++++++----- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/apps/theming/css/theming.scss b/apps/theming/css/theming.scss index 6057a15f42..ac303f61a6 100644 --- a/apps/theming/css/theming.scss +++ b/apps/theming/css/theming.scss @@ -45,6 +45,9 @@ #header .logo, #header .logo-icon { background-image: url(#{$image-logo}); + @if $theming-logo-mime != '' { + background-size: contain; + } } #body-login, diff --git a/apps/theming/lib/ThemingDefaults.php b/apps/theming/lib/ThemingDefaults.php index 0824a36ccd..2b3be1e641 100644 --- a/apps/theming/lib/ThemingDefaults.php +++ b/apps/theming/lib/ThemingDefaults.php @@ -192,6 +192,8 @@ class ThemingDefaults extends \OC_Defaults { $variables = [ 'theming-cachebuster' => "'" . $this->config->getAppValue('theming', 'cachebuster', '0') . "'", + 'theming-logo-mime' => "'" . $this->config->getAppValue('theming', 'logoMime', '') . "'", + 'theming-background-mime' => "'" . $this->config->getAppValue('theming', 'backgroundMime', '') . "'" ]; $variables['image-logo'] = "'".$this->urlGenerator->getAbsoluteURL($this->getLogo())."'"; diff --git a/apps/theming/tests/ThemingDefaultsTest.php b/apps/theming/tests/ThemingDefaultsTest.php index a7cb7790aa..8646eaf865 100644 --- a/apps/theming/tests/ThemingDefaultsTest.php +++ b/apps/theming/tests/ThemingDefaultsTest.php @@ -499,12 +499,14 @@ class ThemingDefaultsTest extends TestCase { public function testGetScssVariables() { $this->config->expects($this->at(0))->method('getAppValue')->with('theming', 'cachebuster', '0')->willReturn('0'); $this->config->expects($this->at(1))->method('getAppValue')->with('theming', 'logoMime', false)->willReturn('jpeg'); - $this->config->expects($this->at(2))->method('getAppValue')->with('theming', 'cachebuster', '0')->willReturn('0'); - $this->config->expects($this->at(3))->method('getAppValue')->with('theming', 'backgroundMime', false)->willReturn('jpeg'); + $this->config->expects($this->at(2))->method('getAppValue')->with('theming', 'backgroundMime', false)->willReturn('jpeg'); + $this->config->expects($this->at(3))->method('getAppValue')->with('theming', 'logoMime', false)->willReturn('jpeg'); $this->config->expects($this->at(4))->method('getAppValue')->with('theming', 'cachebuster', '0')->willReturn('0'); - $this->config->expects($this->at(5))->method('getAppValue')->with('theming', 'color', null)->willReturn($this->defaults->getColorPrimary()); - $this->config->expects($this->at(6))->method('getAppValue')->with('theming', 'color', $this->defaults->getColorPrimary())->willReturn($this->defaults->getColorPrimary()); - $this->config->expects($this->at(7))->method('getAppValue')->with('theming', 'color', $this->defaults->getColorPrimary())->willReturn($this->defaults->getColorPrimary()); + $this->config->expects($this->at(5))->method('getAppValue')->with('theming', 'backgroundMime', false)->willReturn('jpeg'); + $this->config->expects($this->at(6))->method('getAppValue')->with('theming', 'cachebuster', '0')->willReturn('0'); + $this->config->expects($this->at(7))->method('getAppValue')->with('theming', 'color', null)->willReturn($this->defaults->getColorPrimary()); + $this->config->expects($this->at(8))->method('getAppValue')->with('theming', 'color', $this->defaults->getColorPrimary())->willReturn($this->defaults->getColorPrimary()); + $this->config->expects($this->at(9))->method('getAppValue')->with('theming', 'color', $this->defaults->getColorPrimary())->willReturn($this->defaults->getColorPrimary()); $this->util->expects($this->any())->method('invertTextColor')->with($this->defaults->getColorPrimary())->willReturn(false); $this->cache->expects($this->once())->method('get')->with('getScssVariables')->willReturn(null); @@ -530,6 +532,8 @@ class ThemingDefaultsTest extends TestCase { $expected = [ 'theming-cachebuster' => '\'0\'', + 'theming-logo-mime' => '\'jpeg\'', + 'theming-background-mime' => '\'jpeg\'', 'image-logo' => "'absolute-custom-logo?v=0'", 'image-login-background' => "'absolute-custom-background?v=0'", 'color-primary' => $this->defaults->getColorPrimary(),