]> source.dussan.org Git - nextcloud-server.git/commitdiff
Scale logo only for custom ones 4976/head
authorJulius Härtl <jus@bitgrid.net>
Fri, 19 May 2017 14:11:42 +0000 (16:11 +0200)
committerJulius Härtl <jus@bitgrid.net>
Fri, 19 May 2017 19:01:41 +0000 (21:01 +0200)
Signed-off-by: Julius Härtl <jus@bitgrid.net>
apps/theming/css/theming.scss
apps/theming/lib/ThemingDefaults.php
apps/theming/tests/ThemingDefaultsTest.php

index 6057a15f4252364b8caabc26de625b471289dab3..ac303f61a6b7fca27e7f6454423f71f510c2a7d7 100644 (file)
@@ -45,6 +45,9 @@
 #header .logo,
 #header .logo-icon {
        background-image: url(#{$image-logo});
+       @if $theming-logo-mime != '' {
+               background-size: contain;
+       }
 }
 
 #body-login,
index 0824a36ccdce2da08d486664dea72c2652ca999a..2b3be1e64132056c09adb874907f9ba70b76b363 100644 (file)
@@ -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())."'";
index a7cb7790aa65b99f89c352e5f6c76772e4d3ed57..8646eaf865f8083b50845762c656e4df124042be 100644 (file)
@@ -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(),