diff --git a/src/app/layout/blocks/block.component.ts b/src/app/layout/blocks/block.component.ts
index c139be4..13b1543 100644
--- a/src/app/layout/blocks/block.component.ts
+++ b/src/app/layout/blocks/block.component.ts
@@ -11,7 +11,7 @@ export class BlockComponent {
@Input() owner: any;
ngOnInit() {
- let blockName = (this.block && this.block.type) ? this.block.type.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase() : "default-block";
+ let blockName = (this.block && this.block.type) ? this.block.type.replace(/::/, '').replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase() : "default-block";
this.$element.replaceWith(this.$compile('')(this.$scope));
}
diff --git a/src/plugins/comment_paragraph/block/discussion/discussion-block.component.ts b/src/plugins/comment_paragraph/block/discussion/discussion-block.component.ts
new file mode 100644
index 0000000..a5322f2
--- /dev/null
+++ b/src/plugins/comment_paragraph/block/discussion/discussion-block.component.ts
@@ -0,0 +1,52 @@
+import {Component, Inject, Input} from "ng-forward";
+import {ArticleService} from "../../../../lib/ng-noosfero-api/http/article.service";
+
+@Component({
+ selector: "noosfero-comment-paragraph-plugin-discussion-block",
+ templateUrl: 'plugins/comment_paragraph/block/discussion/discussion-block.html'
+})
+@Inject(ArticleService, "$state")
+export class DiscussionBlockComponent {
+
+ @Input() block: any;
+ @Input() owner: any;
+
+ profile: any;
+ documents: any;
+
+ documentsLoaded: boolean = false;
+
+ constructor(private articleService: ArticleService, private $state: any) { }
+
+ ngOnInit() {
+ this.profile = this.owner;
+ this.documents = [];
+
+ let limit = ((this.block && this.block.settings) ? this.block.settings.limit : null) || 50;
+ let params = { content_type: 'CommentParagraphPlugin::Discussion', per_page: limit, order: 'start_date DESC' };
+ let now = new Date().toISOString();
+ switch (this.block.settings['discussion_status']) {
+ case 0:
+ params['from_start_date'] = now;
+ break;
+ case 1:
+ params['until_start_date'] = now;
+ params['from_end_date'] = now;
+ break;
+ case 2:
+ params['until_end_date'] = now;
+ break;
+ }
+ console.log(this.block.settings['discussion_status']);
+ this.articleService.getByProfile(this.profile, params)
+ .then((result: noosfero.RestResult) => {
+ this.documents = result.data;
+ this.documentsLoaded = true;
+ });
+ }
+
+ openDocument(article: any) {
+ this.$state.go("main.profile.page", { page: article.path, profile: article.profile.identifier });
+ }
+
+}
diff --git a/src/plugins/comment_paragraph/block/discussion/discussion-block.html b/src/plugins/comment_paragraph/block/discussion/discussion-block.html
new file mode 100644
index 0000000..10cef8d
--- /dev/null
+++ b/src/plugins/comment_paragraph/block/discussion/discussion-block.html
@@ -0,0 +1,26 @@
+
diff --git a/src/plugins/comment_paragraph/block/discussion/discussion-block.scss b/src/plugins/comment_paragraph/block/discussion/discussion-block.scss
new file mode 100644
index 0000000..30c3163
--- /dev/null
+++ b/src/plugins/comment_paragraph/block/discussion/discussion-block.scss
@@ -0,0 +1,67 @@
+.block {
+ noosfero-comment-paragraph-plugin-discussion-block {
+ .deckgrid[deckgrid]::before {
+ font-size: 0;
+ visibility: hidden;
+ }
+ .author {
+ img {
+ width: 30px;
+ height: 30px;
+ }
+ }
+ .header {
+ .subheader {
+ color: #C1C1C1;
+ font-size: 10px;
+ }
+ }
+ .post-lead {
+ color: #8E8E8E;
+ font-size: 14px;
+ }
+ .article-image {
+ margin: 10px 0;
+ }
+ }
+
+ .col-md-2-5 {
+ .deckgrid[deckgrid]::before {
+ content: '1 .deck-column';
+ }
+ }
+
+ .col-md-7 {
+ .block.recentdocumentsblock {
+ background-color: transparent;
+ border: 0;
+
+ .deckgrid[deckgrid]::before {
+ content: '3 .deck-column';
+ }
+
+ .panel-heading {
+ display: none;
+ }
+ .panel-body {
+ padding: 0;
+ }
+
+ .deckgrid {
+ .column {
+ float: left;
+ }
+
+ .deck-column {
+ @extend .col-md-4;
+ padding: 0;
+
+ .a-card {
+ padding: 10px;
+ margin: 3px;
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/plugins/comment_paragraph/index.ts b/src/plugins/comment_paragraph/index.ts
index de3f4ec..b4b946b 100644
--- a/src/plugins/comment_paragraph/index.ts
+++ b/src/plugins/comment_paragraph/index.ts
@@ -3,6 +3,7 @@ import {CommentParagraphArticleButtonHotspotComponent} from "./hotspot/comment-p
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];
+export let mainComponents: any = [AllowCommentComponent, DiscussionEditorComponent, DiscussionBlockComponent];
export let hotspots: any = [CommentParagraphArticleButtonHotspotComponent, CommentParagraphFormHotspotComponent, CommentParagraphArticleContentHotspotComponent];
--
libgit2 0.21.2