profile-image.component.ts
1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import {Inject, Input, Component} from "ng-forward";
import {Profile} from "./../../../models/interfaces";
/**
* @ngdoc controller
* @name components.noosfero.profile-image.ProfileImage
* @description The component responsible for rendering the profile image
* @exports ProfileImage
*/
@Component({
selector: "noosfero-profile-image",
templateUrl: 'app/components/noosfero/profile-image/profile-image.html',
})
export class ProfileImage {
/**
* @ngdoc property
* @name profile
* @propertyOf components.noosfero.profile-image.ProfileImage
* @description
* The Noosfero {@link models.Profile} holding the image.
*/
@Input() profile: Profile;
/**
* @ngdoc property
* @name defaultIcon
* @propertyOf components.noosfero.profile-image.ProfileImage
* @descritpion
* The default icon used by this profile
*/
defaultIcon: string;
/**
* @ngdoc method
* @name ngOnInit
* @methodOf components.noosfero.profile-image.ProfileImage
* @description
* Initializes the icon names to their corresponding values depending on the profile type passed to the controller
*/
ngOnInit() {
this.defaultIcon = 'fa-users';
if (this.profile && this.profile.type === 'Person') {
this.defaultIcon = 'fa-user';
}
}
}