Commit d1a24860dc0c9c45512521a12347941646356fec
1 parent
4e29fdd8
Exists in
person_info_block
Moves wall component to custom themes.
Signed-off-by: DylanGuedes <djmgguedes@gmail.com> Signed-off-by: ArthurJahn <stutrzbecher@gmail.com>
Showing
11 changed files
with
182 additions
and
1 deletions
Show diff stats
src/app/profile/info/profile-info.html
themes/angular-participa-consulta/app/profile/info/.profile-info.html.swp
0 → 100644
No preview for this file type
themes/angular-participa-consulta/app/profile/info/index.ts
0 → 100644
themes/angular-participa-consulta/app/profile/info/profile-info.component.spec.ts
0 → 100644
... | ... | @@ -0,0 +1,42 @@ |
1 | +import {quickCreateComponent} from "../../../spec/helpers"; | |
2 | +import {ProfileInfoComponent} from "./profile-info.component"; | |
3 | + | |
4 | +describe("Components", () => { | |
5 | + describe("Profile Info Component", () => { | |
6 | + | |
7 | + let $rootScope: ng.IRootScopeService; | |
8 | + let $q: ng.IQService; | |
9 | + let profileServiceMock: any; | |
10 | + let $stateParams: any; | |
11 | + let amDateFormatMock: any; | |
12 | + | |
13 | + beforeEach(inject((_$rootScope_: ng.IRootScopeService, _$q_: ng.IQService) => { | |
14 | + $rootScope = _$rootScope_; | |
15 | + $q = _$q_; | |
16 | + })); | |
17 | + | |
18 | + beforeEach(() => { | |
19 | + $stateParams = jasmine.createSpyObj("$stateParams", ["profile"]); | |
20 | + profileServiceMock = jasmine.createSpyObj("profileServiceMock", ["getCurrentProfile", "getActivities"]); | |
21 | + amDateFormatMock = jasmine.createSpyObj("amDateFormatMock", ["transform"]); | |
22 | + | |
23 | + let getCurrentProfileResponse = $q.defer(); | |
24 | + getCurrentProfileResponse.resolve({ id: 1 }); | |
25 | + | |
26 | + let getActivitiesResponse = $q.defer(); | |
27 | + getActivitiesResponse.resolve({ data: { activities: [{ id: 1 }, { id: 2 }] } }); | |
28 | + | |
29 | + profileServiceMock.getCurrentProfile = jasmine.createSpy("getCurrentProfile").and.returnValue(getCurrentProfileResponse.promise); | |
30 | + profileServiceMock.getActivities = jasmine.createSpy("getActivities").and.returnValue(getActivitiesResponse.promise); | |
31 | + }); | |
32 | + | |
33 | + it("get the profile activities", done => { | |
34 | + let component: ProfileInfoComponent = new ProfileInfoComponent(profileServiceMock, amDateFormatMock); | |
35 | + $rootScope.$apply(); | |
36 | + expect(profileServiceMock.getCurrentProfile).toHaveBeenCalled(); | |
37 | + expect(profileServiceMock.getActivities).toHaveBeenCalled(); | |
38 | + expect(component.activities).toEqual([{ id: 1 }, { id: 2 }]); | |
39 | + done(); | |
40 | + }); | |
41 | + }); | |
42 | +}); | ... | ... |
themes/angular-participa-consulta/app/profile/info/profile-info.component.ts
0 → 100644
... | ... | @@ -0,0 +1,27 @@ |
1 | +import {StateConfig, Component, Inject, provide} from 'ng-forward'; | |
2 | +import {ProfileService} from "../../../lib/ng-noosfero-api/http/profile.service"; | |
3 | +import {ProfileDataComponent} from "../data/profile-data.component"; | |
4 | +import {TranslateProfile} from "../../shared/pipes/translate-profile.filter"; | |
5 | + | |
6 | +@Component({ | |
7 | + selector: 'profile', | |
8 | + templateUrl: "app/profile/info/profile-info.html", | |
9 | + providers: [provide('profileService', { useClass: ProfileService })], | |
10 | + directives: [ProfileDataComponent], | |
11 | + pipes: [TranslateProfile] | |
12 | +}) | |
13 | +@Inject(ProfileService) | |
14 | +@Inject("amDateFormatFilter") | |
15 | +export class ProfileInfoComponent { | |
16 | + profile: noosfero.Profile; | |
17 | + | |
18 | + constructor(private profileService: ProfileService, private amDateFormatFilter: any) { | |
19 | + this.init(); | |
20 | + } | |
21 | + | |
22 | + init() { | |
23 | + this.profileService.getCurrentProfile().then((profile: noosfero.Profile) => { | |
24 | + this.profile = profile; | |
25 | + }); | |
26 | + } | |
27 | +} | ... | ... |
themes/angular-participa-consulta/app/profile/info/profile-info.html
0 → 100644
... | ... | @@ -0,0 +1,20 @@ |
1 | +<div class="profile-wall"> | |
2 | + <div class="col-lg-3 col-md-4 col-sm-4"> | |
3 | + <div class="main-box clearfix"> | |
4 | + <header class="main-box-header clearfix"> | |
5 | + <h2>{{vm.profile.name}}</h2> | |
6 | + </header> | |
7 | + <div id="profile-left" class="main-box-body clearfix"> | |
8 | + <noosfero-profile-image [profile]="vm.profile" class="img-responsive center-block"></noosfero-profile-image> | |
9 | + <span class="label" ng-class="{'label-danger': vm.profile.type == 'Community', 'label-info': vm.profile.type == 'Person'}">{{vm.profile | translateProfile}}</span> | |
10 | + <div class="profile-since"> | |
11 | + {{"profile.member_since" | translate}}: {{vm.profile.created_at | amDateFormat:'MMMM YYYY'}} | |
12 | + </div> | |
13 | + </div> | |
14 | + </div> | |
15 | + </div> | |
16 | + | |
17 | + <div class="col-lg-9 col-md-8 col-sm-8"> | |
18 | + <profile-wall [profile]="vm.profile"></profile-wall> | |
19 | + </div> | |
20 | +</div> | ... | ... |
No preview for this file type
themes/angular-rede-brasil/app/profile/info/profile-info.component.spec.ts
0 → 100644
... | ... | @@ -0,0 +1,42 @@ |
1 | +import {quickCreateComponent} from "../../../spec/helpers"; | |
2 | +import {ProfileInfoComponent} from "./profile-info.component"; | |
3 | + | |
4 | +describe("Components", () => { | |
5 | + describe("Profile Info Component", () => { | |
6 | + | |
7 | + let $rootScope: ng.IRootScopeService; | |
8 | + let $q: ng.IQService; | |
9 | + let profileServiceMock: any; | |
10 | + let $stateParams: any; | |
11 | + let amDateFormatMock: any; | |
12 | + | |
13 | + beforeEach(inject((_$rootScope_: ng.IRootScopeService, _$q_: ng.IQService) => { | |
14 | + $rootScope = _$rootScope_; | |
15 | + $q = _$q_; | |
16 | + })); | |
17 | + | |
18 | + beforeEach(() => { | |
19 | + $stateParams = jasmine.createSpyObj("$stateParams", ["profile"]); | |
20 | + profileServiceMock = jasmine.createSpyObj("profileServiceMock", ["getCurrentProfile", "getActivities"]); | |
21 | + amDateFormatMock = jasmine.createSpyObj("amDateFormatMock", ["transform"]); | |
22 | + | |
23 | + let getCurrentProfileResponse = $q.defer(); | |
24 | + getCurrentProfileResponse.resolve({ id: 1 }); | |
25 | + | |
26 | + let getActivitiesResponse = $q.defer(); | |
27 | + getActivitiesResponse.resolve({ data: { activities: [{ id: 1 }, { id: 2 }] } }); | |
28 | + | |
29 | + profileServiceMock.getCurrentProfile = jasmine.createSpy("getCurrentProfile").and.returnValue(getCurrentProfileResponse.promise); | |
30 | + profileServiceMock.getActivities = jasmine.createSpy("getActivities").and.returnValue(getActivitiesResponse.promise); | |
31 | + }); | |
32 | + | |
33 | + it("get the profile activities", done => { | |
34 | + let component: ProfileInfoComponent = new ProfileInfoComponent(profileServiceMock, amDateFormatMock); | |
35 | + $rootScope.$apply(); | |
36 | + expect(profileServiceMock.getCurrentProfile).toHaveBeenCalled(); | |
37 | + expect(profileServiceMock.getActivities).toHaveBeenCalled(); | |
38 | + expect(component.activities).toEqual([{ id: 1 }, { id: 2 }]); | |
39 | + done(); | |
40 | + }); | |
41 | + }); | |
42 | +}); | ... | ... |
themes/angular-rede-brasil/app/profile/info/profile-info.component.ts
0 → 100644
... | ... | @@ -0,0 +1,27 @@ |
1 | +import {StateConfig, Component, Inject, provide} from 'ng-forward'; | |
2 | +import {ProfileService} from "../../../lib/ng-noosfero-api/http/profile.service"; | |
3 | +import {ProfileDataComponent} from "../data/profile-data.component"; | |
4 | +import {TranslateProfile} from "../../shared/pipes/translate-profile.filter"; | |
5 | + | |
6 | +@Component({ | |
7 | + selector: 'profile', | |
8 | + templateUrl: "app/profile/info/profile-info.html", | |
9 | + providers: [provide('profileService', { useClass: ProfileService })], | |
10 | + directives: [ProfileDataComponent], | |
11 | + pipes: [TranslateProfile] | |
12 | +}) | |
13 | +@Inject(ProfileService) | |
14 | +@Inject("amDateFormatFilter") | |
15 | +export class ProfileInfoComponent { | |
16 | + profile: noosfero.Profile; | |
17 | + | |
18 | + constructor(private profileService: ProfileService, private amDateFormatFilter: any) { | |
19 | + this.init(); | |
20 | + } | |
21 | + | |
22 | + init() { | |
23 | + this.profileService.getCurrentProfile().then((profile: noosfero.Profile) => { | |
24 | + this.profile = profile; | |
25 | + }); | |
26 | + } | |
27 | +} | ... | ... |
themes/angular-rede-brasil/app/profile/info/profile-info.html
0 → 100644
... | ... | @@ -0,0 +1,20 @@ |
1 | +<div class="profile-wall"> | |
2 | + <div class="col-lg-3 col-md-4 col-sm-4"> | |
3 | + <div class="main-box clearfix"> | |
4 | + <header class="main-box-header clearfix"> | |
5 | + <h2>{{vm.profile.name}}</h2> | |
6 | + </header> | |
7 | + <div id="profile-left" class="main-box-body clearfix"> | |
8 | + <noosfero-profile-image [profile]="vm.profile" class="img-responsive center-block"></noosfero-profile-image> | |
9 | + <span class="label" ng-class="{'label-danger': vm.profile.type == 'Community', 'label-info': vm.profile.type == 'Person'}">{{vm.profile | translateProfile}}</span> | |
10 | + <div class="profile-since"> | |
11 | + {{"profile.member_since" | translate}}: {{vm.profile.created_at | amDateFormat:'MMMM YYYY'}} | |
12 | + </div> | |
13 | + </div> | |
14 | + </div> | |
15 | + </div> | |
16 | + | |
17 | + <div class="col-lg-9 col-md-8 col-sm-8"> | |
18 | + <profile-wall [profile]="vm.profile"></profile-wall> | |
19 | + </div> | |
20 | +</div> | ... | ... |