Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Theming: Only link Entity in footer if a url is set #10875

Merged
merged 2 commits into from
Aug 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions apps/theming/lib/ThemingDefaults.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,14 @@ public function getPrivacyUrl() {

public function getShortFooter() {
$slogan = $this->getSlogan();
$footer = '<a href="'. $this->getBaseUrl() . '" target="_blank"' .
' rel="noreferrer noopener">' .$this->getEntity() . '</a>'.
($slogan !== '' ? ' – ' . $slogan : '');
$baseUrl = $this->getBaseUrl();
if ($baseUrl !== '') {
$footer = '<a href="' . $baseUrl . '" target="_blank"' .
' rel="noreferrer noopener" class="entity-name">' . $this->getEntity() . '</a>';
} else {
$footer = '<span class="entity-name">' .$this->getEntity() . '</span>';
}
$footer .= ($slogan !== '' ? ' – ' . $slogan : '');

$links = [
[
Expand Down
29 changes: 22 additions & 7 deletions apps/theming/tests/ThemingDefaultsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,22 @@ public function testGetShortFooter() {
['theming', 'privacyUrl', '', ''],
]);

$this->assertEquals('<a href="url" target="_blank" rel="noreferrer noopener">Name</a> – Slogan', $this->template->getShortFooter());
$this->assertEquals('<a href="url" target="_blank" rel="noreferrer noopener" class="entity-name">Name</a> – 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('<span class="entity-name">Name</span> – Slogan', $this->template->getShortFooter());
}

public function testGetShortFooterEmptySlogan() {
Expand All @@ -277,7 +292,7 @@ public function testGetShortFooterEmptySlogan() {
['theming', 'privacyUrl', '', ''],
]);

$this->assertEquals('<a href="url" target="_blank" rel="noreferrer noopener">Name</a>', $this->template->getShortFooter());
$this->assertEquals('<a href="url" target="_blank" rel="noreferrer noopener" class="entity-name">Name</a>', $this->template->getShortFooter());
}

public function testGetShortFooterImprint() {
Expand All @@ -297,7 +312,7 @@ public function testGetShortFooterImprint() {
->method('t')
->willReturnArgument(0);

$this->assertEquals('<a href="url" target="_blank" rel="noreferrer noopener">Name</a> – Slogan<br/><a href="https://example.com/imprint" class="legal" target="_blank" rel="noreferrer noopener">Legal notice</a>', $this->template->getShortFooter());
$this->assertEquals('<a href="url" target="_blank" rel="noreferrer noopener" class="entity-name">Name</a> – Slogan<br/><a href="https://example.com/imprint" class="legal" target="_blank" rel="noreferrer noopener">Legal notice</a>', $this->template->getShortFooter());
}

public function testGetShortFooterPrivacy() {
Expand All @@ -317,7 +332,7 @@ public function testGetShortFooterPrivacy() {
->method('t')
->willReturnArgument(0);

$this->assertEquals('<a href="url" target="_blank" rel="noreferrer noopener">Name</a> – Slogan<br/><a href="https://example.com/privacy" class="legal" target="_blank" rel="noreferrer noopener">Privacy policy</a>', $this->template->getShortFooter());
$this->assertEquals('<a href="url" target="_blank" rel="noreferrer noopener" class="entity-name">Name</a> – Slogan<br/><a href="https://example.com/privacy" class="legal" target="_blank" rel="noreferrer noopener">Privacy policy</a>', $this->template->getShortFooter());
}

public function testGetShortFooterAllLegalLinks() {
Expand All @@ -337,7 +352,7 @@ public function testGetShortFooterAllLegalLinks() {
->method('t')
->willReturnArgument(0);

$this->assertEquals('<a href="url" target="_blank" rel="noreferrer noopener">Name</a> – Slogan<br/><a href="https://example.com/imprint" class="legal" target="_blank" rel="noreferrer noopener">Legal notice</a> · <a href="https://example.com/privacy" class="legal" target="_blank" rel="noreferrer noopener">Privacy policy</a>', $this->template->getShortFooter());
$this->assertEquals('<a href="url" target="_blank" rel="noreferrer noopener" class="entity-name">Name</a> – Slogan<br/><a href="https://example.com/imprint" class="legal" target="_blank" rel="noreferrer noopener">Legal notice</a> · <a href="https://example.com/privacy" class="legal" target="_blank" rel="noreferrer noopener">Privacy policy</a>', $this->template->getShortFooter());
}

public function invalidLegalUrlProvider() {
Expand All @@ -363,7 +378,7 @@ public function testGetShortFooterInvalidImprint($invalidImprintUrl) {
['theming', 'privacyUrl', '', ''],
]);

$this->assertEquals('<a href="url" target="_blank" rel="noreferrer noopener">Name</a> – Slogan', $this->template->getShortFooter());
$this->assertEquals('<a href="url" target="_blank" rel="noreferrer noopener" class="entity-name">Name</a> – Slogan', $this->template->getShortFooter());
}

/**
Expand All @@ -382,7 +397,7 @@ public function testGetShortFooterInvalidPrivacy($invalidPrivacyUrl) {
['theming', 'privacyUrl', '', $invalidPrivacyUrl],
]);

$this->assertEquals('<a href="url" target="_blank" rel="noreferrer noopener">Name</a> – Slogan', $this->template->getShortFooter());
$this->assertEquals('<a href="url" target="_blank" rel="noreferrer noopener" class="entity-name">Name</a> – Slogan', $this->template->getShortFooter());
}

public function testgetColorPrimaryWithDefault() {
Expand Down
2 changes: 1 addition & 1 deletion core/css/guest.css
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ footer {
margin-top: auto;
}

footer .info a {
footer .info .entity-name {
font-weight: 600;
}

Expand Down