Commit 0ae45e2e8e97d9ec6feb97c9091d340ab1b7d979

Authored by Victor Costa
1 parent 5518709d

Add the ommunities block

src/app/layout/blocks/communities-block/communities-block.component.ts 0 → 100644
@@ -0,0 +1,25 @@ @@ -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
@@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
  1 +<div class="communities-block">
  2 + <a ng-repeat="profile in ctrl.profiles" ui-sref="main.profile.home({profile: profile.identifier})" class="profile">
  3 + <noosfero-profile-image [profile]="profile"></noosfero-profile-image>
  4 + </a>
  5 +</div>
src/app/layout/blocks/communities-block/communities-block.scss 0 → 100644
@@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
  1 +.communities-block {
  2 + .profile {
  3 + margin: 10px;
  4 + img, i.profile-image {
  5 + width: 60px;
  6 + }
  7 + img {
  8 + display: inline-block;
  9 + vertical-align: top;
  10 + }
  11 + i.profile-image {
  12 + text-align: center;
  13 + font-size: 4.5em;
  14 + }
  15 + }
  16 +}
src/app/main/main.component.ts
@@ -12,6 +12,7 @@ import {ProfileImageBlockComponent} from &quot;../layout/blocks/profile-image-block/p @@ -12,6 +12,7 @@ import {ProfileImageBlockComponent} from &quot;../layout/blocks/profile-image-block/p
12 import {RawHTMLBlockComponent} from "../layout/blocks/raw-html/raw-html.component"; 12 import {RawHTMLBlockComponent} from "../layout/blocks/raw-html/raw-html.component";
13 13
14 import {MembersBlockComponent} from "./../layout/blocks/members-block/members-block.component"; 14 import {MembersBlockComponent} from "./../layout/blocks/members-block/members-block.component";
  15 +import {CommunitiesBlockComponent} from "./../layout/blocks/communities-block/communities-block.component";
15 import {NoosferoTemplate} from "../shared/pipes/noosfero-template.filter"; 16 import {NoosferoTemplate} from "../shared/pipes/noosfero-template.filter";
16 import {DateFormat} from "../shared/pipes/date-format.filter"; 17 import {DateFormat} from "../shared/pipes/date-format.filter";
17 18
@@ -69,7 +70,7 @@ export class MainContentComponent { @@ -69,7 +70,7 @@ export class MainContentComponent {
69 directives: [ 70 directives: [
70 ArticleBlogComponent, ArticleViewComponent, BoxesComponent, BlockComponent, LinkListBlockComponent, 71 ArticleBlogComponent, ArticleViewComponent, BoxesComponent, BlockComponent, LinkListBlockComponent,
71 MainBlockComponent, RecentDocumentsBlockComponent, Navbar, ProfileImageBlockComponent, 72 MainBlockComponent, RecentDocumentsBlockComponent, Navbar, ProfileImageBlockComponent,
72 - MembersBlockComponent, NoosferoTemplate, DateFormat, RawHTMLBlockComponent 73 + MembersBlockComponent, NoosferoTemplate, DateFormat, RawHTMLBlockComponent, CommunitiesBlockComponent
73 ], 74 ],
74 providers: [AuthService, SessionService, NotificationService, BodyStateClassesService] 75 providers: [AuthService, SessionService, NotificationService, BodyStateClassesService]
75 }) 76 })