From a68fcd7ab902b7c885988ca127b660955dae02be Mon Sep 17 00:00:00 2001 From: Victor Costa Date: Tue, 10 May 2016 16:41:55 -0300 Subject: [PATCH] Add hotspot to display extra content for articles --- src/app/article/article-default-view.component.ts | 4 +++- src/app/article/article.html | 2 +- src/app/hotspot/article-content-hotspot.component.ts | 25 +++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 src/app/hotspot/article-content-hotspot.component.ts diff --git a/src/app/article/article-default-view.component.ts b/src/app/article/article-default-view.component.ts index fb55a27..edba801 100644 --- a/src/app/article/article-default-view.component.ts +++ b/src/app/article/article-default-view.component.ts @@ -3,6 +3,7 @@ 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"; +import {ArticleContentHotspotComponent} from "../hotspot/article-content-hotspot.component"; /** * @ngdoc controller @@ -33,7 +34,8 @@ export class ArticleDefaultViewComponent { selector: 'noosfero-article', template: 'not-used', directives: [ArticleDefaultViewComponent, ArticleBlogComponent, - CommentsComponent, MacroDirective, ArticleToolbarHotspotComponent] + CommentsComponent, MacroDirective, ArticleToolbarHotspotComponent, + ArticleContentHotspotComponent] }) @Inject("$element", "$scope", "$injector", "$compile") export class ArticleViewComponent { diff --git a/src/app/article/article.html b/src/app/article/article.html index 902de39..d85d66d 100644 --- a/src/app/article/article.html +++ b/src/app/article/article.html @@ -20,7 +20,7 @@ - +
diff --git a/src/app/hotspot/article-content-hotspot.component.ts b/src/app/hotspot/article-content-hotspot.component.ts new file mode 100644 index 0000000..df1db15 --- /dev/null +++ b/src/app/hotspot/article-content-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-content", + template: "" +}) +@Inject("$element", "$scope", "$compile") +export class ArticleContentHotspotComponent extends PluginHotspot { + + @Input() article: noosfero.Article; + + constructor( + private $element: any, + private $scope: ng.IScope, + private $compile: ng.ICompileService) { + super("article_extra_content"); + } + + addHotspot(directiveName: string) { + this.$element.append(this.$compile('<' + directiveName + ' [article]="ctrl.article">')(this.$scope)); + } +} -- libgit2 0.21.2