Compare View

switch
from
...
to
 
Commits (4)
src/app/layout/blocks/recent-activities-plugin-activities/activities/add_member_in_community.html 0 → 100644
... ... @@ -0,0 +1 @@
  1 +{{'joined the community' | translate}}
... ...
src/app/layout/blocks/recent-activities-plugin-activities/activities/create_article.html 0 → 100644
... ... @@ -0,0 +1 @@
  1 +{{'published an article:' | translate}} <a ng-href="{{ctrl.urlFor(activity.params.url)}}">{{activity.params.name}}</a>
... ...
src/app/layout/blocks/recent-activities-plugin-activities/activities/favorite_enterprise.html 0 → 100644
... ... @@ -0,0 +1 @@
  1 +{{'favorited an enterprise:' | translate}} <a ng-href="{{ctrl.urlFor(activity.params.enterprise_url)}}">{{activity.params.enterprise_name}}</a>
... ...
src/app/layout/blocks/recent-activities-plugin-activities/activities/new_friendship.html 0 → 100644
... ... @@ -0,0 +1,6 @@
  1 +{{'has made new friends:' | translate}}<br />
  2 +<span ng-repeat="name in activity.params.friend_name">
  3 + <a ng-href="{{ctrl.urlFor(activity.params.friend_url[$index])}}" ng-attr-title="{{name}}">
  4 + <img ng-src="{{activity.params.friend_profile_custom_icon[$index]}}" ng-attr-alt="{{name}}" />
  5 + </a>
  6 +</span>
... ...
src/app/layout/blocks/recent-activities-plugin-activities/activities/upload_image.html 0 → 100644
... ... @@ -0,0 +1,6 @@
  1 +{{'uploaded images:' | translate}}<br />
  2 +<span ng-repeat="path in activity.params.thumbnail_path">
  3 + <a class="upimg" ng-href="{{ctrl.urlFor(activity.params.view_url[$index])}}" ng-style="{'background-image':'url({{path}})'}">
  4 + <span>{{path}}</span>
  5 + </a>
  6 +</span>
... ...
src/app/layout/blocks/recent-activities-plugin-activities/index.ts 0 → 100644
... ... @@ -0,0 +1,2 @@
  1 +/* Module Index Entry - generated using the script npm run generate-index */
  2 +export * from "./recent-activities-plugin-activities-block.component";
... ...
src/app/layout/blocks/recent-activities-plugin-activities/recent-activities-plugin-activities-block.component.spec.ts 0 → 100644
... ... @@ -0,0 +1,56 @@
  1 +import {TestComponentBuilder} from 'ng-forward/cjs/testing/test-component-builder';
  2 +import {Provider, Input, provide, Component} from 'ng-forward';
  3 +import {provideFilters} from '../../../../spec/helpers';
  4 +import {RecentActivitiesPluginActivitiesBlockComponent} from './recent-activities-plugin-activities-block.component';
  5 +import * as helpers from "./../../../../spec/helpers";
  6 +
  7 +const htmlTemplate: string = '<noosfero-recent-activities-plugin-activities-block [block]="ctrl.block" [owner]="ctrl.owner"></noosfero-recent-activities-plugin-activities-block>';
  8 +
  9 +const tcb = new TestComponentBuilder();
  10 +
  11 +describe("Components", () => {
  12 + describe("Recent Activities Block Component", () => {
  13 +
  14 + let settingsObj = {};
  15 + let person = <noosfero.Person>{ name: "Person" };
  16 + let mockedService = {
  17 + getApiContent: (block: noosfero.Block): any => {
  18 + return Promise.resolve({ activities: [{ verb: 'new_friendship' }], headers: (name: string) => { return name; } });
  19 + }
  20 + };
  21 + beforeEach(angular.mock.module("templates"));
  22 +
  23 + let state = jasmine.createSpyObj("state", ["go"]);
  24 +
  25 +
  26 + function getProviders() {
  27 + return [
  28 + new Provider('$state', { useValue: state }),
  29 + new Provider('BlockService', {
  30 + useValue: mockedService
  31 + })
  32 + ].concat(provideFilters("truncateFilter", "stripTagsFilter"));
  33 + }
  34 + let componentClass: any = null;
  35 +
  36 + function getComponent() {
  37 + @Component({ selector: 'test-container-component', template: htmlTemplate, directives: [RecentActivitiesPluginActivitiesBlockComponent], providers: getProviders() })
  38 + class BlockContainerComponent {
  39 + block = { type: 'Block', settings: settingsObj };
  40 + owner = person;
  41 + constructor() {
  42 + }
  43 + }
  44 + return BlockContainerComponent;
  45 + }
  46 +
  47 + it("get activities from block service", done => {
  48 + tcb.createAsync(getComponent()).then(fixture => {
  49 + let RecentActivitiesPluginActivitiesBlock: RecentActivitiesPluginActivitiesBlockComponent = fixture.debugElement.componentViewChildren[0].componentInstance;
  50 + expect(RecentActivitiesPluginActivitiesBlock.activities[0]['verb']).toEqual('new_friendship');
  51 + done();
  52 + });
  53 + });
  54 +
  55 + });
  56 +});
... ...
src/app/layout/blocks/recent-activities-plugin-activities/recent-activities-plugin-activities-block.component.ts 0 → 100644
... ... @@ -0,0 +1,43 @@
  1 +import {Component, Inject, Input} from "ng-forward";
  2 +import {BlockService} from "../../../../lib/ng-noosfero-api/http/block.service";
  3 +import {Arrays} from "./../../../../lib/util/arrays";
  4 +
  5 +@Component({
  6 + selector: "noosfero-recent-activities-plugin-activities-block",
  7 + templateUrl: 'app/layout/blocks/recent-activities-plugin-activities/recent-activities-plugin-activities-block.html'
  8 +})
  9 +@Inject(BlockService, "$state")
  10 +export class RecentActivitiesPluginActivitiesBlockComponent {
  11 +
  12 + @Input() block: any;
  13 + @Input() owner: any;
  14 +
  15 + profile: any;
  16 + activities: any;
  17 +
  18 + constructor(private blockService: BlockService, private $state: any) { }
  19 +
  20 + getActivityTemplate(activity: any) {
  21 + return 'app/layout/blocks/recent-activities-plugin-activities/activities/' + activity.verb + '.html';
  22 + }
  23 +
  24 + urlFor(params: any) {
  25 + let url = '//' + params.host;
  26 + if (params.port) {
  27 + url += ':' + params.port;
  28 + }
  29 + url += '/' + params.profile + '/';
  30 + if (params.page) {
  31 + url += params.page.join('/');
  32 + }
  33 + return url;
  34 + }
  35 +
  36 + ngOnInit() {
  37 + this.profile = this.owner;
  38 + this.activities = [];
  39 + this.blockService.getApiContent(this.block).then((content: any) => {
  40 + this.activities = content.activities;
  41 + });
  42 + }
  43 +}
... ...
src/app/layout/blocks/recent-activities-plugin-activities/recent-activities-plugin-activities-block.html 0 → 100644
... ... @@ -0,0 +1,14 @@
  1 +<div class="deckgrid recent-activities-block">
  2 + <div ng-repeat="activity in ctrl.activities" class="a-card panel media">
  3 + <div class="header media-body">
  4 + <h5 class="title media-heading">
  5 + <a ng-href="/{{activity.user.identifier}}">{{activity.user.name}}</a>&nbsp;<ng-include src="ctrl.getActivityTemplate(activity)"></ng-include>
  6 + </h5>
  7 + </div>
  8 + <div class="subheader">
  9 + <span class="time">
  10 + <i class="fa fa-clock-o"></i> <span am-time-ago="activity.created_at | dateFormat"></span>
  11 + </span>
  12 + </div>
  13 + </div>
  14 +</div>
... ...
src/app/layout/blocks/recent-activities-plugin-activities/recent-activities-plugin-activities-block.scss 0 → 100644
... ... @@ -0,0 +1,23 @@
  1 +.col-md-2-5 .deckgrid[deckgrid]::before {
  2 + visibility: hidden;
  3 +}
  4 +
  5 +.recent-activities-block {
  6 + img, .upimg {
  7 + padding: 1px;
  8 + border: 1px solid #ccc;
  9 + margin-right: 2px;
  10 + margin-top: 2px;
  11 + }
  12 +
  13 + .upimg {
  14 + display: inline-block;
  15 + width: 20px;
  16 + height: 20px;
  17 + background-size: cover;
  18 +
  19 + span {
  20 + display: none;
  21 + }
  22 + }
  23 +}
... ...
src/app/main/main.component.ts
... ... @@ -20,6 +20,7 @@ import {StatisticsBlockComponent} from &quot;../layout/blocks/statistics/statistics-b
20 20 import {PersonTagsPluginInterestsBlockComponent} from "../layout/blocks/person-tags-plugin-interests/person-tags-plugin-interests-block.component";
21 21 import {TagsBlockComponent} from "../layout/blocks/tags/tags-block.component";
22 22 import {CustomContentComponent} from "../profile/custom-content/custom-content.component";
  23 +import {RecentActivitiesPluginActivitiesBlockComponent} from "../layout/blocks/recent-activities-plugin-activities/recent-activities-plugin-activities-block.component";
23 24  
24 25 import {MembersBlockComponent} from "../layout/blocks/members/members-block.component";
25 26 import {CommunitiesBlockComponent} from "../layout/blocks/communities/communities-block.component";
... ... @@ -87,7 +88,7 @@ export class EnvironmentContent {
87 88 * @name main.Main
88 89 * @requires AuthService, Session, Notification, ArticleBlog, ArticleView, Boxes, Block, LinkListBlock,
89 90 * MainBlock, RecentDocumentsBlock, Navbar, ProfileImageBlock, MembersBlock,
90   - * NoosferoTemplate, DateFormat, RawHTMLBlock, PersonTagsPluginInterestsBlock
  91 + * NoosferoTemplate, DateFormat, RawHTMLBlock, PersonTagsPluginInterestsBlock, RecentActivitiesPluginActivitiesBlock,
91 92 * @description
92 93 * The Main controller for the Noosfero Angular Theme application.
93 94 *
... ... @@ -106,7 +107,7 @@ export class EnvironmentContent {
106 107 MainBlockComponent, RecentDocumentsBlockComponent, Navbar, SidebarComponent, ProfileImageBlockComponent,
107 108 MembersBlockComponent, NoosferoTemplate, DateFormat, RawHTMLBlockComponent, StatisticsBlockComponent,
108 109 LoginBlockComponent, CustomContentComponent, PermissionDirective, SearchFormComponent, SearchComponent,
109   - PersonTagsPluginInterestsBlockComponent, TagsBlockComponent, BlockComponent
  110 + PersonTagsPluginInterestsBlockComponent, TagsBlockComponent, RecentActivitiesPluginActivitiesBlockComponent, BlockComponent
110 111 ].concat(plugins.mainComponents).concat(plugins.hotspots),
111 112 providers: [AuthService, SessionService, NotificationService, BodyStateClassesService,
112 113 "ngAnimate", "ngCookies", "ngStorage", "ngTouch",
... ...