diff --git a/src/app/article/article-default-view.component.ts b/src/app/article/article-default-view.component.ts
index 58d5142..d5a832e 100644
--- a/src/app/article/article-default-view.component.ts
+++ b/src/app/article/article-default-view.component.ts
@@ -2,6 +2,7 @@ import { bundle, Input, Inject, Component, Directive } from 'ng-forward';
import {ArticleBlogComponent} from "./types/blog/blog.component";
import {CommentsComponent} from "./comment/comments.component";
import {MacroDirective} from "./macro/macro.directive";
+import {ArticleToolbarHotspotComponent} from "../hotspot/article-toolbar-hotspot.component";
/**
* @ngdoc controller
@@ -31,7 +32,8 @@ export class ArticleDefaultViewComponent {
@Component({
selector: 'noosfero-article',
template: 'not-used',
- directives: [ArticleDefaultViewComponent, ArticleBlogComponent, CommentsComponent, MacroDirective]
+ directives: [ArticleDefaultViewComponent, ArticleBlogComponent,
+ CommentsComponent, MacroDirective, ArticleToolbarHotspotComponent]
})
@Inject("$element", "$scope", "$injector", "$compile")
export class ArticleViewComponent {
diff --git a/src/app/article/article.html b/src/app/article/article.html
index c82e068..bba9bdc 100644
--- a/src/app/article/article.html
+++ b/src/app/article/article.html
@@ -4,9 +4,7 @@
diff --git a/src/app/hotspot/article-toolbar-hotspot.component.ts b/src/app/hotspot/article-toolbar-hotspot.component.ts
new file mode 100644
index 0000000..ba492a3
--- /dev/null
+++ b/src/app/hotspot/article-toolbar-hotspot.component.ts
@@ -0,0 +1,25 @@
+import {Component, Input, Inject} from "ng-forward";
+import * as plugins from "../../plugins";
+import {dasherize} from "ng-forward/cjs/util/helpers";
+import {PluginHotspot} from "./plugin-hotspot";
+
+@Component({
+ selector: "noosfero-hotspot-article-toolbar",
+ template: ""
+})
+@Inject("$element", "$scope", "$compile")
+export class ArticleToolbarHotspotComponent extends PluginHotspot {
+
+ @Input() article: noosfero.Article;
+
+ constructor(
+ private $element: any,
+ private $scope: ng.IScope,
+ private $compile: ng.ICompileService) {
+ super("article_extra_toolbar_buttons");
+ }
+
+ addHotspot(directiveName: string) {
+ this.$element.append(this.$compile('<' + directiveName + ' [article]="ctrl.article">' + directiveName + '>')(this.$scope));
+ }
+}
diff --git a/src/app/hotspot/comment-form-hotspot.component.ts b/src/app/hotspot/comment-form-hotspot.component.ts
new file mode 100644
index 0000000..3308a02
--- /dev/null
+++ b/src/app/hotspot/comment-form-hotspot.component.ts
@@ -0,0 +1,25 @@
+import {Component, Input, Inject} from "ng-forward";
+import * as plugins from "../../plugins";
+import {dasherize} from "ng-forward/cjs/util/helpers";
+import {PluginHotspot} from "./plugin-hotspot";
+
+@Component({
+ selector: "noosfero-hotspot-comment-form",
+ template: ""
+})
+@Inject("$element", "$scope", "$compile")
+export class CommentFormHotspotComponent extends PluginHotspot {
+
+ @Input() comment: noosfero.Comment;
+
+ constructor(
+ private $element: any,
+ private $scope: ng.IScope,
+ private $compile: ng.ICompileService) {
+ super("comment_form_extra_contents");
+ }
+
+ addHotspot(directiveName: string) {
+ this.$element.append(this.$compile('<' + directiveName + ' [comment]="ctrl.comment">' + directiveName + '>')(this.$scope));
+ }
+}
diff --git a/src/app/hotspot/hotspot.decorator.ts b/src/app/hotspot/hotspot.decorator.ts
new file mode 100644
index 0000000..21d1e16
--- /dev/null
+++ b/src/app/hotspot/hotspot.decorator.ts
@@ -0,0 +1,5 @@
+export function Hotspot(hotspotName: string) {
+ return (target: any) => {
+ target['hotspot'] = hotspotName;
+ }
+}
diff --git a/src/app/hotspot/plugin-hotspot.ts b/src/app/hotspot/plugin-hotspot.ts
new file mode 100644
index 0000000..87a4852
--- /dev/null
+++ b/src/app/hotspot/plugin-hotspot.ts
@@ -0,0 +1,19 @@
+import {Component, Input, Inject} from "ng-forward";
+import * as plugins from "../../plugins";
+import {dasherize} from "ng-forward/cjs/util/helpers";
+
+export abstract class PluginHotspot {
+
+ constructor(protected hotspot: string) { }
+
+ ngOnInit() {
+ for (let component of plugins.hotspots) {
+ if (component.hotspot === this.hotspot) {
+ let directiveName = dasherize(component.name.replace('Component', ''));
+ this.addHotspot(directiveName);
+ }
+ }
+ }
+
+ abstract addHotspot(directiveName: string): any;
+}
diff --git a/src/app/main/main.component.ts b/src/app/main/main.component.ts
index 6dd5363..825ba82 100644
--- a/src/app/main/main.component.ts
+++ b/src/app/main/main.component.ts
@@ -1,3 +1,4 @@
+import * as plugins from "../../plugins";
import {bundle, Component, StateConfig, Inject} from "ng-forward";
import {ArticleBlogComponent} from "./../article/types/blog/blog.component";
@@ -33,7 +34,6 @@ import {SidebarComponent} from "../layout/sidebar/sidebar.component";
import {MainBlockComponent} from "../layout/blocks/main-block/main-block.component";
import {HtmlEditorComponent} from "../shared/components/html-editor/html-editor.component";
-import * as plugins from "../../plugins";
/**
* @ngdoc controller
@@ -94,7 +94,7 @@ export class EnvironmentContent {
LinkListBlockComponent, CommunitiesBlockComponent, HtmlEditorComponent,
MainBlockComponent, RecentDocumentsBlockComponent, Navbar, SidebarComponent, ProfileImageBlockComponent,
MembersBlockComponent, NoosferoTemplate, DateFormat, RawHTMLBlockComponent
- ].concat(plugins.mainComponents),
+ ].concat(plugins.mainComponents).concat(plugins.hotspots),
providers: [AuthService, SessionService, NotificationService, BodyStateClassesService]
})
@StateConfig([
diff --git a/src/plugins/comment_paragraph/hotspot/article-button.html b/src/plugins/comment_paragraph/hotspot/article-button.html
new file mode 100644
index 0000000..62bd890
--- /dev/null
+++ b/src/plugins/comment_paragraph/hotspot/article-button.html
@@ -0,0 +1,2 @@
+Enable
+Disable
diff --git a/src/plugins/comment_paragraph/hotspot/comment-paragraph-article-button.component.ts b/src/plugins/comment_paragraph/hotspot/comment-paragraph-article-button.component.ts
new file mode 100644
index 0000000..55eabb0
--- /dev/null
+++ b/src/plugins/comment_paragraph/hotspot/comment-paragraph-article-button.component.ts
@@ -0,0 +1,15 @@
+import { Input, Inject, Component } from "ng-forward";
+import {Hotspot} from "../../../app/hotspot/hotspot.decorator";
+
+@Component({
+ selector: "comment-paragraph-article-button-hotspot",
+ templateUrl: "plugins/comment_paragraph/hotspot/article-button.html",
+})
+@Inject("$scope")
+@Hotspot("article_extra_toolbar_buttons")
+export class CommentParagraphArticleButtonHotspotComponent {
+
+ @Input() article: noosfero.Article;
+
+ constructor(private $scope: ng.IScope) { }
+}
diff --git a/src/plugins/comment_paragraph/hotspot/comment-paragraph-uuid-hotspot.component.ts b/src/plugins/comment_paragraph/hotspot/comment-paragraph-uuid-hotspot.component.ts
new file mode 100644
index 0000000..d666413
--- /dev/null
+++ b/src/plugins/comment_paragraph/hotspot/comment-paragraph-uuid-hotspot.component.ts
@@ -0,0 +1,21 @@
+import { Input, Inject, Component } from "ng-forward";
+import {Hotspot} from "../../../app/hotspot/hotspot.decorator";
+
+@Component({
+ selector: "comment-paragraph-uuid-hotspot",
+ template: "",
+})
+@Inject("$scope")
+@Hotspot("comment_form_extra_contents")
+export class CommentParagraphUuidHotspotComponent {
+
+ @Input() comment: noosfero.Comment;
+
+ constructor(private $scope: ng.IScope) { }
+
+ ngOnInit() {
+ this.$scope.$watch("comment", () => {
+ this.comment['paragraph_uuid'] = "???";
+ });
+ }
+}
diff --git a/src/plugins/comment_paragraph/index.ts b/src/plugins/comment_paragraph/index.ts
index 0d4d08d..9dc43ee 100644
--- a/src/plugins/comment_paragraph/index.ts
+++ b/src/plugins/comment_paragraph/index.ts
@@ -1,3 +1,6 @@
import {AllowCommentComponent} from "./allow-comment/allow-comment.component";
+import {CommentParagraphUuidHotspotComponent} from "./hotspot/comment-paragraph-uuid-hotspot.component";
+import {CommentParagraphArticleButtonHotspotComponent} from "./hotspot/comment-paragraph-article-button.component";
export let mainComponents: any = [AllowCommentComponent];
+export let hotspots: any = [CommentParagraphUuidHotspotComponent, CommentParagraphArticleButtonHotspotComponent];
diff --git a/src/plugins/comment_paragraph/side-comments/side-comments.component.ts b/src/plugins/comment_paragraph/side-comments/side-comments.component.ts
index 9f7b126..a8c6d88 100644
--- a/src/plugins/comment_paragraph/side-comments/side-comments.component.ts
+++ b/src/plugins/comment_paragraph/side-comments/side-comments.component.ts
@@ -1,4 +1,4 @@
-import {Component, Inject, Input} from "ng-forward";
+import {Component, Inject, Input, Output} from "ng-forward";
import {CommentsComponent} from "../../../app/article/comment/comments.component";
import {CommentService} from "../../../lib/ng-noosfero-api/http/comment.service";
import {CommentParagraphService} from "../http/comment-paragraph.service";
diff --git a/src/plugins/index.ts b/src/plugins/index.ts
index 1a13cab..8e0ae15 100644
--- a/src/plugins/index.ts
+++ b/src/plugins/index.ts
@@ -2,3 +2,6 @@ import * as commentParagraph from "./comment_paragraph";
export let mainComponents: any = [];
mainComponents = mainComponents.concat(commentParagraph.mainComponents);
+
+export let hotspots: any = [];
+hotspots = hotspots.concat(commentParagraph.hotspots);
--
libgit2 0.21.2