Commit 4e29fdd8879f53ef3a54bff5a3929067b6345257

Authored by Fabio Teixeira
1 parent 9849cd64
Exists in person_info_block

Create ProfileWall Component

TODO: Tests missing

Signed-off-by: Fabio Teixeira <fabio1079@gmail.com>
src/app/main/main.component.ts
@@ -16,6 +16,7 @@ import {RecentDocumentsBlockComponent} from &quot;../layout/blocks/recent-documents/r @@ -16,6 +16,7 @@ import {RecentDocumentsBlockComponent} from &quot;../layout/blocks/recent-documents/r
16 import {ProfileImageBlockComponent} from "../layout/blocks/profile-image/profile-image-block.component"; 16 import {ProfileImageBlockComponent} from "../layout/blocks/profile-image/profile-image-block.component";
17 import {RawHTMLBlockComponent} from "../layout/blocks/raw-html/raw-html-block.component"; 17 import {RawHTMLBlockComponent} from "../layout/blocks/raw-html/raw-html-block.component";
18 import {StatisticsBlockComponent} from "../layout/blocks/statistics/statistics-block.component"; 18 import {StatisticsBlockComponent} from "../layout/blocks/statistics/statistics-block.component";
  19 +import {ProfileWallComponent} from "../profile/wall/profile-wall.component";
19 20
20 import {MembersBlockComponent} from "../layout/blocks/members/members-block.component"; 21 import {MembersBlockComponent} from "../layout/blocks/members/members-block.component";
21 import {CommunitiesBlockComponent} from "../layout/blocks/communities/communities-block.component"; 22 import {CommunitiesBlockComponent} from "../layout/blocks/communities/communities-block.component";
@@ -99,7 +100,7 @@ export class EnvironmentContent { @@ -99,7 +100,7 @@ export class EnvironmentContent {
99 LinkListBlockComponent, CommunitiesBlockComponent, HtmlEditorComponent, 100 LinkListBlockComponent, CommunitiesBlockComponent, HtmlEditorComponent,
100 MainBlockComponent, RecentDocumentsBlockComponent, Navbar, SidebarComponent, ProfileImageBlockComponent, 101 MainBlockComponent, RecentDocumentsBlockComponent, Navbar, SidebarComponent, ProfileImageBlockComponent,
101 MembersBlockComponent, NoosferoTemplate, DateFormat, RawHTMLBlockComponent, StatisticsBlockComponent, 102 MembersBlockComponent, NoosferoTemplate, DateFormat, RawHTMLBlockComponent, StatisticsBlockComponent,
102 - LoginBlockComponent 103 + LoginBlockComponent, ProfileWallComponent
103 ].concat(plugins.mainComponents).concat(plugins.hotspots), 104 ].concat(plugins.mainComponents).concat(plugins.hotspots),
104 105
105 providers: [AuthService, SessionService, NotificationService, BodyStateClassesService] 106 providers: [AuthService, SessionService, NotificationService, BodyStateClassesService]
src/app/profile/info/profile-info.component.ts
@@ -13,8 +13,6 @@ import {TranslateProfile} from &quot;../../shared/pipes/translate-profile.filter&quot;; @@ -13,8 +13,6 @@ import {TranslateProfile} from &quot;../../shared/pipes/translate-profile.filter&quot;;
13 @Inject(ProfileService) 13 @Inject(ProfileService)
14 @Inject("amDateFormatFilter") 14 @Inject("amDateFormatFilter")
15 export class ProfileInfoComponent { 15 export class ProfileInfoComponent {
16 -  
17 - activities: any;  
18 profile: noosfero.Profile; 16 profile: noosfero.Profile;
19 17
20 constructor(private profileService: ProfileService, private amDateFormatFilter: any) { 18 constructor(private profileService: ProfileService, private amDateFormatFilter: any) {
@@ -24,9 +22,6 @@ export class ProfileInfoComponent { @@ -24,9 +22,6 @@ export class ProfileInfoComponent {
24 init() { 22 init() {
25 this.profileService.getCurrentProfile().then((profile: noosfero.Profile) => { 23 this.profileService.getCurrentProfile().then((profile: noosfero.Profile) => {
26 this.profile = profile; 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 <div class="profile-wall"> 1 <div class="profile-wall">
2 -  
3 <div class="col-lg-3 col-md-4 col-sm-4"> 2 <div class="col-lg-3 col-md-4 col-sm-4">
4 <div class="main-box clearfix"> 3 <div class="main-box clearfix">
5 <header class="main-box-header clearfix"> 4 <header class="main-box-header clearfix">
@@ -16,15 +15,6 @@ @@ -16,15 +15,6 @@
16 </div> 15 </div>
17 16
18 <div class="col-lg-9 col-md-8 col-sm-8"> 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 </div> 19 </div>
30 </div> 20 </div>
src/app/profile/wall/index.ts 0 → 100644
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 +export * from "./profile-wall.component";
0 \ No newline at end of file 2 \ No newline at end of file
src/app/profile/wall/profile-wall.component.ts 0 → 100644
@@ -0,0 +1,25 @@ @@ -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 +}
src/app/profile/wall/profile-wall.html 0 → 100644
@@ -0,0 +1,11 @@ @@ -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 \ No newline at end of file 12 \ No newline at end of file