Commit 0ae45e2e8e97d9ec6feb97c9091d340ab1b7d979
1 parent
5518709d
Exists in
master
and in
30 other branches
Add the ommunities block
Showing
4 changed files
with
48 additions
and
1 deletions
Show diff stats
src/app/layout/blocks/communities-block/communities-block.component.ts
0 → 100644
| ... | ... | @@ -0,0 +1,25 @@ |
| 1 | +import {Input, Inject, Component} from "ng-forward"; | |
| 2 | +import {CommunityService} from "../../../../lib/ng-noosfero-api/http/community.service"; | |
| 3 | + | |
| 4 | +@Component({ | |
| 5 | + selector: "noosfero-communities-block", | |
| 6 | + templateUrl: 'app/layout/blocks/communities-block/communities-block.html', | |
| 7 | +}) | |
| 8 | +@Inject(CommunityService) | |
| 9 | +export class CommunitiesBlockComponent { | |
| 10 | + | |
| 11 | + @Input() block: noosfero.Block; | |
| 12 | + @Input() owner: noosfero.Profile; | |
| 13 | + | |
| 14 | + profiles: any = []; | |
| 15 | + | |
| 16 | + constructor(private communityService: CommunityService) { } | |
| 17 | + | |
| 18 | + ngOnInit() { | |
| 19 | + let limit = ((this.block && this.block['settings']) ? this.block['settings'].limit : null) || 5; | |
| 20 | + | |
| 21 | + this.communityService.list(null, { limit: limit }).then((result: noosfero.RestResult<noosfero.Community[]>) => { | |
| 22 | + this.profiles = result.data; | |
| 23 | + }); | |
| 24 | + } | |
| 25 | +} | ... | ... |
src/app/layout/blocks/communities-block/communities-block.html
0 → 100644
src/app/layout/blocks/communities-block/communities-block.scss
0 → 100644
src/app/main/main.component.ts
| ... | ... | @@ -12,6 +12,7 @@ import {ProfileImageBlockComponent} from "../layout/blocks/profile-image-block/p |
| 12 | 12 | import {RawHTMLBlockComponent} from "../layout/blocks/raw-html/raw-html.component"; |
| 13 | 13 | |
| 14 | 14 | import {MembersBlockComponent} from "./../layout/blocks/members-block/members-block.component"; |
| 15 | +import {CommunitiesBlockComponent} from "./../layout/blocks/communities-block/communities-block.component"; | |
| 15 | 16 | import {NoosferoTemplate} from "../shared/pipes/noosfero-template.filter"; |
| 16 | 17 | import {DateFormat} from "../shared/pipes/date-format.filter"; |
| 17 | 18 | |
| ... | ... | @@ -69,7 +70,7 @@ export class MainContentComponent { |
| 69 | 70 | directives: [ |
| 70 | 71 | ArticleBlogComponent, ArticleViewComponent, BoxesComponent, BlockComponent, LinkListBlockComponent, |
| 71 | 72 | MainBlockComponent, RecentDocumentsBlockComponent, Navbar, ProfileImageBlockComponent, |
| 72 | - MembersBlockComponent, NoosferoTemplate, DateFormat, RawHTMLBlockComponent | |
| 73 | + MembersBlockComponent, NoosferoTemplate, DateFormat, RawHTMLBlockComponent, CommunitiesBlockComponent | |
| 73 | 74 | ], |
| 74 | 75 | providers: [AuthService, SessionService, NotificationService, BodyStateClassesService] |
| 75 | 76 | }) | ... | ... |