Commit 9ed8efe93dc3b0769ee091cf25137a603eae7903

Authored by Victor Costa
1 parent 56475a64

Add articles directives

src/app/components/noosfero-articles/article/article.directive.js 0 → 100644
@@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
  1 +(function() {
  2 + 'use strict';
  3 +
  4 + angular
  5 + .module('angular')
  6 + .directive('noosferoArticle', noosferoArticle);
  7 +
  8 + /** @ngInject */
  9 + function noosferoArticle() {
  10 + var directive = {
  11 + restrict: 'E',
  12 + templateUrl: 'app/components/noosfero-articles/article/article.html',
  13 + scope: {
  14 + article: '=',
  15 + owner: '='
  16 + },
  17 + controller: ArticleController,
  18 + controllerAs: 'vm',
  19 + bindToController: true
  20 + };
  21 +
  22 + return directive;
  23 +
  24 + /** @ngInject */
  25 + function ArticleController() {
  26 + var vm = this;
  27 + }
  28 + }
  29 +
  30 +})();
src/app/components/noosfero-articles/article/article.html 0 → 100644
@@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
  1 +<div class="page-header">
  2 + <h3 ng-bind="vm.article.title"></h3>
  3 +</div>
  4 +
  5 +<div>
  6 + <div ng-bind-html="vm.article.body"></div>
  7 +</div>
src/app/components/noosfero-articles/blog/blog.directive.js 0 → 100644
@@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
  1 +(function() {
  2 + 'use strict';
  3 +
  4 + angular
  5 + .module('angular')
  6 + .directive('noosferoBlog', noosferoBlog);
  7 +
  8 + /** @ngInject */
  9 + function noosferoBlog() {
  10 + var directive = {
  11 + restrict: 'E',
  12 + templateUrl: 'app/components/noosfero-articles/blog/blog.html',
  13 + scope: {
  14 + article: '=',
  15 + owner: '='
  16 + },
  17 + controller: BlogController,
  18 + controllerAs: 'vm',
  19 + bindToController: true
  20 + };
  21 +
  22 + return directive;
  23 +
  24 + /** @ngInject */
  25 + function BlogController() {
  26 + var vm = this;
  27 + }
  28 + }
  29 +
  30 +})();
src/app/components/noosfero-articles/blog/blog.html 0 → 100644
@@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
  1 +{{vm.article.title}}
  2 +
  3 +<pre>{{vm.article}}</pre>
src/app/content-viewer/content-viewer.controller.js
@@ -14,8 +14,7 @@ @@ -14,8 +14,7 @@
14 14
15 function activate() { 15 function activate() {
16 noosfero.communities.one($scope.vm.owner.id).one('articles').get({path: $stateParams.page}).then(function(articles) { 16 noosfero.communities.one($scope.vm.owner.id).one('articles').get({path: $stateParams.page}).then(function(articles) {
17 - $log.log(articles);  
18 - vm.content = articles.article; 17 + vm.article = articles.article;
19 }); 18 });
20 } 19 }
21 } 20 }
src/app/content-viewer/page.html
1 -<pre>{{vm.content}}</pre> 1 +<noosfero-article article="vm.article"></noosfero-article>
src/app/profile/profile.controller.js
@@ -14,7 +14,6 @@ @@ -14,7 +14,6 @@
14 14
15 function activate() { 15 function activate() {
16 noosfero.communities.one().get({private_token: '1b00325e5f769a0c38550bd35b3f1d64', identifier: $stateParams.profile}).then(function(communities) { 16 noosfero.communities.one().get({private_token: '1b00325e5f769a0c38550bd35b3f1d64', identifier: $stateParams.profile}).then(function(communities) {
17 - $log.log(communities);  
18 vm.owner = communities.communities[0]; 17 vm.owner = communities.communities[0];
19 }); 18 });
20 } 19 }