diff --git a/src/app/article/comment/comments.component.spec.ts b/src/app/article/comment/comments.component.spec.ts
index 7076529..e17664f 100644
--- a/src/app/article/comment/comments.component.spec.ts
+++ b/src/app/article/comment/comments.component.spec.ts
@@ -2,7 +2,7 @@ import {Provider, provide, Component} from 'ng-forward';
import * as helpers from "../../../spec/helpers";
import {CommentsComponent} from './comments.component';
-import {PostCommentComponent} from "./post-comment.component";
+import {PostCommentComponent} from "./post-comment/post-comment.component";
const htmlTemplate: string = '';
diff --git a/src/app/article/comment/comments.component.ts b/src/app/article/comment/comments.component.ts
index a488efd..f182807 100644
--- a/src/app/article/comment/comments.component.ts
+++ b/src/app/article/comment/comments.component.ts
@@ -1,5 +1,5 @@
import { Inject, Input, Component, provide } from 'ng-forward';
-import { PostCommentComponent } from "./post-comment.component";
+import { PostCommentComponent } from "./post-comment/post-comment.component";
import { CommentService } from "../../../lib/ng-noosfero-api/http/comment.service";
import { CommentComponent } from "./comment.component";
diff --git a/src/app/article/comment/post-comment.component.spec.ts b/src/app/article/comment/post-comment.component.spec.ts
deleted file mode 100644
index 0e607a7..0000000
--- a/src/app/article/comment/post-comment.component.spec.ts
+++ /dev/null
@@ -1,66 +0,0 @@
-import {Provider, provide, Component} from 'ng-forward';
-import * as helpers from "../../../spec/helpers";
-
-import {PostCommentComponent} from './post-comment.component';
-
-const htmlTemplate: string = '';
-
-describe("Components", () => {
- describe("Post Comment Component", () => {
-
- beforeEach(angular.mock.module("templates"));
-
- let commentService = jasmine.createSpyObj("commentService", ["createInArticle"]);
- let providers = [
- new Provider('CommentService', { useValue: commentService }),
- new Provider('NotificationService', { useValue: helpers.mocks.notificationService })
- ].concat(helpers.provideFilters("translateFilter"));
-
- @Component({ selector: 'test-container-component', directives: [PostCommentComponent], template: htmlTemplate, providers: providers })
- class ContainerComponent {
- article = { id: 1 };
- comment = { id: 2 };
- }
-
- it("render the post comment form", done => {
- helpers.createComponentFromClass(ContainerComponent).then(fixture => {
- expect(fixture.debugElement.queryAll("form").length).toEqual(1);
- done();
- });
- });
-
- it("emit an event when create comment", done => {
- helpers.createComponentFromClass(ContainerComponent).then(fixture => {
- let component: PostCommentComponent = fixture.debugElement.componentViewChildren[0].componentInstance;
- commentService.createInArticle = jasmine.createSpy("createInArticle").and.returnValue(helpers.mocks.promiseResultTemplate({ data: {} }));
- component["$rootScope"].$emit = jasmine.createSpy("$emit");
- component.save();
- expect(component["$rootScope"].$emit).toHaveBeenCalledWith(PostCommentComponent.EVENT_COMMENT_RECEIVED, jasmine.any(Object));
- done();
- });
- });
-
- it("notify success when create comment", done => {
- helpers.createComponentFromClass(ContainerComponent).then(fixture => {
- let component: PostCommentComponent = fixture.debugElement.componentViewChildren[0].componentInstance;
- commentService.createInArticle = jasmine.createSpy("createInArticle").and.returnValue(helpers.mocks.promiseResultTemplate({ data: {} }));
- component["notificationService"].success = jasmine.createSpy("success");
- component.save();
- expect(component["notificationService"].success).toHaveBeenCalled();
- done();
- });
- });
-
- it("set the reply id when reply to a comment", done => {
- helpers.createComponentFromClass(ContainerComponent).then(fixture => {
- let component: PostCommentComponent = fixture.debugElement.componentViewChildren[0].componentInstance;
- component.comment = { reply_of_id: null };
- component.replyOf = { id: 10 };
- component.save();
- expect(component.comment.reply_of_id).toEqual(component.replyOf.id);
- done();
- });
- });
-
- });
-});
diff --git a/src/app/article/comment/post-comment.component.ts b/src/app/article/comment/post-comment.component.ts
deleted file mode 100644
index 8b8543c..0000000
--- a/src/app/article/comment/post-comment.component.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-import { Inject, Input, Component } from 'ng-forward';
-import { CommentService } from "../../../lib/ng-noosfero-api/http/comment.service";
-import { NotificationService } from "../../shared/services/notification.service";
-
-@Component({
- selector: 'noosfero-post-comment',
- templateUrl: 'app/article/comment/post-comment.html'
-})
-@Inject(CommentService, NotificationService, "$rootScope")
-export class PostCommentComponent {
-
- public static EVENT_COMMENT_RECEIVED = "comment.received";
-
- @Input() article: noosfero.Article;
- @Input() replyOf: noosfero.Comment;
-
- comment: noosfero.Comment;
-
- constructor(private commentService: CommentService, private notificationService: NotificationService, private $rootScope: ng.IScope) { }
-
- save() {
- if (this.replyOf && this.comment) {
- this.comment.reply_of_id = this.replyOf.id;
- }
- this.commentService.createInArticle(this.article, this.comment).then((result: noosfero.RestResult) => {
- this.$rootScope.$emit(PostCommentComponent.EVENT_COMMENT_RECEIVED, result.data);
- this.notificationService.success({ title: "Good job!", message: "Comment saved!" });
- });
- }
-}
diff --git a/src/app/article/comment/post-comment.html b/src/app/article/comment/post-comment.html
deleted file mode 100644
index 5d4f1b9..0000000
--- a/src/app/article/comment/post-comment.html
+++ /dev/null
@@ -1,6 +0,0 @@
-
diff --git a/src/app/article/comment/post-comment/post-comment.component.spec.ts b/src/app/article/comment/post-comment/post-comment.component.spec.ts
new file mode 100644
index 0000000..e7beab4
--- /dev/null
+++ b/src/app/article/comment/post-comment/post-comment.component.spec.ts
@@ -0,0 +1,66 @@
+import {Provider, provide, Component} from 'ng-forward';
+import * as helpers from "../../../../spec/helpers";
+
+import {PostCommentComponent} from './post-comment.component';
+
+const htmlTemplate: string = '';
+
+describe("Components", () => {
+ describe("Post Comment Component", () => {
+
+ beforeEach(angular.mock.module("templates"));
+
+ let commentService = jasmine.createSpyObj("commentService", ["createInArticle"]);
+ let providers = [
+ new Provider('CommentService', { useValue: commentService }),
+ new Provider('NotificationService', { useValue: helpers.mocks.notificationService })
+ ].concat(helpers.provideFilters("translateFilter"));
+
+ @Component({ selector: 'test-container-component', directives: [PostCommentComponent], template: htmlTemplate, providers: providers })
+ class ContainerComponent {
+ article = { id: 1 };
+ comment = { id: 2 };
+ }
+
+ it("render the post comment form", done => {
+ helpers.createComponentFromClass(ContainerComponent).then(fixture => {
+ expect(fixture.debugElement.queryAll("form").length).toEqual(1);
+ done();
+ });
+ });
+
+ it("emit an event when create comment", done => {
+ helpers.createComponentFromClass(ContainerComponent).then(fixture => {
+ let component: PostCommentComponent = fixture.debugElement.componentViewChildren[0].componentInstance;
+ commentService.createInArticle = jasmine.createSpy("createInArticle").and.returnValue(helpers.mocks.promiseResultTemplate({ data: {} }));
+ component["$rootScope"].$emit = jasmine.createSpy("$emit");
+ component.save();
+ expect(component["$rootScope"].$emit).toHaveBeenCalledWith(PostCommentComponent.EVENT_COMMENT_RECEIVED, jasmine.any(Object));
+ done();
+ });
+ });
+
+ it("notify success when create comment", done => {
+ helpers.createComponentFromClass(ContainerComponent).then(fixture => {
+ let component: PostCommentComponent = fixture.debugElement.componentViewChildren[0].componentInstance;
+ commentService.createInArticle = jasmine.createSpy("createInArticle").and.returnValue(helpers.mocks.promiseResultTemplate({ data: {} }));
+ component["notificationService"].success = jasmine.createSpy("success");
+ component.save();
+ expect(component["notificationService"].success).toHaveBeenCalled();
+ done();
+ });
+ });
+
+ it("set the reply id when reply to a comment", done => {
+ helpers.createComponentFromClass(ContainerComponent).then(fixture => {
+ let component: PostCommentComponent = fixture.debugElement.componentViewChildren[0].componentInstance;
+ component.comment = { reply_of_id: null };
+ component.replyOf = { id: 10 };
+ component.save();
+ expect(component.comment.reply_of_id).toEqual(component.replyOf.id);
+ done();
+ });
+ });
+
+ });
+});
diff --git a/src/app/article/comment/post-comment/post-comment.component.ts b/src/app/article/comment/post-comment/post-comment.component.ts
new file mode 100644
index 0000000..5ab47cf
--- /dev/null
+++ b/src/app/article/comment/post-comment/post-comment.component.ts
@@ -0,0 +1,30 @@
+import { Inject, Input, Component } from 'ng-forward';
+import { CommentService } from "../../../../lib/ng-noosfero-api/http/comment.service";
+import { NotificationService } from "../../../shared/services/notification.service";
+
+@Component({
+ selector: 'noosfero-post-comment',
+ templateUrl: 'app/article/comment/post-comment/post-comment.html'
+})
+@Inject(CommentService, NotificationService, "$rootScope")
+export class PostCommentComponent {
+
+ public static EVENT_COMMENT_RECEIVED = "comment.received";
+
+ @Input() article: noosfero.Article;
+ @Input() replyOf: noosfero.Comment;
+
+ comment: noosfero.Comment;
+
+ constructor(private commentService: CommentService, private notificationService: NotificationService, private $rootScope: ng.IScope) { }
+
+ save() {
+ if (this.replyOf && this.comment) {
+ this.comment.reply_of_id = this.replyOf.id;
+ }
+ this.commentService.createInArticle(this.article, this.comment).then((result: noosfero.RestResult) => {
+ this.$rootScope.$emit(PostCommentComponent.EVENT_COMMENT_RECEIVED, result.data);
+ this.notificationService.success({ title: "Good job!", message: "Comment saved!" });
+ });
+ }
+}
diff --git a/src/app/article/comment/post-comment/post-comment.html b/src/app/article/comment/post-comment/post-comment.html
new file mode 100644
index 0000000..5d4f1b9
--- /dev/null
+++ b/src/app/article/comment/post-comment/post-comment.html
@@ -0,0 +1,6 @@
+
diff --git a/src/languages/en.json b/src/languages/en.json
index 18b7a6b..ef47462 100644
--- a/src/languages/en.json
+++ b/src/languages/en.json
@@ -29,5 +29,7 @@
"notification.error.default.title": "Oops...",
"notification.profile.not_found": "Page not found",
"notification.http_error.401.message": "Unauthorized",
- "notification.http_error.500.message": "Server error"
+ "notification.http_error.500.message": "Server error",
+ "comment.post": "Post a comment",
+ "comment.reply": "reply"
}
diff --git a/src/languages/pt.json b/src/languages/pt.json
index 7af5a58..c0f4277 100644
--- a/src/languages/pt.json
+++ b/src/languages/pt.json
@@ -29,5 +29,7 @@
"notification.error.default.title": "Oops...",
"notification.profile.not_found": "Página não encontrada",
"notification.http_error.401.message": "Não autorizado",
- "notification.http_error.500.message": "Erro no servidor"
+ "notification.http_error.500.message": "Erro no servidor",
+ "comment.post": "Commentar",
+ "comment.reply": "responder"
}
--
libgit2 0.21.2