diff --git a/src/app/index.ts b/src/app/index.ts
index 276acac..ec50e06 100644
--- a/src/app/index.ts
+++ b/src/app/index.ts
@@ -6,7 +6,7 @@ import {AuthEvents} from "./login/auth-events";
declare var moment: any;
-//FIXME see a better way to declare template modules for dev mode
+// FIXME see a better way to declare template modules for dev mode
try {
angular.module('noosfero.templates.app');
} catch (error) {
diff --git a/src/plugins/comment_paragraph/hotspot/export-comment-button.component.spec.ts b/src/plugins/comment_paragraph/hotspot/export-comment-button.component.spec.ts
new file mode 100644
index 0000000..487b641
--- /dev/null
+++ b/src/plugins/comment_paragraph/hotspot/export-comment-button.component.spec.ts
@@ -0,0 +1,52 @@
+import {ExportCommentButtonHotspotComponent} from "./export-comment-button.component";
+import {ComponentTestHelper, createClass} from '../../../spec/component-test-helper';
+import * as helpers from "../../../spec/helpers";
+import {Provider} from 'ng-forward';
+import {ComponentFixture} from 'ng-forward/cjs/testing/test-component-builder';
+
+let htmlTemplate = '';
+
+describe("Components", () => {
+ describe("Export Comment Button Hotspot Component", () => {
+
+ let serviceMock = jasmine.createSpyObj("CommentParagraphService", [ "getArticle" ]);
+
+ let providers = [ new Provider('CommentParagraphService', { useValue: serviceMock }) ]
+ .concat(helpers.provideFilters('translateFilter'));
+ let helper: ComponentTestHelper;
+
+ beforeEach(angular.mock.module("templates"));
+
+ beforeEach((done) => {
+ let cls = createClass({
+ template: htmlTemplate,
+ directives: [ExportCommentButtonHotspotComponent],
+ providers: providers,
+ properties: {
+ article: {}
+ }
+ });
+ helper = new ComponentTestHelper(cls, done);
+ });
+
+ it('return true when comment paragraph is active', () => {
+ helper.component.article = { setting: { comment_paragraph_plugin_activate: true } };
+ helper.detectChanges();
+ expect(helper.component.isActivated()).toBeTruthy();
+ expect(helper.all('.export-comment-button').length).toEqual(1);
+ });
+
+ it('return false when comment paragraph is not active', () => {
+ expect(helper.component.isActivated()).toBeFalsy();
+ expect(helper.all('.export-comment-button').length).toEqual(0);
+ });
+
+ it('return false when article has no setting attribute', () => {
+ helper.component.article = {};
+ helper.detectChanges();
+ expect(helper.component.isActivated()).toBeFalsy();
+ expect(helper.all('.export-comment-button').length).toEqual(0);
+ });
+
+ });
+});
diff --git a/src/plugins/comment_paragraph/hotspot/export-comment-button.component.ts b/src/plugins/comment_paragraph/hotspot/export-comment-button.component.ts
new file mode 100644
index 0000000..5f77bb8
--- /dev/null
+++ b/src/plugins/comment_paragraph/hotspot/export-comment-button.component.ts
@@ -0,0 +1,23 @@
+import { Input, Inject, Component } from "ng-forward";
+import {Hotspot} from "../../../app/hotspot/hotspot.decorator";
+import {CommentParagraphService} from "../http/comment-paragraph.service";
+
+@Component({
+ selector: "export-comment-button-hotspot",
+ templateUrl: "plugins/comment_paragraph/hotspot/export-comment-button.html",
+})
+@Inject(CommentParagraphService)
+@Hotspot("article_extra_toolbar_buttons")
+export class ExportCommentButtonHotspotComponent {
+
+ @Input() article: noosfero.Article;
+ exportCommentPath: any;
+
+ constructor(private commentParagraphService: CommentParagraphService) { }
+
+ isActivated() {
+ this.exportCommentPath = ["/api/v1/articles/", this.article.id, "/comment_paragraph_plugin/export"].join("");
+ return this.article && this.article.setting && this.article.setting.comment_paragraph_plugin_activate;
+ }
+
+}
diff --git a/src/plugins/comment_paragraph/hotspot/export-comment-button.html b/src/plugins/comment_paragraph/hotspot/export-comment-button.html
new file mode 100644
index 0000000..26d1c8f
--- /dev/null
+++ b/src/plugins/comment_paragraph/hotspot/export-comment-button.html
@@ -0,0 +1,5 @@
+
+
diff --git a/src/plugins/comment_paragraph/index.ts b/src/plugins/comment_paragraph/index.ts
index 9dbe755..555c9be 100644
--- a/src/plugins/comment_paragraph/index.ts
+++ b/src/plugins/comment_paragraph/index.ts
@@ -1,8 +1,9 @@
import {AllowCommentComponent} from "./allow-comment/allow-comment.component";
+import {ExportCommentButtonHotspotComponent} from "./hotspot/export-comment-button.component";
import {CommentParagraphFormHotspotComponent} from "./hotspot/comment-paragraph-form.component";
import {DiscussionEditorComponent} from "./article/cms/discussion-editor/discussion-editor.component";
import {CommentParagraphArticleContentHotspotComponent} from "./hotspot/article-content/article-content.component";
import {DiscussionBlockComponent} from "./block/discussion/discussion-block.component";
export let mainComponents: any = [AllowCommentComponent, DiscussionEditorComponent, DiscussionBlockComponent];
-export let hotspots: any = [CommentParagraphFormHotspotComponent, CommentParagraphArticleContentHotspotComponent];
+export let hotspots: any = [ExportCommentButtonHotspotComponent, CommentParagraphFormHotspotComponent, CommentParagraphArticleContentHotspotComponent];
diff --git a/src/plugins/comment_paragraph/languages/en.json b/src/plugins/comment_paragraph/languages/en.json
index c64ea0f..697dda8 100644
--- a/src/plugins/comment_paragraph/languages/en.json
+++ b/src/plugins/comment_paragraph/languages/en.json
@@ -1,5 +1,6 @@
{
"comment-paragraph-plugin.title": "Paragraph Comments",
+ "comment-paragraph-plugin.export": "Export Comments",
"comment-paragraph-plugin.discussion.editor.start_date.label": "From",
"comment-paragraph-plugin.discussion.editor.end_date.label": "To",
"comment-paragraph-plugin.discussion.header": "Open for comments",
diff --git a/src/plugins/comment_paragraph/languages/pt.json b/src/plugins/comment_paragraph/languages/pt.json
index 58a0d00..d955ca2 100644
--- a/src/plugins/comment_paragraph/languages/pt.json
+++ b/src/plugins/comment_paragraph/languages/pt.json
@@ -1,5 +1,6 @@
{
"comment-paragraph-plugin.title": "Comentários por Parágrafo",
+ "comment-paragraph-plugin.export": "Exportar Comentários",
"comment-paragraph-plugin.discussion.editor.start_date.label": "De",
"comment-paragraph-plugin.discussion.editor.end_date.label": "Até",
"comment-paragraph-plugin.discussion.header": "Aberto para comentários",
--
libgit2 0.21.2