diff --git a/src/app/profile/info/profile-info.html b/src/app/profile/info/profile-info.html index c4268ea..14afdca 100644 --- a/src/app/profile/info/profile-info.html +++ b/src/app/profile/info/profile-info.html @@ -15,6 +15,5 @@
-
diff --git a/themes/angular-participa-consulta/app/profile/info/.profile-info.html.swp b/themes/angular-participa-consulta/app/profile/info/.profile-info.html.swp new file mode 100644 index 0000000..8f90a09 Binary files /dev/null and b/themes/angular-participa-consulta/app/profile/info/.profile-info.html.swp differ diff --git a/themes/angular-participa-consulta/app/profile/info/index.ts b/themes/angular-participa-consulta/app/profile/info/index.ts new file mode 100644 index 0000000..00329c7 --- /dev/null +++ b/themes/angular-participa-consulta/app/profile/info/index.ts @@ -0,0 +1,2 @@ +/* Module Index Entry - generated using the script npm run generate-index */ +export * from "./profile-info.component"; diff --git a/themes/angular-participa-consulta/app/profile/info/profile-info.component.spec.ts b/themes/angular-participa-consulta/app/profile/info/profile-info.component.spec.ts new file mode 100644 index 0000000..675ca2a --- /dev/null +++ b/themes/angular-participa-consulta/app/profile/info/profile-info.component.spec.ts @@ -0,0 +1,42 @@ +import {quickCreateComponent} from "../../../spec/helpers"; +import {ProfileInfoComponent} from "./profile-info.component"; + +describe("Components", () => { + describe("Profile Info Component", () => { + + let $rootScope: ng.IRootScopeService; + let $q: ng.IQService; + let profileServiceMock: any; + let $stateParams: any; + let amDateFormatMock: any; + + beforeEach(inject((_$rootScope_: ng.IRootScopeService, _$q_: ng.IQService) => { + $rootScope = _$rootScope_; + $q = _$q_; + })); + + beforeEach(() => { + $stateParams = jasmine.createSpyObj("$stateParams", ["profile"]); + profileServiceMock = jasmine.createSpyObj("profileServiceMock", ["getCurrentProfile", "getActivities"]); + amDateFormatMock = jasmine.createSpyObj("amDateFormatMock", ["transform"]); + + let getCurrentProfileResponse = $q.defer(); + getCurrentProfileResponse.resolve({ id: 1 }); + + let getActivitiesResponse = $q.defer(); + getActivitiesResponse.resolve({ data: { activities: [{ id: 1 }, { id: 2 }] } }); + + profileServiceMock.getCurrentProfile = jasmine.createSpy("getCurrentProfile").and.returnValue(getCurrentProfileResponse.promise); + profileServiceMock.getActivities = jasmine.createSpy("getActivities").and.returnValue(getActivitiesResponse.promise); + }); + + it("get the profile activities", done => { + let component: ProfileInfoComponent = new ProfileInfoComponent(profileServiceMock, amDateFormatMock); + $rootScope.$apply(); + expect(profileServiceMock.getCurrentProfile).toHaveBeenCalled(); + expect(profileServiceMock.getActivities).toHaveBeenCalled(); + expect(component.activities).toEqual([{ id: 1 }, { id: 2 }]); + done(); + }); + }); +}); diff --git a/themes/angular-participa-consulta/app/profile/info/profile-info.component.ts b/themes/angular-participa-consulta/app/profile/info/profile-info.component.ts new file mode 100644 index 0000000..11b5bf4 --- /dev/null +++ b/themes/angular-participa-consulta/app/profile/info/profile-info.component.ts @@ -0,0 +1,27 @@ +import {StateConfig, Component, Inject, provide} from 'ng-forward'; +import {ProfileService} from "../../../lib/ng-noosfero-api/http/profile.service"; +import {ProfileDataComponent} from "../data/profile-data.component"; +import {TranslateProfile} from "../../shared/pipes/translate-profile.filter"; + +@Component({ + selector: 'profile', + templateUrl: "app/profile/info/profile-info.html", + providers: [provide('profileService', { useClass: ProfileService })], + directives: [ProfileDataComponent], + pipes: [TranslateProfile] +}) +@Inject(ProfileService) +@Inject("amDateFormatFilter") +export class ProfileInfoComponent { + profile: noosfero.Profile; + + constructor(private profileService: ProfileService, private amDateFormatFilter: any) { + this.init(); + } + + init() { + this.profileService.getCurrentProfile().then((profile: noosfero.Profile) => { + this.profile = profile; + }); + } +} diff --git a/themes/angular-participa-consulta/app/profile/info/profile-info.html b/themes/angular-participa-consulta/app/profile/info/profile-info.html new file mode 100644 index 0000000..c4268ea --- /dev/null +++ b/themes/angular-participa-consulta/app/profile/info/profile-info.html @@ -0,0 +1,20 @@ +
+
+
+
+

{{vm.profile.name}}

+
+
+ + {{vm.profile | translateProfile}} +
+ {{"profile.member_since" | translate}}: {{vm.profile.created_at | amDateFormat:'MMMM YYYY'}} +
+
+
+
+ +
+ +
+
diff --git a/themes/angular-rede-brasil/app/profile/info/.profile-info.html.swp b/themes/angular-rede-brasil/app/profile/info/.profile-info.html.swp new file mode 100644 index 0000000..8f90a09 Binary files /dev/null and b/themes/angular-rede-brasil/app/profile/info/.profile-info.html.swp differ diff --git a/themes/angular-rede-brasil/app/profile/info/index.ts b/themes/angular-rede-brasil/app/profile/info/index.ts new file mode 100644 index 0000000..00329c7 --- /dev/null +++ b/themes/angular-rede-brasil/app/profile/info/index.ts @@ -0,0 +1,2 @@ +/* Module Index Entry - generated using the script npm run generate-index */ +export * from "./profile-info.component"; diff --git a/themes/angular-rede-brasil/app/profile/info/profile-info.component.spec.ts b/themes/angular-rede-brasil/app/profile/info/profile-info.component.spec.ts new file mode 100644 index 0000000..675ca2a --- /dev/null +++ b/themes/angular-rede-brasil/app/profile/info/profile-info.component.spec.ts @@ -0,0 +1,42 @@ +import {quickCreateComponent} from "../../../spec/helpers"; +import {ProfileInfoComponent} from "./profile-info.component"; + +describe("Components", () => { + describe("Profile Info Component", () => { + + let $rootScope: ng.IRootScopeService; + let $q: ng.IQService; + let profileServiceMock: any; + let $stateParams: any; + let amDateFormatMock: any; + + beforeEach(inject((_$rootScope_: ng.IRootScopeService, _$q_: ng.IQService) => { + $rootScope = _$rootScope_; + $q = _$q_; + })); + + beforeEach(() => { + $stateParams = jasmine.createSpyObj("$stateParams", ["profile"]); + profileServiceMock = jasmine.createSpyObj("profileServiceMock", ["getCurrentProfile", "getActivities"]); + amDateFormatMock = jasmine.createSpyObj("amDateFormatMock", ["transform"]); + + let getCurrentProfileResponse = $q.defer(); + getCurrentProfileResponse.resolve({ id: 1 }); + + let getActivitiesResponse = $q.defer(); + getActivitiesResponse.resolve({ data: { activities: [{ id: 1 }, { id: 2 }] } }); + + profileServiceMock.getCurrentProfile = jasmine.createSpy("getCurrentProfile").and.returnValue(getCurrentProfileResponse.promise); + profileServiceMock.getActivities = jasmine.createSpy("getActivities").and.returnValue(getActivitiesResponse.promise); + }); + + it("get the profile activities", done => { + let component: ProfileInfoComponent = new ProfileInfoComponent(profileServiceMock, amDateFormatMock); + $rootScope.$apply(); + expect(profileServiceMock.getCurrentProfile).toHaveBeenCalled(); + expect(profileServiceMock.getActivities).toHaveBeenCalled(); + expect(component.activities).toEqual([{ id: 1 }, { id: 2 }]); + done(); + }); + }); +}); diff --git a/themes/angular-rede-brasil/app/profile/info/profile-info.component.ts b/themes/angular-rede-brasil/app/profile/info/profile-info.component.ts new file mode 100644 index 0000000..11b5bf4 --- /dev/null +++ b/themes/angular-rede-brasil/app/profile/info/profile-info.component.ts @@ -0,0 +1,27 @@ +import {StateConfig, Component, Inject, provide} from 'ng-forward'; +import {ProfileService} from "../../../lib/ng-noosfero-api/http/profile.service"; +import {ProfileDataComponent} from "../data/profile-data.component"; +import {TranslateProfile} from "../../shared/pipes/translate-profile.filter"; + +@Component({ + selector: 'profile', + templateUrl: "app/profile/info/profile-info.html", + providers: [provide('profileService', { useClass: ProfileService })], + directives: [ProfileDataComponent], + pipes: [TranslateProfile] +}) +@Inject(ProfileService) +@Inject("amDateFormatFilter") +export class ProfileInfoComponent { + profile: noosfero.Profile; + + constructor(private profileService: ProfileService, private amDateFormatFilter: any) { + this.init(); + } + + init() { + this.profileService.getCurrentProfile().then((profile: noosfero.Profile) => { + this.profile = profile; + }); + } +} diff --git a/themes/angular-rede-brasil/app/profile/info/profile-info.html b/themes/angular-rede-brasil/app/profile/info/profile-info.html new file mode 100644 index 0000000..c4268ea --- /dev/null +++ b/themes/angular-rede-brasil/app/profile/info/profile-info.html @@ -0,0 +1,20 @@ +
+
+
+
+

{{vm.profile.name}}

+
+
+ + {{vm.profile | translateProfile}} +
+ {{"profile.member_since" | translate}}: {{vm.profile.created_at | amDateFormat:'MMMM YYYY'}} +
+
+
+
+ +
+ +
+
-- libgit2 0.21.2