diff --git a/src/app/layout/blocks/statistics/index.ts b/src/app/layout/blocks/statistics/index.ts new file mode 100644 index 0000000..8c20ff2 --- /dev/null +++ b/src/app/layout/blocks/statistics/index.ts @@ -0,0 +1,2 @@ +/* Module Index Entry - generated using the script npm run generate-index */ +export * from "./statistics-block.component"; diff --git a/src/app/layout/blocks/statistics/statistics-block.component.spec.ts b/src/app/layout/blocks/statistics/statistics-block.component.spec.ts new file mode 100644 index 0000000..eb18139 --- /dev/null +++ b/src/app/layout/blocks/statistics/statistics-block.component.spec.ts @@ -0,0 +1,36 @@ +import {TestComponentBuilder} from 'ng-forward/cjs/testing/test-component-builder'; +import {Component} from 'ng-forward'; + +import {StatisticsBlockComponent} from './statistics-block.component'; + +const tcb = new TestComponentBuilder(); + +const htmlTemplate: string = ''; + +describe("Components", () => { + + describe("Statistics Block Component", () => { + + beforeEach(angular.mock.module("templates")); + beforeEach(angular.mock.module("ngSanitize")); + + it("display title stored in block attribute", done => { + + @Component({ + selector: 'test-container-component', + template: htmlTemplate, + directives: [StatisticsBlockComponent], + }) + class CustomBlockType { + block: any = { settings: { user_counter: 'block content' } }; + owner: any = { name: 'profile-name' }; + } + tcb.createAsync(CustomBlockType).then(fixture => { + expect(fixture.debugElement.query(".statistics-block").text().trim()).toEqual('block content'); + done(); + }); + }); + + }); + +}); diff --git a/src/app/layout/blocks/statistics/statistics-block.component.ts b/src/app/layout/blocks/statistics/statistics-block.component.ts new file mode 100644 index 0000000..ad9cda9 --- /dev/null +++ b/src/app/layout/blocks/statistics/statistics-block.component.ts @@ -0,0 +1,18 @@ +import {Component, Input} from "ng-forward"; + +@Component({ + selector: "noosfero-statistics-block", + templateUrl: 'app/layout/blocks/statistics/statistics-block.html' +}) + +export class StatisticsBlockComponent { + + @Input() block: any; + @Input() owner: any; + + html: string; + + ngOnInit() { + this.html = this.block.settings.user_counter; + } +} diff --git a/src/app/layout/blocks/statistics/statistics-block.html b/src/app/layout/blocks/statistics/statistics-block.html new file mode 100644 index 0000000..fac39a9 --- /dev/null +++ b/src/app/layout/blocks/statistics/statistics-block.html @@ -0,0 +1,2 @@ +
+
diff --git a/src/app/main/main.component.ts b/src/app/main/main.component.ts index 3ac006c..50bf462 100644 --- a/src/app/main/main.component.ts +++ b/src/app/main/main.component.ts @@ -14,9 +14,12 @@ import {LinkListBlockComponent} from "./../layout/blocks/link-list/link-list-blo import {RecentDocumentsBlockComponent} from "../layout/blocks/recent-documents/recent-documents-block.component"; import {ProfileImageBlockComponent} from "../layout/blocks/profile-image/profile-image-block.component"; import {RawHTMLBlockComponent} from "../layout/blocks/raw-html/raw-html-block.component"; +import {StatisticsBlockComponent} from "../layout/blocks/statistics/statistics-block.component"; import {MembersBlockComponent} from "./../layout/blocks/members/members-block.component"; import {CommunitiesBlockComponent} from "./../layout/blocks/communities/communities-block.component"; + + import {NoosferoTemplate} from "../shared/pipes/noosfero-template.filter"; import {DateFormat} from "../shared/pipes/date-format.filter"; @@ -92,9 +95,16 @@ export class EnvironmentContent { ArticleBlogComponent, ArticleViewComponent, BoxesComponent, BlockComponent, EnvironmentComponent, PeopleBlockComponent, LinkListBlockComponent, CommunitiesBlockComponent, HtmlEditorComponent, +<<<<<<< HEAD MainBlockComponent, RecentDocumentsBlockComponent, Navbar, SidebarComponent, ProfileImageBlockComponent, MembersBlockComponent, NoosferoTemplate, DateFormat, RawHTMLBlockComponent ].concat(plugins.mainComponents).concat(plugins.hotspots), +======= + MainBlockComponent, RecentDocumentsBlockComponent, Navbar, ProfileImageBlockComponent, + MembersBlockComponent, NoosferoTemplate, DateFormat, RawHTMLBlockComponent, + StatisticsBlockComponent + ], +>>>>>>> adding basic information of statisticst block providers: [AuthService, SessionService, NotificationService, BodyStateClassesService] }) @StateConfig([ -- libgit2 0.21.2