Commit eb46d8b72ed8bf65b93078dcf0ebaeed4b43d2f6
1 parent
92cac350
Exists in
master
and in
33 other branches
Properly handle noosfero dates to avoid the momentjs warning
Showing
8 changed files
with
36 additions
and
6 deletions
Show diff stats
src/app/components/noosfero-activities/activity/add_member_in_community.html
@@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
7 | <a ui-sref="main.profile.info({profile: ctrl.activity.user.identifier})"><strong ng-bind="ctrl.activity.user.name"></strong></a> | 7 | <a ui-sref="main.profile.info({profile: ctrl.activity.user.identifier})"><strong ng-bind="ctrl.activity.user.name"></strong></a> |
8 | <span> has joined the community</span> | 8 | <span> has joined the community</span> |
9 | </h4> | 9 | </h4> |
10 | - <p><small class="text-muted"><i class="fa fa-clock-o"></i> <span am-time-ago="ctrl.activity.created_at"></span></small></p> | 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> | 11 | </timeline-heading> |
12 | <div class="timeline-body"></div> | 12 | <div class="timeline-body"></div> |
13 | </timeline-panel> | 13 | </timeline-panel> |
src/app/components/noosfero-activities/activity/create_article.html
@@ -10,7 +10,7 @@ | @@ -10,7 +10,7 @@ | ||
10 | <strong ng-bind="ctrl.activity.target.article.profile.name"></strong></span> | 10 | <strong ng-bind="ctrl.activity.target.article.profile.name"></strong></span> |
11 | </a> | 11 | </a> |
12 | </h4> | 12 | </h4> |
13 | - <p><small class="text-muted"><i class="fa fa-clock-o"></i> <span am-time-ago="ctrl.activity.created_at"></span></small></p> | 13 | + <p><small class="text-muted"><i class="fa fa-clock-o"></i> <span am-time-ago="ctrl.activity.created_at | dateFormat"></span></small></p> |
14 | </timeline-heading> | 14 | </timeline-heading> |
15 | <div class="timeline-body"> | 15 | <div class="timeline-body"> |
16 | <div class="article"> | 16 | <div class="article"> |
src/app/components/noosfero-activities/activity/new_friendship.html
@@ -12,7 +12,7 @@ | @@ -12,7 +12,7 @@ | ||
12 | </a> | 12 | </a> |
13 | </span> | 13 | </span> |
14 | </h4> | 14 | </h4> |
15 | - <p><small class="text-muted"><i class="fa fa-clock-o"></i> <span am-time-ago="ctrl.activity.created_at"></span></small></p> | 15 | + <p><small class="text-muted"><i class="fa fa-clock-o"></i> <span am-time-ago="ctrl.activity.created_at | dateFormat"></span></small></p> |
16 | </timeline-heading> | 16 | </timeline-heading> |
17 | <div class="timeline-body"></div> | 17 | <div class="timeline-body"></div> |
18 | </timeline-panel> | 18 | </timeline-panel> |
src/app/components/noosfero-articles/article/article.html
@@ -6,7 +6,7 @@ | @@ -6,7 +6,7 @@ | ||
6 | <div class="sub-header clearfix"> | 6 | <div class="sub-header clearfix"> |
7 | <div class="page-info pull-right small text-muted"> | 7 | <div class="page-info pull-right small text-muted"> |
8 | <span class="time"> | 8 | <span class="time"> |
9 | - <i class="fa fa-clock-o"></i> <span am-time-ago="ctrl.article.created_at"></span> | 9 | + <i class="fa fa-clock-o"></i> <span am-time-ago="ctrl.article.created_at | dateFormat"></span> |
10 | </span> | 10 | </span> |
11 | <span class="author" ng-if="ctrl.article.author"> | 11 | <span class="author" ng-if="ctrl.article.author"> |
12 | <i class="fa fa-user"></i> | 12 | <i class="fa fa-user"></i> |
src/app/components/noosfero-blocks/recent-documents/recent-documents.html
@@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
8 | 8 | ||
9 | <div class="subheader"> | 9 | <div class="subheader"> |
10 | <span class="time"> | 10 | <span class="time"> |
11 | - <i class="fa fa-clock-o"></i> <span am-time-ago="card.created_at"></span> | 11 | + <i class="fa fa-clock-o"></i> <span am-time-ago="card.created_at | dateFormat"></span> |
12 | </span> | 12 | </span> |
13 | </div> | 13 | </div> |
14 | </div> | 14 | </div> |
src/app/components/noosfero/date-format/date-format.filter.spec.ts
0 → 100644
@@ -0,0 +1,19 @@ | @@ -0,0 +1,19 @@ | ||
1 | +import {quickCreateComponent} from "../../../../spec/helpers"; | ||
2 | +import {DateFormat} from './date-format.filter'; | ||
3 | + | ||
4 | +describe("Filters", () => { | ||
5 | + describe("Date Format Filter", () => { | ||
6 | + | ||
7 | + beforeEach(angular.mock.module("templates")); | ||
8 | + | ||
9 | + it("convert date from the format returned by noosfero api to an ISO format", done => { | ||
10 | + let date = "2016/03/10 10:46:47"; | ||
11 | + let htmlTemplate = `{{ '${date}' | dateFormat }}`; | ||
12 | + quickCreateComponent({ providers: [DateFormat], template: htmlTemplate }).then(fixture => { | ||
13 | + expect(fixture.debugElement.text()).toEqual('"2016-03-10T13:46:47.000Z"'); | ||
14 | + done(); | ||
15 | + }); | ||
16 | + }); | ||
17 | + | ||
18 | + }); | ||
19 | +}); |
src/app/components/noosfero/date-format/date-format.filter.ts
0 → 100644
src/app/main/main.component.ts
@@ -12,6 +12,7 @@ import {ProfileImageBlock} from "../components/noosfero-blocks/profile-image-blo | @@ -12,6 +12,7 @@ import {ProfileImageBlock} from "../components/noosfero-blocks/profile-image-blo | ||
12 | 12 | ||
13 | import {MembersBlock} from "../components/noosfero-blocks/members-block/members-block.component"; | 13 | import {MembersBlock} from "../components/noosfero-blocks/members-block/members-block.component"; |
14 | import {NoosferoTemplate} from "../components/noosfero/noosfero-template.filter"; | 14 | import {NoosferoTemplate} from "../components/noosfero/noosfero-template.filter"; |
15 | +import {DateFormat} from "../components/noosfero/date-format/date-format.filter"; | ||
15 | 16 | ||
16 | import {AuthService} from "./../components/auth/auth_service"; | 17 | import {AuthService} from "./../components/auth/auth_service"; |
17 | import {Session} from "./../components/auth/session"; | 18 | import {Session} from "./../components/auth/session"; |
@@ -37,7 +38,7 @@ export class MainContent { | @@ -37,7 +38,7 @@ export class MainContent { | ||
37 | directives: [ | 38 | directives: [ |
38 | ArticleBlog, ArticleView, Boxes, Block, LinkListBlock, | 39 | ArticleBlog, ArticleView, Boxes, Block, LinkListBlock, |
39 | MainBlock, RecentDocumentsBlock, Navbar, ProfileImageBlock, | 40 | MainBlock, RecentDocumentsBlock, Navbar, ProfileImageBlock, |
40 | - MembersBlock, NoosferoTemplate | 41 | + MembersBlock, NoosferoTemplate, DateFormat |
41 | ], | 42 | ], |
42 | providers: [AuthService, Session] | 43 | providers: [AuthService, Session] |
43 | }) | 44 | }) |