diff --git a/src/app/layout/blocks/display-content/display-content-block.component.spec.ts b/src/app/layout/blocks/display-content/display-content-block.component.spec.ts
new file mode 100644
index 0000000..cb729c5
--- /dev/null
+++ b/src/app/layout/blocks/display-content/display-content-block.component.spec.ts
@@ -0,0 +1,75 @@
+import {TestComponentBuilder} from 'ng-forward/cjs/testing/test-component-builder';
+import {Provider, provide} from 'ng-forward';
+import {ComponentTestHelper, createClass} from './../../../../spec/component-test-helper';
+import {providers} from 'ng-forward/cjs/testing/providers';
+import {DisplayContentBlockComponent} from './display-content-block.component';
+import * as helpers from './../../../../spec/helpers';
+
+const htmlTemplate: string = '';
+
+describe("Components", () => {
+
+ describe("Display Content Block Component", () => {
+ let state = jasmine.createSpyObj("state", ["go"]);
+ let providers = [
+ provide('ArticleService', {
+ useValue: helpers.mocks.articleService
+ }),
+ provide('$state', { useValue: state })
+ ].concat(helpers.provideFilters("translateFilter"));
+
+ let sections: noosfero.Section[] = [
+ { value: 'abstract', checked: 'abstract'},
+ { value: 'title', checked: 'title' }
+ ];
+ let settings: noosfero.Settings = {
+ limit: 6,
+ sections: sections
+ };
+
+ let helper: ComponentTestHelper;
+
+ beforeEach(angular.mock.module("templates"));
+
+ /**
+ * The beforeEach procedure will initialize the helper and parse
+ * the component according to the given providers. Unfortunetly, in
+ * this mode, the providers and properties given to the construtor
+ * can't be overriden.
+ */
+ beforeEach((done) => {
+ // Create the component bed for the test. Optionally, this could be done
+ // in each test if one needs customization of these parameters per test
+ let cls = createClass({
+ template: htmlTemplate,
+ directives: [DisplayContentBlockComponent],
+ providers: providers,
+ properties: {
+ block: {
+ settings: settings
+ }
+ }
+ });
+ helper = new ComponentTestHelper(cls, done);
+ });
+
+ it("verify settings is injected", () => {
+ expect(helper.component.block).not.toBeNull;
+ expect(helper.component.block.settings).not.toBeNull;
+ expect(helper.component.block.settings.limit).toEqual(6);
+ expect(helper.component.block.settings.sections.length).toEqual(3);
+ });
+
+ it("verify abstract is displayed", () => {
+ expect(helper.all("div[ng-bind-html|='article.abstract']")[0]).not.toBeNull;
+ });
+
+ it("verify title is displayed", () => {
+ expect(helper.all("div > h5")[0]).not.toBeNull;
+ });
+
+ it("verify body is not displayed", () => {
+ expect(helper.all("div[ng-bind-html|='article.body']")[0]).toBeNull;
+ });
+ });
+});
diff --git a/src/app/layout/blocks/display-content/display-content-block.component.ts b/src/app/layout/blocks/display-content/display-content-block.component.ts
new file mode 100644
index 0000000..a657750
--- /dev/null
+++ b/src/app/layout/blocks/display-content/display-content-block.component.ts
@@ -0,0 +1,55 @@
+import {Input, Inject, Component} from "ng-forward";
+import {ArticleService} from "../../../../lib/ng-noosfero-api/http/article.service";
+
+@Component({
+ selector: "noosfero-display-content-block",
+ templateUrl: 'app/layout/blocks/display-content/display-content-block.html',
+})
+@Inject(ArticleService, "$state")
+export class DisplayContentBlockComponent {
+
+ @Input() block: noosfero.Block;
+ @Input() owner: noosfero.Profile;
+
+ profile: noosfero.Profile;
+ articles: noosfero.Article[];
+ sections: noosfero.Section[];
+
+ documentsLoaded: boolean = false;
+
+ /**
+ * This configuration doesn't exists on Noosfero. Statically typing here.
+ */
+ private addDefaultSections() {
+ let author: noosfero.Section = { value: 'author', checked: 'author' };
+ this.sections.push(author);
+ }
+
+ constructor(private articleService: ArticleService, private $state: ng.ui.IStateService) {
+ }
+
+ ngOnInit() {
+ this.profile = this.owner;
+ let limit = ((this.block && this.block.settings) ? this.block.settings.limit : null) || 5;
+ this.articleService.getByProfile(this.profile, { content_type: 'TinyMceArticle', per_page: limit })
+ .then((result: noosfero.RestResult) => {
+ this.articles = result.data;
+ this.sections = this.block.settings.sections;
+ // Add sections not defined by Noosfero API
+ this.addDefaultSections();
+ this.documentsLoaded = true;
+ });
+ }
+
+ /**
+ * Returns whether a settings section should be displayed.
+ *
+ */
+ private display(section_name: string): boolean {
+ let section: noosfero.Section = this.sections.find( function(section: noosfero.Section) {
+ return section.value === section_name;
+ });
+ return section !== undefined && section.checked !== undefined;
+ }
+}
+
diff --git a/src/app/layout/blocks/display-content/display-content-block.html b/src/app/layout/blocks/display-content/display-content-block.html
new file mode 100644
index 0000000..458df91
--- /dev/null
+++ b/src/app/layout/blocks/display-content/display-content-block.html
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
![]()
+
+
+
+
+
+
+
+
+
diff --git a/src/app/layout/blocks/display-content/display-content-block.scss b/src/app/layout/blocks/display-content/display-content-block.scss
new file mode 100644
index 0000000..c5776e0
--- /dev/null
+++ b/src/app/layout/blocks/display-content/display-content-block.scss
@@ -0,0 +1,17 @@
+.members-block {
+ .member {
+ img, i.profile-image {
+ width: 60px;
+ }
+ img {
+ display: inline-block;
+ vertical-align: top;
+ }
+ i.profile-image {
+ text-align: center;
+ background-color: #889DB1;
+ color: #F1F1F1;
+ font-size: 4.5em;
+ }
+ }
+}
diff --git a/src/app/layout/blocks/display-content/index.ts b/src/app/layout/blocks/display-content/index.ts
new file mode 100644
index 0000000..b02ba2e
--- /dev/null
+++ b/src/app/layout/blocks/display-content/index.ts
@@ -0,0 +1,2 @@
+/* Module Index Entry - generated using the script npm run generate-index */
+export * from "./display-content-block.component";
diff --git a/src/app/main/main.component.ts b/src/app/main/main.component.ts
index 702b9e9..4ec2824 100644
--- a/src/app/main/main.component.ts
+++ b/src/app/main/main.component.ts
@@ -9,18 +9,16 @@ import {BoxesComponent} from "../layout/boxes/boxes.component";
import {BlockComponent} from "../layout/blocks/block.component";
import {EnvironmentComponent} from "../environment/environment.component";
import {EnvironmentHomeComponent} from "../environment/environment-home.component";
-import {PeopleBlockComponent} from "../layout/blocks/people/people-block.component";
-import {LinkListBlockComponent} from "./../layout/blocks/link-list/link-list-block.component";
-import {RecentDocumentsBlockComponent} from "../layout/blocks/recent-documents/recent-documents-block.component";
-import {ProfileImageBlockComponent} from "../layout/blocks/profile-image/profile-image-block.component";
-import {RawHTMLBlockComponent} from "../layout/blocks/raw-html/raw-html-block.component";
+import {PeopleBlockComponent} from "../layout/blocks/people-block/people-block.component";
+import {DisplayContentBlockComponent} from "../layout/blocks/display-content/display-content-block.component";
+import {LinkListBlockComponent} from "./../layout/blocks/link-list/link-list.component";
+import {RecentDocumentsBlockComponent} from "../layout/blocks/recent-documents/recent-documents.component";
+import {ProfileImageBlockComponent} from "../layout/blocks/profile-image-block/profile-image-block.component";
+import {RawHTMLBlockComponent} from "../layout/blocks/raw-html/raw-html.component";
import {StatisticsBlockComponent} from "../layout/blocks/statistics/statistics-block.component";
-import {MembersBlockComponent} from "./../layout/blocks/members/members-block.component";
-import {CommunitiesBlockComponent} from "./../layout/blocks/communities/communities-block.component";
-
-import {LoginBlockComponent} from "../layout/blocks/login-block/login-block.component";
-
+import {MembersBlockComponent} from "./../layout/blocks/members-block/members-block.component";
+import {CommunitiesBlockComponent} from "./../layout/blocks/communities-block/communities-block.component";
import {NoosferoTemplate} from "../shared/pipes/noosfero-template.filter";
import {DateFormat} from "../shared/pipes/date-format.filter";
@@ -83,7 +81,7 @@ export class EnvironmentContent {
* NoosferoTemplate, DateFormat, RawHTMLBlock
* @description
* The Main controller for the Noosfero Angular Theme application.
- *
+ *
* The main route '/' is defined as the URL for this controller, which routes
* requests to the {@link main.MainContentComponent} controller and also, the '/profile' route,
* which routes requests to the {@link profile.Profile} controller. See {@link profile.Profile}
@@ -94,7 +92,7 @@ export class EnvironmentContent {
template: '',
directives: [
ArticleBlogComponent, ArticleViewComponent, BoxesComponent, BlockComponent,
- EnvironmentComponent, PeopleBlockComponent,
+ EnvironmentComponent, PeopleBlockComponent, DisplayContentBlockComponent,
LinkListBlockComponent, CommunitiesBlockComponent, HtmlEditorComponent,
MainBlockComponent, RecentDocumentsBlockComponent, Navbar, SidebarComponent, ProfileImageBlockComponent,
MembersBlockComponent, NoosferoTemplate, DateFormat, RawHTMLBlockComponent, StatisticsBlockComponent,
diff --git a/src/languages/en.json b/src/languages/en.json
index 58c4b8a..d30aaa1 100644
--- a/src/languages/en.json
+++ b/src/languages/en.json
@@ -37,6 +37,7 @@
"comment.post.success.message": "Comment saved!",
"comment.reply": "reply",
"article.actions.edit": "Edit",
+ "article.actions.read_more": "Read More",
"article.basic_editor.title": "Title",
"article.basic_editor.body": "Body",
"article.basic_editor.save": "Save",
diff --git a/src/languages/pt.json b/src/languages/pt.json
index 17a82db..09d9562 100644
--- a/src/languages/pt.json
+++ b/src/languages/pt.json
@@ -37,6 +37,7 @@
"comment.post.success.message": "Comentário salvo com sucesso!",
"comment.reply": "responder",
"article.actions.edit": "Editar",
+ "article.actions.read_more": "Ler mais",
"article.basic_editor.title": "TÃtulo",
"article.basic_editor.body": "Corpo",
"article.basic_editor.save": "Salvar",
diff --git a/src/lib/ng-noosfero-api/interfaces/article.ts b/src/lib/ng-noosfero-api/interfaces/article.ts
index 6d48bc2..740b654 100644
--- a/src/lib/ng-noosfero-api/interfaces/article.ts
+++ b/src/lib/ng-noosfero-api/interfaces/article.ts
@@ -1,6 +1,7 @@
namespace noosfero {
export interface Article extends RestModel {
+ abstract: string;
path: string;
profile: Profile;
type: string;
diff --git a/src/lib/ng-noosfero-api/interfaces/block.ts b/src/lib/ng-noosfero-api/interfaces/block.ts
index b1ef409..fea2aca 100644
--- a/src/lib/ng-noosfero-api/interfaces/block.ts
+++ b/src/lib/ng-noosfero-api/interfaces/block.ts
@@ -1,7 +1,8 @@
namespace noosfero {
export interface Block extends RestModel {
id: number;
- settings: any;
+ settings: Settings;
+ limit: number;
api_content: any;
}
}
diff --git a/src/lib/ng-noosfero-api/interfaces/section.ts b/src/lib/ng-noosfero-api/interfaces/section.ts
new file mode 100644
index 0000000..1e1bb5d
--- /dev/null
+++ b/src/lib/ng-noosfero-api/interfaces/section.ts
@@ -0,0 +1,16 @@
+namespace noosfero {
+ /**
+ * @ngdoc interface
+ * @name noosfero.Section
+ * @description
+ * Represents a block settings section. A Section has a value property,
+ * which represents the Section name, and an optinally checked property which
+ * has the same value as the value property indicating that this property is
+ * selected in the block configuration.
+ */
+ export interface Section {
+
+ value: string;
+ checked: string;
+ }
+}
\ No newline at end of file
diff --git a/src/lib/ng-noosfero-api/interfaces/settings.ts b/src/lib/ng-noosfero-api/interfaces/settings.ts
new file mode 100644
index 0000000..3e242ad
--- /dev/null
+++ b/src/lib/ng-noosfero-api/interfaces/settings.ts
@@ -0,0 +1,9 @@
+namespace noosfero {
+ /**
+ * Represents a noosfero block settings.
+ */
+ export interface Settings {
+ sections: noosfero.Section[];
+ limit: number;
+ }
+}
\ No newline at end of file
--
libgit2 0.21.2