profile.component.ts
1.4 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 {StateConfig, Component, Inject} from 'ng-forward';
import {ProfileInfo} from '../profile-info/profile-info.component'
import {Cms} from '../cms/cms.component'
@Component({
selector: 'profile',
templateUrl: "app/profile/profile.html"
})
@StateConfig([
{
name: 'main.profile.info',
url: "^/profile/:profile",
component: ProfileInfo,
views: {
"mainBlockContent": {
templateUrl: "app/profile-info/profile-info.html",
controller: "ProfileInfoController",
controllerAs: "vm"
}
}
},
{
name: 'main.profile.cms',
url: "^/myprofile/:profile/cms",
component: Cms,
views: {
"mainBlockContent": {
templateUrl: "app/cms/cms.html",
controller: "CmsController",
controllerAs: "vm"
}
}
},
])
@Inject("noosfero", "$log", "$stateParams")
export class Profile {
boxes: any
profile: any
constructor(noosfero, $log, $stateParams) {
noosfero.profiles.one().get({ identifier: $stateParams.profile }).then((response) => {
this.profile = response.data[0];
noosfero.setCurrentProfile(this.profile);
return noosfero.boxes(this.profile.id).one().get();
}).then((response) => {
this.boxes = response.data.boxes;
});
}
}