Closes #322: Feature request: Clickable logo that points to specific url

This commit is contained in:
Bohdan Khorolets 2017-08-16 19:42:25 +03:00 committed by Roman Hotsiy
parent 6b61d3aee1
commit cb3d318e4a
2 changed files with 7 additions and 1 deletions

View File

@ -1 +1,4 @@
<img *ngIf="logo.imgUrl" [attr.src]="logo.imgUrl" [ngStyle]="{'background-color': logo.bgColor}"> <a *ngIf="logo.url" href="{{logo.url}}">
<img *ngIf="logo.imgUrl" [attr.src]="logo.imgUrl" [ngStyle]="{'background-color': logo.bgColor}">
</a>
<img *ngIf="logo.imgUrl && !logo.url" [attr.src]="logo.imgUrl" [ngStyle]="{'background-color': logo.bgColor}">

View File

@ -17,6 +17,9 @@ export class ApiLogo extends BaseComponent implements OnInit {
init() { init() {
let logoInfo = this.componentSchema.info['x-logo']; let logoInfo = this.componentSchema.info['x-logo'];
if ('url' in this.componentSchema.info['contact']) {
this.logo.url = this.componentSchema.info['contact']['url'];
}
if (!logoInfo) return; if (!logoInfo) return;
this.logo.imgUrl = logoInfo.url; this.logo.imgUrl = logoInfo.url;
this.logo.bgColor = logoInfo.backgroundColor || 'transparent'; this.logo.bgColor = logoInfo.backgroundColor || 'transparent';