Commit 4e29fdd8879f53ef3a54bff5a3929067b6345257
1 parent
9849cd64
Exists in
person_info_block
Create ProfileWall Component
TODO: Tests missing Signed-off-by: Fabio Teixeira <fabio1079@gmail.com>
Showing
6 changed files
with
40 additions
and
17 deletions
Show diff stats
src/app/main/main.component.ts
... | ... | @@ -16,6 +16,7 @@ import {RecentDocumentsBlockComponent} from "../layout/blocks/recent-documents/r |
16 | 16 | import {ProfileImageBlockComponent} from "../layout/blocks/profile-image/profile-image-block.component"; |
17 | 17 | import {RawHTMLBlockComponent} from "../layout/blocks/raw-html/raw-html-block.component"; |
18 | 18 | import {StatisticsBlockComponent} from "../layout/blocks/statistics/statistics-block.component"; |
19 | +import {ProfileWallComponent} from "../profile/wall/profile-wall.component"; | |
19 | 20 | |
20 | 21 | import {MembersBlockComponent} from "../layout/blocks/members/members-block.component"; |
21 | 22 | import {CommunitiesBlockComponent} from "../layout/blocks/communities/communities-block.component"; |
... | ... | @@ -99,7 +100,7 @@ export class EnvironmentContent { |
99 | 100 | LinkListBlockComponent, CommunitiesBlockComponent, HtmlEditorComponent, |
100 | 101 | MainBlockComponent, RecentDocumentsBlockComponent, Navbar, SidebarComponent, ProfileImageBlockComponent, |
101 | 102 | MembersBlockComponent, NoosferoTemplate, DateFormat, RawHTMLBlockComponent, StatisticsBlockComponent, |
102 | - LoginBlockComponent | |
103 | + LoginBlockComponent, ProfileWallComponent | |
103 | 104 | ].concat(plugins.mainComponents).concat(plugins.hotspots), |
104 | 105 | |
105 | 106 | providers: [AuthService, SessionService, NotificationService, BodyStateClassesService] | ... | ... |
src/app/profile/info/profile-info.component.ts
... | ... | @@ -13,8 +13,6 @@ import {TranslateProfile} from "../../shared/pipes/translate-profile.filter"; |
13 | 13 | @Inject(ProfileService) |
14 | 14 | @Inject("amDateFormatFilter") |
15 | 15 | export class ProfileInfoComponent { |
16 | - | |
17 | - activities: any; | |
18 | 16 | profile: noosfero.Profile; |
19 | 17 | |
20 | 18 | constructor(private profileService: ProfileService, private amDateFormatFilter: any) { |
... | ... | @@ -24,9 +22,6 @@ export class ProfileInfoComponent { |
24 | 22 | init() { |
25 | 23 | this.profileService.getCurrentProfile().then((profile: noosfero.Profile) => { |
26 | 24 | this.profile = profile; |
27 | - return this.profileService.getActivities(<number>this.profile.id); | |
28 | - }).then((response: restangular.IResponse) => { | |
29 | - this.activities = response.data.activities; | |
30 | 25 | }); |
31 | 26 | } |
32 | 27 | } | ... | ... |
src/app/profile/info/profile-info.html
1 | 1 | <div class="profile-wall"> |
2 | - | |
3 | 2 | <div class="col-lg-3 col-md-4 col-sm-4"> |
4 | 3 | <div class="main-box clearfix"> |
5 | 4 | <header class="main-box-header clearfix"> |
... | ... | @@ -16,15 +15,6 @@ |
16 | 15 | </div> |
17 | 16 | |
18 | 17 | <div class="col-lg-9 col-md-8 col-sm-8"> |
19 | - <div class="main-box clearfix"> | |
20 | - <uib-tabset active="active"> | |
21 | - <uib-tab index="0" heading="{{ 'activities.title' | translate }}"> | |
22 | - <noosfero-activities [activities]="vm.activities"></noosfero-activities> | |
23 | - </uib-tab> | |
24 | - <uib-tab index="0" heading="{{ 'profile.about' | translate }}"> | |
25 | - <profile-data [profile]="vm.profile"></profile-data> | |
26 | - </uib-tab> | |
27 | - </uib-tabset> | |
28 | - </div> | |
18 | + <profile-wall [profile]="vm.profile"></profile-wall> | |
29 | 19 | </div> |
30 | 20 | </div> | ... | ... |
... | ... | @@ -0,0 +1,25 @@ |
1 | +import {Component, Inject, Input, provide} from 'ng-forward'; | |
2 | +import {ProfileService} from "../../../lib/ng-noosfero-api/http/profile.service"; | |
3 | +import {TranslateProfile} from "../../shared/pipes/translate-profile.filter"; | |
4 | + | |
5 | +@Component({ | |
6 | + selector: 'profile-wall', | |
7 | + templateUrl: "app/profile/wall/profile-wall.html", | |
8 | + providers: [provide('profileService', { useClass: ProfileService })], | |
9 | + pipes: [TranslateProfile] | |
10 | +}) | |
11 | +@Inject(ProfileService) | |
12 | +export class ProfileWallComponent { | |
13 | + @Input() profile: noosfero.Profile; | |
14 | + activities: noosfero.Activity[]; | |
15 | + | |
16 | + constructor(private profileService: ProfileService) { | |
17 | + } | |
18 | + | |
19 | + ngOnInit() { | |
20 | + this.profileService.getActivities(<number>this.profile.id) | |
21 | + .then((response: restangular.IResponse) => { | |
22 | + this.activities = <noosfero.Activity[]>response.data.activities; | |
23 | + }); | |
24 | + } | |
25 | +} | ... | ... |
... | ... | @@ -0,0 +1,11 @@ |
1 | +<h1>Name: {{ctrl.profile.name}}</h1> | |
2 | +<div class="main-box clearfix"> | |
3 | + <uib-tabset active="active"> | |
4 | + <uib-tab index="0" heading="{{ 'activities.title' | translate }}"> | |
5 | + <noosfero-activities [activities]="ctrl.activities"></noosfero-activities> | |
6 | + </uib-tab> | |
7 | + <uib-tab index="0" heading="{{ 'profile.about' | translate }}"> | |
8 | + <profile-data [profile]="ctrl.profile"></profile-data> | |
9 | + </uib-tab> | |
10 | + </uib-tabset> | |
11 | +</div> | |
0 | 12 | \ No newline at end of file | ... | ... |