diff --git a/src/app/layout/blocks/recent-activities-plugin-activities/index.ts b/src/app/layout/blocks/recent-activities-plugin-activities/index.ts new file mode 100644 index 0000000..b2fc82b --- /dev/null +++ b/src/app/layout/blocks/recent-activities-plugin-activities/index.ts @@ -0,0 +1,2 @@ +/* Module Index Entry - generated using the script npm run generate-index */ +export * from "./recent-activities-plugin-activities-block.component"; diff --git a/src/app/layout/blocks/recent-activities-plugin-activities/recent-activities-plugin-activities-block.component.spec.ts b/src/app/layout/blocks/recent-activities-plugin-activities/recent-activities-plugin-activities-block.component.spec.ts new file mode 100644 index 0000000..70b786d --- /dev/null +++ b/src/app/layout/blocks/recent-activities-plugin-activities/recent-activities-plugin-activities-block.component.spec.ts @@ -0,0 +1 @@ +// TODO diff --git a/src/app/layout/blocks/recent-activities-plugin-activities/recent-activities-plugin-activities-block.component.ts b/src/app/layout/blocks/recent-activities-plugin-activities/recent-activities-plugin-activities-block.component.ts new file mode 100644 index 0000000..a6680c2 --- /dev/null +++ b/src/app/layout/blocks/recent-activities-plugin-activities/recent-activities-plugin-activities-block.component.ts @@ -0,0 +1,32 @@ +import {Component, Inject, Input} from "ng-forward"; +import {BlockService} from "../../../../lib/ng-noosfero-api/http/block.service"; +import {Arrays} from "./../../../../lib/util/arrays"; + +@Component({ + selector: "noosfero-recent-activities-plugin-activities-block", + templateUrl: 'app/layout/blocks/recent-activities-plugin-activities/recent-activities-plugin-activities-block.html' +}) +@Inject(BlockService, "$state") +export class RecentActivitiesPluginActivitiesBlockComponent { + + @Input() block: any; + @Input() owner: any; + + profile: any; + activities: any; + + constructor(private blockService: BlockService, private $state: any) { } + + ngOnInit() { + this.profile = this.owner; + this.activities = []; + this.blockService.getApiContent(this.block).then((content: any) => { + let activities: any = []; + for (let i = 0; i < content.activities.length; i++) { + let activity = content.activities[i]; + activities.push({ created_at: activity.created_at, description: 'TODO' }); + } + this.activities = activities.slice(); + }); + } +} diff --git a/src/app/layout/blocks/recent-activities-plugin-activities/recent-activities-plugin-activities-block.html b/src/app/layout/blocks/recent-activities-plugin-activities/recent-activities-plugin-activities-block.html new file mode 100644 index 0000000..70a5b5a --- /dev/null +++ b/src/app/layout/blocks/recent-activities-plugin-activities/recent-activities-plugin-activities-block.html @@ -0,0 +1,13 @@ +