Project

General

Profile

1
import {Component, Input} from '@angular/core';
2

    
3

    
4
@Component({
5
    selector: 'showTitle',
6
    template: `
7
        <h2 *ngIf="title != undefined">
8
            <span   *ngIf="title['url'] != undefined && title['url'] != null && title['url'] != ''"
9
                    class="uk-icon-external-link custom-icon {{title['accessMode']}}"
10
                    data-uk-tooltip="pos:bottom-right"
11
                    [title]="title['accessMode']">
12
                <a *ngIf="title['name'] != undefined && title['name'] != ''"
13
                    href="{{title['url']}}" target="_blank"
14
                    [innerHTML]="title['name']">
15
                </a>
16
                <a *ngIf="title['name'] == undefined || title['name'] == ''"
17
                    href="{{title['url']}}" target="_blank">
18
                    [no title available]
19
                </a>
20
            </span>
21
            <span *ngIf="(title['name'] != undefined && title['name'] != '') &&
22
                    (title['url'] == undefined || title['url'] == null || title['url'] == '')"
23
                    [class]="title['accessMode']"
24
                    data-uk-tooltip="pos:bottom-right"
25
                    [title]="title['accessMode']"
26
                    [innerHTML]="title['name']">
27
            </span>
28
            <span *ngIf="(title['name'] == undefined || title['name'] == '') &&
29
                    (title['url'] == undefined || title['url'] == null || title['url'] == '')"
30
                    [class]="title['accessMode']"
31
                    data-uk-tooltip="pos:bottom-right"
32
                    [title]="title['accessMode']">
33
                [no title available]
34
            </span>
35
        </h2>
36
    `
37

    
38
    })
39

    
40
export class ShowTitleComponent {
41
    @Input() title: { [key: string]: string };
42

    
43
    constructor () {
44
    }
45

    
46
    ngOnInit() {
47
        if(this.title['accessMode'] == undefined) {
48
            this.title['accessMode'] = "";
49
        }
50
    }
51
}
(11-11/13)