From 56073cfd137e5abfd506998e57df17ed03117175 Mon Sep 17 00:00:00 2001 From: Leandro Nunes dos Santos Date: Tue, 10 May 2016 09:16:22 -0300 Subject: [PATCH] refactoring profile image block --- src/app/layout/blocks/profile-image-block/index.ts | 2 -- src/app/layout/blocks/profile-image-block/profile-image-block.component.spec.ts | 46 ---------------------------------------------- src/app/layout/blocks/profile-image-block/profile-image-block.component.ts | 14 -------------- src/app/layout/blocks/profile-image-block/profile-image-block.html | 6 ------ src/app/layout/blocks/profile-image-block/profile-image-block.scss | 5 ----- src/app/layout/blocks/profile-image/index.ts | 2 ++ src/app/layout/blocks/profile-image/profile-image-block.component.spec.ts | 46 ++++++++++++++++++++++++++++++++++++++++++++++ src/app/layout/blocks/profile-image/profile-image-block.component.ts | 14 ++++++++++++++ src/app/layout/blocks/profile-image/profile-image-block.html | 6 ++++++ src/app/layout/blocks/profile-image/profile-image-block.scss | 5 +++++ src/app/main/main.component.ts | 2 +- 11 files changed, 74 insertions(+), 74 deletions(-) delete mode 100644 src/app/layout/blocks/profile-image-block/index.ts delete mode 100644 src/app/layout/blocks/profile-image-block/profile-image-block.component.spec.ts delete mode 100644 src/app/layout/blocks/profile-image-block/profile-image-block.component.ts delete mode 100644 src/app/layout/blocks/profile-image-block/profile-image-block.html delete mode 100644 src/app/layout/blocks/profile-image-block/profile-image-block.scss create mode 100644 src/app/layout/blocks/profile-image/index.ts create mode 100644 src/app/layout/blocks/profile-image/profile-image-block.component.spec.ts create mode 100644 src/app/layout/blocks/profile-image/profile-image-block.component.ts create mode 100644 src/app/layout/blocks/profile-image/profile-image-block.html create mode 100644 src/app/layout/blocks/profile-image/profile-image-block.scss diff --git a/src/app/layout/blocks/profile-image-block/index.ts b/src/app/layout/blocks/profile-image-block/index.ts deleted file mode 100644 index 4da4b46..0000000 --- a/src/app/layout/blocks/profile-image-block/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -/* Module Index Entry - generated using the script npm run generate-index */ -export * from "./profile-image-block.component"; diff --git a/src/app/layout/blocks/profile-image-block/profile-image-block.component.spec.ts b/src/app/layout/blocks/profile-image-block/profile-image-block.component.spec.ts deleted file mode 100644 index 42bf07a..0000000 --- a/src/app/layout/blocks/profile-image-block/profile-image-block.component.spec.ts +++ /dev/null @@ -1,46 +0,0 @@ -import {TestComponentBuilder, ComponentFixture} from 'ng-forward/cjs/testing/test-component-builder'; -import {Pipe, Input, provide, Component} from 'ng-forward'; - -import {ProfileImageBlockComponent} from './profile-image-block.component'; - -import * as helpers from "./../../../../spec/helpers"; - -const tcb = new TestComponentBuilder(); - -const htmlTemplate: string = ''; - -describe("Components", () => { - - describe("Profile Image Block Component", () => { - - beforeEach(angular.mock.module("templates")); - - @Component({ - selector: 'test-container-component', - template: htmlTemplate, - directives: [ProfileImageBlockComponent], - providers: helpers.provideFilters("translateFilter") - }) - class BlockContainerComponent { - block = { type: 'Block' }; - owner = { name: 'profile-name' }; - constructor() { - } - } - - it("show image if present", () => { - helpers.tcb.createAsync(BlockContainerComponent).then(fixture => { - let elProfile = fixture.debugElement.componentViewChildren[0]; - expect(elProfile.query('div.profile-image-block').length).toEqual(1); - }); - }); - - it("has link to the profile", () => { - helpers.tcb.createAsync(BlockContainerComponent).then(fixture => { - let elProfile = fixture.debugElement.componentViewChildren[0]; - expect(elProfile.query('a.settings-link').length).toEqual(1); - }); - }); - - }); -}); diff --git a/src/app/layout/blocks/profile-image-block/profile-image-block.component.ts b/src/app/layout/blocks/profile-image-block/profile-image-block.component.ts deleted file mode 100644 index c13fed2..0000000 --- a/src/app/layout/blocks/profile-image-block/profile-image-block.component.ts +++ /dev/null @@ -1,14 +0,0 @@ -import {Inject, Input, Component} from "ng-forward"; -import {ProfileImageComponent} from "./../../../profile/image/image.component"; - -@Component({ - selector: "noosfero-profile-image-block", - templateUrl: 'app/layout/blocks/profile-image-block/profile-image-block.html', - directives: [ProfileImageComponent] -}) -export class ProfileImageBlockComponent { - - @Input() block: noosfero.Block; - @Input() owner: noosfero.Profile; - -} diff --git a/src/app/layout/blocks/profile-image-block/profile-image-block.html b/src/app/layout/blocks/profile-image-block/profile-image-block.html deleted file mode 100644 index f9159e3..0000000 --- a/src/app/layout/blocks/profile-image-block/profile-image-block.html +++ /dev/null @@ -1,6 +0,0 @@ -
- - - - {{"blocks.profile_image.control_panel" | translate}} -
diff --git a/src/app/layout/blocks/profile-image-block/profile-image-block.scss b/src/app/layout/blocks/profile-image-block/profile-image-block.scss deleted file mode 100644 index a609250..0000000 --- a/src/app/layout/blocks/profile-image-block/profile-image-block.scss +++ /dev/null @@ -1,5 +0,0 @@ -.profile-image-block { - .settings-link { - display: block; - } -} diff --git a/src/app/layout/blocks/profile-image/index.ts b/src/app/layout/blocks/profile-image/index.ts new file mode 100644 index 0000000..4da4b46 --- /dev/null +++ b/src/app/layout/blocks/profile-image/index.ts @@ -0,0 +1,2 @@ +/* Module Index Entry - generated using the script npm run generate-index */ +export * from "./profile-image-block.component"; diff --git a/src/app/layout/blocks/profile-image/profile-image-block.component.spec.ts b/src/app/layout/blocks/profile-image/profile-image-block.component.spec.ts new file mode 100644 index 0000000..42bf07a --- /dev/null +++ b/src/app/layout/blocks/profile-image/profile-image-block.component.spec.ts @@ -0,0 +1,46 @@ +import {TestComponentBuilder, ComponentFixture} from 'ng-forward/cjs/testing/test-component-builder'; +import {Pipe, Input, provide, Component} from 'ng-forward'; + +import {ProfileImageBlockComponent} from './profile-image-block.component'; + +import * as helpers from "./../../../../spec/helpers"; + +const tcb = new TestComponentBuilder(); + +const htmlTemplate: string = ''; + +describe("Components", () => { + + describe("Profile Image Block Component", () => { + + beforeEach(angular.mock.module("templates")); + + @Component({ + selector: 'test-container-component', + template: htmlTemplate, + directives: [ProfileImageBlockComponent], + providers: helpers.provideFilters("translateFilter") + }) + class BlockContainerComponent { + block = { type: 'Block' }; + owner = { name: 'profile-name' }; + constructor() { + } + } + + it("show image if present", () => { + helpers.tcb.createAsync(BlockContainerComponent).then(fixture => { + let elProfile = fixture.debugElement.componentViewChildren[0]; + expect(elProfile.query('div.profile-image-block').length).toEqual(1); + }); + }); + + it("has link to the profile", () => { + helpers.tcb.createAsync(BlockContainerComponent).then(fixture => { + let elProfile = fixture.debugElement.componentViewChildren[0]; + expect(elProfile.query('a.settings-link').length).toEqual(1); + }); + }); + + }); +}); diff --git a/src/app/layout/blocks/profile-image/profile-image-block.component.ts b/src/app/layout/blocks/profile-image/profile-image-block.component.ts new file mode 100644 index 0000000..d82e600 --- /dev/null +++ b/src/app/layout/blocks/profile-image/profile-image-block.component.ts @@ -0,0 +1,14 @@ +import {Inject, Input, Component} from "ng-forward"; +import {ProfileImageComponent} from "./../../../profile/image/image.component"; + +@Component({ + selector: "noosfero-profile-image-block", + templateUrl: 'app/layout/blocks/profile-image/profile-image-block.html', + directives: [ProfileImageComponent] +}) +export class ProfileImageBlockComponent { + + @Input() block: noosfero.Block; + @Input() owner: noosfero.Profile; + +} diff --git a/src/app/layout/blocks/profile-image/profile-image-block.html b/src/app/layout/blocks/profile-image/profile-image-block.html new file mode 100644 index 0000000..f9159e3 --- /dev/null +++ b/src/app/layout/blocks/profile-image/profile-image-block.html @@ -0,0 +1,6 @@ +
+ + + + {{"blocks.profile_image.control_panel" | translate}} +
diff --git a/src/app/layout/blocks/profile-image/profile-image-block.scss b/src/app/layout/blocks/profile-image/profile-image-block.scss new file mode 100644 index 0000000..a609250 --- /dev/null +++ b/src/app/layout/blocks/profile-image/profile-image-block.scss @@ -0,0 +1,5 @@ +.profile-image-block { + .settings-link { + display: block; + } +} diff --git a/src/app/main/main.component.ts b/src/app/main/main.component.ts index 9becb2d..1c6cc2c 100644 --- a/src/app/main/main.component.ts +++ b/src/app/main/main.component.ts @@ -12,7 +12,7 @@ import {EnvironmentHomeComponent} from "../environment/environment-home.componen import {PeopleBlockComponent} from "../layout/blocks/people/people-block.component"; import {LinkListBlockComponent} from "./../layout/blocks/link-list/link-list-block.component"; import {RecentDocumentsBlockComponent} from "../layout/blocks/recent-documents/recent-documents.component"; -import {ProfileImageBlockComponent} from "../layout/blocks/profile-image-block/profile-image-block.component"; +import {ProfileImageBlockComponent} from "../layout/blocks/profile-image/profile-image-block.component"; import {RawHTMLBlockComponent} from "../layout/blocks/raw-html/raw-html.component"; import {MembersBlockComponent} from "./../layout/blocks/members/members-block.component"; -- libgit2 0.21.2