diff --git a/src/app/components/noosfero-articles/article/article.directive.js b/src/app/components/noosfero-articles/article/article.directive.js index ca461d9..4756dd6 100644 --- a/src/app/components/noosfero-articles/article/article.directive.js +++ b/src/app/components/noosfero-articles/article/article.directive.js @@ -6,23 +6,30 @@ .directive('noosferoArticle', noosferoArticle); /** @ngInject */ - function noosferoArticle() { + function noosferoArticle($injector, $compile) { var directive = { restrict: 'E', templateUrl: 'app/components/noosfero-articles/article/article.html', scope: { article: '=', - owner: '=' + profile: '=' }, controller: ArticleController, controllerAs: 'vm', - bindToController: true + bindToController: true, + link: function(scope, element) { + var specificDirective = 'noosfero'+scope.vm.article.type; + if($injector.has(specificDirective+'Directive')) { + var directiveName = specificDirective.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); + element.replaceWith($compile('<'+directiveName+' article="vm.article" profile="vm.profile">')(scope)); + } + } }; return directive; /** @ngInject */ - function ArticleController() { + function ArticleController($injector, $compile, $scope) { var vm = this; } } diff --git a/src/app/components/noosfero-articles/blog/blog.directive.js b/src/app/components/noosfero-articles/blog/blog.directive.js index 77aa870..2c0c345 100644 --- a/src/app/components/noosfero-articles/blog/blog.directive.js +++ b/src/app/components/noosfero-articles/blog/blog.directive.js @@ -12,7 +12,7 @@ templateUrl: 'app/components/noosfero-articles/blog/blog.html', scope: { article: '=', - owner: '=' + profile: '=' }, controller: BlogController, controllerAs: 'vm', diff --git a/src/app/components/noosfero-articles/blog/blog.html b/src/app/components/noosfero-articles/blog/blog.html index dabc68a..cc2aa5a 100644 --- a/src/app/components/noosfero-articles/blog/blog.html +++ b/src/app/components/noosfero-articles/blog/blog.html @@ -1,3 +1,10 @@ -{{vm.article.title}} + -
{{vm.article}}
+
+
+

+
+
+
diff --git a/src/app/content-viewer/content-viewer.controller.js b/src/app/content-viewer/content-viewer.controller.js index be33dbd..b537034 100644 --- a/src/app/content-viewer/content-viewer.controller.js +++ b/src/app/content-viewer/content-viewer.controller.js @@ -10,10 +10,12 @@ function ContentViewerController(noosfero, $log, $stateParams, $scope) { var vm = this; vm.article = null; + vm.profile = null; activate(); function activate() { - noosfero.communities.one($scope.vm.owner.id).one('articles').get({path: $stateParams.page}).then(function(articles) { + vm.profile = $scope.vm.owner; + noosfero.communities.one(vm.profile.id).one('articles').get({path: $stateParams.page}).then(function(articles) { vm.article = articles.article; }); } diff --git a/src/app/content-viewer/page.html b/src/app/content-viewer/page.html index 0f2232b..d51a781 100644 --- a/src/app/content-viewer/page.html +++ b/src/app/content-viewer/page.html @@ -1 +1 @@ - + -- libgit2 0.21.2