]> source.dussan.org Git - nextcloud-server.git/commitdiff
Theming: Add colorized icon css from icons.css
authorJulius Haertl <jus@bitgrid.net>
Sun, 14 Aug 2016 10:54:06 +0000 (12:54 +0200)
committerJulius Haertl <jus@bitgrid.net>
Fri, 18 Nov 2016 09:23:23 +0000 (10:23 +0100)
Signed-off-by: Julius Haertl <jus@bitgrid.net>
apps/theming/lib/Controller/ThemingController.php
apps/theming/tests/Controller/ThemingControllerTest.php

index 09b4a14f2b00105da7e0831d7d74acca45f92ed9..7ba4feb62ddba39745f51d9386995d46595d9d97 100644 (file)
@@ -403,6 +403,15 @@ class ThemingController extends Controller {
                        $responseCss .= '.nc-theming-contrast {color: #ffffff}' . "\n";
                }
 
+               if($logo !== '' or $color !== '') {
+                       $responseCss .= '.icon-file,.icon-filetype-text {' .
+                               'background-image: url(\'./img/core/filetypes/text.svg?v='.$cacheBusterValue.'\');' . "}\n" .
+                               '.icon-folder, .icon-filetype-folder ' .
+                               'background-image: url(\'./img/core/filetypes/folder.svg?v='.$cacheBusterValue.'\');' . "}\n" .
+                               '.icon-filetype-folder-drag-accept {' .
+                               'background-image: url(\'./img/core/filetypes/folder-drag-accept.svg?v='.$cacheBusterValue.'\')!important;' . "}\n";
+               }
+
                $response = new DataDownloadResponse($responseCss, 'style', 'text/css');
                $response->addHeader('Expires', date(\DateTime::RFC2822, $this->timeFactory->getTime()));
                $response->addHeader('Pragma', 'cache');
index d9d5005e25f5158415d76c37a5e8e5538c0d98e2..5de16a7abdf917b66a8a3070a264a7b511d4060e 100644 (file)
@@ -475,6 +475,12 @@ class ThemingControllerTest extends TestCase {
                $expectedData .= sprintf('.nc-theming-main-background {background-color: %s}' . "\n", $color);
                $expectedData .= sprintf('.nc-theming-main-text {color: %s}' . "\n", $color);
                $expectedData .= '.nc-theming-contrast {color: #ffffff}' . "\n";
+               $expectedData .= '.icon-file,.icon-filetype-text {' .
+                       'background-image: url(\'./img/core/filetypes/text.svg?v=0\');' . "}\n" .
+                       '.icon-folder, .icon-filetype-folder ' .
+                       'background-image: url(\'./img/core/filetypes/folder.svg?v=0\');' . "}\n" .
+                       '.icon-filetype-folder-drag-accept {' .
+                       'background-image: url(\'./img/core/filetypes/folder-drag-accept.svg?v=0\')!important;' . "}\n";
 
                $expected = new Http\DataDownloadResponse($expectedData, 'style', 'text/css');
 
@@ -569,6 +575,12 @@ class ThemingControllerTest extends TestCase {
                $expectedData .= '#body-login input.login { background-image: url(\'' . \OC::$WEBROOT . '/core/img/actions/confirm.svg?v=2\'); }' . "\n";
                $expectedData .= '.nc-theming-contrast {color: #000000}' . "\n";
                $expectedData .= '.ui-widget-header { color: #000000; }' . "\n";
+               $expectedData .= '.icon-file,.icon-filetype-text {' .
+                       'background-image: url(\'./img/core/filetypes/text.svg?v=0\');' . "}\n" .
+                       '.icon-folder, .icon-filetype-folder ' .
+                       'background-image: url(\'./img/core/filetypes/folder.svg?v=0\');' . "}\n" .
+                       '.icon-filetype-folder-drag-accept {' .
+                       'background-image: url(\'./img/core/filetypes/folder-drag-accept.svg?v=0\')!important;' . "}\n";
 
 
                $expected = new Http\DataDownloadResponse($expectedData, 'style', 'text/css');
@@ -614,6 +626,12 @@ class ThemingControllerTest extends TestCase {
                        'background-size: contain;' .
                        '}' . "\n";
                $expectedData .= '.nc-theming-contrast {color: #ffffff}' . "\n";
+               $expectedData .= '.icon-file,.icon-filetype-text {' .
+                       'background-image: url(\'./img/core/filetypes/text.svg?v=0\');' . "}\n" .
+                       '.icon-folder, .icon-filetype-folder ' .
+                       'background-image: url(\'./img/core/filetypes/folder.svg?v=0\');' . "}\n" .
+                       '.icon-filetype-folder-drag-accept {' .
+                       'background-image: url(\'./img/core/filetypes/folder-drag-accept.svg?v=0\')!important;' . "}\n";
 
                $expected = new Http\DataDownloadResponse($expectedData, 'style', 'text/css');
 
@@ -756,6 +774,12 @@ class ThemingControllerTest extends TestCase {
                        'background-image: url(\'./loginbackground?v=0\');' .
                        '}' . "\n";
                $expectedData .= '.nc-theming-contrast {color: #ffffff}' . "\n";
+               $expectedData .= '.icon-file,.icon-filetype-text {' .
+                       'background-image: url(\'./img/core/filetypes/text.svg?v=0\');' . "}\n" .
+                       '.icon-folder, .icon-filetype-folder ' .
+                       'background-image: url(\'./img/core/filetypes/folder.svg?v=0\');' . "}\n" .
+                       '.icon-filetype-folder-drag-accept {' .
+                       'background-image: url(\'./img/core/filetypes/folder-drag-accept.svg?v=0\')!important;' . "}\n";
                $expected = new Http\DataDownloadResponse($expectedData, 'style', 'text/css');
 
                $expected->cacheFor(3600);
@@ -867,6 +891,13 @@ class ThemingControllerTest extends TestCase {
                $expectedData .= '#body-login input.login { background-image: url(\'' . \OC::$WEBROOT . '/core/img/actions/confirm.svg?v=2\'); }' . "\n";
                $expectedData .= '.nc-theming-contrast {color: #000000}' . "\n";
                $expectedData .= '.ui-widget-header { color: #000000; }' . "\n";
+               $expectedData .= '.icon-file,.icon-filetype-text {' .
+                       'background-image: url(\'./img/core/filetypes/text.svg?v=0\');' . "}\n" .
+                       '.icon-folder, .icon-filetype-folder ' .
+                       'background-image: url(\'./img/core/filetypes/folder.svg?v=0\');' . "}\n" .
+                       '.icon-filetype-folder-drag-accept {' .
+                       'background-image: url(\'./img/core/filetypes/folder-drag-accept.svg?v=0\')!important;' . "}\n";
+               $expected = new Http\DataDownloadResponse($expectedData, 'style', 'text/css');
 
                $expected = new Http\DataDownloadResponse($expectedData, 'style', 'text/css');
                $expected->cacheFor(3600);