diff --git a/src/app/article/comment/post-comment/post-comment.html b/src/app/article/comment/post-comment/post-comment.html
index dc32447..4a49a0c 100644
--- a/src/app/article/comment/post-comment/post-comment.html
+++ b/src/app/article/comment/post-comment/post-comment.html
@@ -8,7 +8,7 @@
-
+
diff --git a/src/app/hotspot/comment-form-hotspot.component.ts b/src/app/hotspot/comment-form-hotspot.component.ts
index 3308a02..415c042 100644
--- a/src/app/hotspot/comment-form-hotspot.component.ts
+++ b/src/app/hotspot/comment-form-hotspot.component.ts
@@ -11,6 +11,7 @@ import {PluginHotspot} from "./plugin-hotspot";
export class CommentFormHotspotComponent extends PluginHotspot {
@Input() comment: noosfero.Comment;
+ @Input() parent: noosfero.Comment;
constructor(
private $element: any,
@@ -20,6 +21,6 @@ export class CommentFormHotspotComponent extends PluginHotspot {
}
addHotspot(directiveName: string) {
- this.$element.append(this.$compile('<' + directiveName + ' [comment]="ctrl.comment">' + directiveName + '>')(this.$scope));
+ this.$element.append(this.$compile('<' + directiveName + ' [comment]="ctrl.comment" [parent]="ctrl.parent">' + directiveName + '>')(this.$scope));
}
}
diff --git a/src/plugins/comment_paragraph/hotspot/comment-paragraph-form.component.ts b/src/plugins/comment_paragraph/hotspot/comment-paragraph-form.component.ts
new file mode 100644
index 0000000..12d7863
--- /dev/null
+++ b/src/plugins/comment_paragraph/hotspot/comment-paragraph-form.component.ts
@@ -0,0 +1,26 @@
+import { Inject, Input, Component } from "ng-forward";
+import {Hotspot} from "../../../app/hotspot/hotspot.decorator";
+
+@Component({
+ selector: "comment-paragraph-form-hotspot",
+ template: "",
+})
+@Hotspot("comment_form_extra_contents")
+@Inject("$scope")
+export class CommentParagraphFormHotspotComponent {
+
+ @Input() comment: noosfero.Comment;
+ @Input() parent: noosfero.Comment;
+
+ constructor(private $scope: ng.IScope) { }
+
+ ngOnInit() {
+ this.$scope.$watch(() => {
+ return this.parent;
+ }, () => {
+ if (this.parent && (this.parent).paragraph_uuid) {
+ (this.comment).paragraph_uuid = (this.parent).paragraph_uuid;
+ }
+ });
+ }
+}
diff --git a/src/plugins/comment_paragraph/hotspot/comment-paragraph-from.component.spec.ts b/src/plugins/comment_paragraph/hotspot/comment-paragraph-from.component.spec.ts
new file mode 100644
index 0000000..abe8655
--- /dev/null
+++ b/src/plugins/comment_paragraph/hotspot/comment-paragraph-from.component.spec.ts
@@ -0,0 +1,33 @@
+import {CommentParagraphFormHotspotComponent} from "./comment-paragraph-form.component";
+import {ComponentTestHelper, createClass} from '../../../spec/component-test-helper';
+import * as helpers from "../../../spec/helpers";
+import {ComponentFixture} from 'ng-forward/cjs/testing/test-component-builder';
+
+let htmlTemplate = '';
+
+describe("Components", () => {
+ describe("Comment Paragraph Form Hotspot Component", () => {
+
+ let helper: ComponentTestHelper;
+
+ beforeEach(angular.mock.module("templates"));
+
+ beforeEach((done) => {
+ let cls = createClass({
+ template: htmlTemplate,
+ directives: [CommentParagraphFormHotspotComponent],
+ providers: [],
+ properties: {
+ comment: {}
+ }
+ });
+ helper = new ComponentTestHelper(cls, done);
+ });
+
+ it('set paragraph uuid when parent has it setted', () => {
+ helper.component.parent = { paragraph_uuid: 'uuid' };
+ helper.detectChanges();
+ expect((helper.component.comment).paragraph_uuid).toEqual('uuid');
+ });
+ });
+});
diff --git a/src/plugins/comment_paragraph/index.ts b/src/plugins/comment_paragraph/index.ts
index 5de5e3f..38d3a84 100644
--- a/src/plugins/comment_paragraph/index.ts
+++ b/src/plugins/comment_paragraph/index.ts
@@ -1,5 +1,6 @@
import {AllowCommentComponent} from "./allow-comment/allow-comment.component";
import {CommentParagraphArticleButtonHotspotComponent} from "./hotspot/comment-paragraph-article-button.component";
+import {CommentParagraphFormHotspotComponent} from "./hotspot/comment-paragraph-form.component";
export let mainComponents: any = [AllowCommentComponent];
-export let hotspots: any = [CommentParagraphArticleButtonHotspotComponent];
+export let hotspots: any = [CommentParagraphArticleButtonHotspotComponent, CommentParagraphFormHotspotComponent];
--
libgit2 0.21.2