From 5175e33e31a45035ad4162aef3c342a277a26894 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Mon, 27 Aug 2018 12:17:25 +0200 Subject: [PATCH 1/2] Theming: Only Entity in footer if a url is set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fixes #10024 Signed-off-by: Julius Härtl --- apps/theming/lib/ThemingDefaults.php | 10 +++++++--- core/css/guest.css | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/theming/lib/ThemingDefaults.php b/apps/theming/lib/ThemingDefaults.php index 72286ece4b8f0..3c7acafd6e9de 100644 --- a/apps/theming/lib/ThemingDefaults.php +++ b/apps/theming/lib/ThemingDefaults.php @@ -151,9 +151,13 @@ public function getPrivacyUrl() { public function getShortFooter() { $slogan = $this->getSlogan(); - $footer = '' .$this->getEntity() . ''. - ($slogan !== '' ? ' – ' . $slogan : ''); + if ($this->getBaseUrl() !== '') { + $footer = '' . $this->getEntity() . ''; + } else { + $footer = '' .$this->getEntity() . ''; + } + $footer .= ($slogan !== '' ? ' – ' . $slogan : ''); $links = [ [ diff --git a/core/css/guest.css b/core/css/guest.css index 5f4eaefe80a75..fc926688c4473 100644 --- a/core/css/guest.css +++ b/core/css/guest.css @@ -746,7 +746,7 @@ footer { margin-top: auto; } -footer .info a { +footer .info .entity-name { font-weight: 600; } From c4f34ccc4cf3823a0ccfdbad2d20ba20c474ecce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Mon, 27 Aug 2018 15:22:49 +0200 Subject: [PATCH 2/2] Theming: Fix footer tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- apps/theming/lib/ThemingDefaults.php | 5 ++-- apps/theming/tests/ThemingDefaultsTest.php | 29 ++++++++++++++++------ 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/apps/theming/lib/ThemingDefaults.php b/apps/theming/lib/ThemingDefaults.php index 3c7acafd6e9de..fe1b1d4c17fbb 100644 --- a/apps/theming/lib/ThemingDefaults.php +++ b/apps/theming/lib/ThemingDefaults.php @@ -151,8 +151,9 @@ public function getPrivacyUrl() { public function getShortFooter() { $slogan = $this->getSlogan(); - if ($this->getBaseUrl() !== '') { - $footer = 'getBaseUrl(); + if ($baseUrl !== '') { + $footer = '' . $this->getEntity() . ''; } else { $footer = '' .$this->getEntity() . ''; diff --git a/apps/theming/tests/ThemingDefaultsTest.php b/apps/theming/tests/ThemingDefaultsTest.php index 87b2003ded2c4..5d075709dc53a 100644 --- a/apps/theming/tests/ThemingDefaultsTest.php +++ b/apps/theming/tests/ThemingDefaultsTest.php @@ -262,7 +262,22 @@ public function testGetShortFooter() { ['theming', 'privacyUrl', '', ''], ]); - $this->assertEquals('Name – Slogan', $this->template->getShortFooter()); + $this->assertEquals('Name – Slogan', $this->template->getShortFooter()); + } + + public function testGetShortFooterEmptyUrl() { + $this->config + ->expects($this->exactly(5)) + ->method('getAppValue') + ->willReturnMap([ + ['theming', 'url', $this->defaults->getBaseUrl(), ''], + ['theming', 'name', 'Nextcloud', 'Name'], + ['theming', 'slogan', $this->defaults->getSlogan(), 'Slogan'], + ['theming', 'imprintUrl', '', ''], + ['theming', 'privacyUrl', '', ''], + ]); + + $this->assertEquals('Name – Slogan', $this->template->getShortFooter()); } public function testGetShortFooterEmptySlogan() { @@ -277,7 +292,7 @@ public function testGetShortFooterEmptySlogan() { ['theming', 'privacyUrl', '', ''], ]); - $this->assertEquals('Name', $this->template->getShortFooter()); + $this->assertEquals('Name', $this->template->getShortFooter()); } public function testGetShortFooterImprint() { @@ -297,7 +312,7 @@ public function testGetShortFooterImprint() { ->method('t') ->willReturnArgument(0); - $this->assertEquals('Name – Slogan
Legal notice', $this->template->getShortFooter()); + $this->assertEquals('Name – Slogan
Legal notice', $this->template->getShortFooter()); } public function testGetShortFooterPrivacy() { @@ -317,7 +332,7 @@ public function testGetShortFooterPrivacy() { ->method('t') ->willReturnArgument(0); - $this->assertEquals('Name – Slogan
Privacy policy', $this->template->getShortFooter()); + $this->assertEquals('Name – Slogan
Privacy policy', $this->template->getShortFooter()); } public function testGetShortFooterAllLegalLinks() { @@ -337,7 +352,7 @@ public function testGetShortFooterAllLegalLinks() { ->method('t') ->willReturnArgument(0); - $this->assertEquals('Name – Slogan
Legal notice · Privacy policy', $this->template->getShortFooter()); + $this->assertEquals('Name – Slogan
Legal notice · Privacy policy', $this->template->getShortFooter()); } public function invalidLegalUrlProvider() { @@ -363,7 +378,7 @@ public function testGetShortFooterInvalidImprint($invalidImprintUrl) { ['theming', 'privacyUrl', '', ''], ]); - $this->assertEquals('Name – Slogan', $this->template->getShortFooter()); + $this->assertEquals('Name – Slogan', $this->template->getShortFooter()); } /** @@ -382,7 +397,7 @@ public function testGetShortFooterInvalidPrivacy($invalidPrivacyUrl) { ['theming', 'privacyUrl', '', $invalidPrivacyUrl], ]); - $this->assertEquals('Name – Slogan', $this->template->getShortFooter()); + $this->assertEquals('Name – Slogan', $this->template->getShortFooter()); } public function testgetColorPrimaryWithDefault() {