Commit 93b3014086ad52067cd08f8757220c7a060ae365

Authored by Victor Costa
1 parent c748a7ca

Fetch blog posts from noosfero api

src/app/components/noosfero-articles/blog/blog.directive.js
... ... @@ -22,7 +22,13 @@
22 22 return directive;
23 23  
24 24 /** @ngInject */
25   - function BlogController() {
  25 + function BlogController(noosfero) {
  26 + var vm = this;
  27 + vm.posts = [];
  28 +
  29 + noosfero.articles.one(vm.article.id).customGET('children', {content_type: 'TinyMceArticle'}).then(function(result) {
  30 + vm.posts = result.articles;
  31 + });
26 32 }
27 33 }
28 34  
... ...
src/app/components/noosfero-articles/blog/blog.html
... ... @@ -9,10 +9,10 @@
9 9 </div>
10 10  
11 11 <div>
12   - <div ng-repeat="child in vm.article.children | orderBy: 'created_at':true">
  12 + <div ng-repeat="child in vm.posts | orderBy: 'created_at':true">
13 13 <div class="page-header">
14 14 <a class="title" ui-sref="main.profile.page({profile: vm.profile.identifier, page: child.path})"><h4 ng-bind="child.title"></h4></a>
15   - <div class="post-lead" ng-bind-html="child.body | truncate: 500: '...'"></div>
  15 + <div class="post-lead" ng-bind-html="child.body | truncate: 500: '...': true"></div>
16 16 </div>
17 17 </div>
18 18 </div>
... ...
src/app/components/noosfero/noosfero.service.js
... ... @@ -4,6 +4,7 @@
4 4 angular.module('angular').factory('noosfero', function(Restangular) {
5 5 return {
6 6 profiles: Restangular.service('profiles'),
  7 + articles: Restangular.service('articles'),
7 8 profile: function(profileId) {
8 9 return Restangular.one('profiles', profileId);
9 10 },
... ...