Commit 6596b7af21da59eec3ad18b1a92ab3ea68ff15ce

Authored by Leandro Santos
1 parent d3bba43c

adding scrap activity in profile timeline

src/app/profile/activities/activity/activity.component.spec.ts
... ... @@ -12,6 +12,7 @@ const htmlTemplate: string = '<noosfero-activity [activity]="ctrl.activity"></no
12 12 describe("Components", () => {
13 13  
14 14 describe("Noosfero Activity", () => {
  15 + let activity = { name: "activity1", verb: "create_article" };
15 16  
16 17 beforeEach(angular.mock.module("templates"));
17 18  
... ... @@ -21,18 +22,54 @@ describe("Components", () => {
21 22 directives: [ActivityComponent],
22 23 providers: provideFilters("truncateFilter", "stripTagsFilter", "translateFilter")
23 24 })
  25 +
24 26 class BlockContainerComponent {
25   - activity = { name: "activity1", verb: "create_article" };
  27 + activity = activity;
26 28 }
27 29  
28 30 it("render the specific template for an activity verb", done => {
29 31 tcb.createAsync(BlockContainerComponent).then(fixture => {
30 32 let component: ActivityComponent = fixture.debugElement.componentViewChildren[0].componentInstance;
31 33 expect(component.getActivityTemplate()).toEqual('app/profile/activities/activity/create_article.html');
  34 + done();
  35 + });
  36 + });
  37 +
  38 + it("render create article template correctly", done => {
  39 + activity = { name: "activity1", verb: "create_article" };
  40 + tcb.createAsync(BlockContainerComponent).then(fixture => {
  41 + let component: ActivityComponent = fixture.debugElement.componentViewChildren[0].componentInstance;
32 42 expect(fixture.debugElement.queryAll(".activity.create_article").length).toEqual(1);
33 43 done();
34 44 });
35 45 });
  46 +
  47 + it("render add_member_in_community template correctly", done => {
  48 + activity = { name: "add_member_in_community1", verb: "add_member_in_community" };
  49 + tcb.createAsync(BlockContainerComponent).then(fixture => {
  50 + let component: ActivityComponent = fixture.debugElement.componentViewChildren[0].componentInstance;
  51 + expect(fixture.debugElement.queryAll(".activity.add_member_in_community").length).toEqual(1);
  52 + done();
  53 + });
  54 + });
  55 +
  56 + it("render new_friendship template correctly", done => {
  57 + activity = { name: "new_friendship1", verb: "new_friendship" };
  58 + tcb.createAsync(BlockContainerComponent).then(fixture => {
  59 + let component: ActivityComponent = fixture.debugElement.componentViewChildren[0].componentInstance;
  60 + expect(fixture.debugElement.queryAll(".activity.new_friendship").length).toEqual(1);
  61 + done();
  62 + });
  63 + });
  64 +
  65 + it("render scrap template correctly", done => {
  66 + activity = { name: "scrap1", verb: "scrap" };
  67 + tcb.createAsync(BlockContainerComponent).then(fixture => {
  68 + let component: ActivityComponent = fixture.debugElement.componentViewChildren[0].componentInstance;
  69 + expect(fixture.debugElement.queryAll(".activity.scrap").length).toEqual(1);
  70 + done();
  71 + });
  72 + });
36 73 });
37 74  
38 75 });
... ...
src/app/profile/activities/activity/scrap.html 0 → 100644
... ... @@ -0,0 +1,17 @@
  1 +<timeline-badge class="success">
  2 + <i class="fa fa-file-text"></i>
  3 +</timeline-badge>
  4 +<timeline-panel>
  5 + <timeline-heading>
  6 + <h4 class="timeline-title">
  7 + <a ui-sref="main.profile.info({profile: ctrl.activity.user.identifier})"><strong ng-bind="ctrl.activity.user.name"></strong></a>
  8 + <span> {{"activities.scrap.description" | translate}} </span>
  9 + </h4>
  10 + <p><small class="text-muted"><i class="fa fa-clock-o"></i> <span am-time-ago="ctrl.activity.created_at | dateFormat"></span></small></p>
  11 + </timeline-heading>
  12 + <div class="timeline-body">
  13 + <div class="scrap">
  14 + <div ng-bind-html="ctrl.activity.content | stripTags | truncate: 100 : '...': true"></div>
  15 + </div>
  16 + </div>
  17 +</timeline-panel>
... ...
src/languages/en.json
... ... @@ -21,6 +21,7 @@
21 21 "profile.person.title": "Person",
22 22 "activities.title": "Activities",
23 23 "activities.create_article.description": "has published on",
  24 + "activities.scrap.description": "wrote",
24 25 "activities.add_member_in_community.description": "has joined the community",
25 26 "activities.new_friendship.description": "has made {friends, plural, one{one new friend} other{# new friends}}:",
26 27 "auth.title": "Great to have you back!",
... ...
src/languages/pt.json
... ... @@ -21,6 +21,7 @@
21 21 "profile.person.title": "Pessoa",
22 22 "activities.title": "Atividades",
23 23 "activities.create_article.description": "publicou em",
  24 + "activities.scrap.description": "escreveu",
24 25 "activities.add_member_in_community.description": "entrou na comunidade",
25 26 "activities.new_friendship.description": "fez {friends, plural, one{um novo amigo} other{# novos amigos}}:",
26 27 "auth.title": "Legal ter você de volta!",
... ...