diff --git a/src/app/components/noosfero-blocks/main-block/main-block.directive.js b/src/app/components/noosfero-blocks/main-block/main-block.directive.js new file mode 100644 index 0000000..cb67faa --- /dev/null +++ b/src/app/components/noosfero-blocks/main-block/main-block.directive.js @@ -0,0 +1,36 @@ +(function() { + 'use strict'; + + angular + .module('angular') + .directive('noosferoMainBlock', noosferoMainBlock); + + /** @ngInject */ + function noosferoMainBlock($log, $routeParams, noosfero) { + var directive = { + restrict: 'E', + templateUrl: 'app/components/noosfero-blocks/main-block/main-block.html', + scope: { + block: '=', + owner: '=' + }, + controller: MainBlockController, + controllerAs: 'vm', + bindToController: true + }; + + return directive; + + /** @ngInject */ + function MainBlockController() { + var vm = this; + $log.log($routeParams.page); + noosfero.articles().get({path: $routeParams.page, private_token: '1b00325e5f769a0c38550bd35b3f1d64'}).$promise.then(function (article) { + //FIXME + vm.article = article.articles[0]; + $log.log(vm.article); + }); + } + } + +})(); diff --git a/src/app/components/noosfero-blocks/main-block/main-block.html b/src/app/components/noosfero-blocks/main-block/main-block.html new file mode 100644 index 0000000..1de5f21 --- /dev/null +++ b/src/app/components/noosfero-blocks/main-block/main-block.html @@ -0,0 +1 @@ +
{{vm.article}}
diff --git a/src/app/content-viewer/page.html b/src/app/content-viewer/page.html deleted file mode 100644 index 0ef0eba..0000000 --- a/src/app/content-viewer/page.html +++ /dev/null @@ -1 +0,0 @@ -{{vm.article.title}} diff --git a/src/app/index.route.js b/src/app/index.route.js index 431b5ca..5930cd9 100644 --- a/src/app/index.route.js +++ b/src/app/index.route.js @@ -6,20 +6,17 @@ .config(routeConfig); function routeConfig($routeProvider) { + var profileController = { + templateUrl: 'app/profile/profile.html', + controller: 'ProfileController', + controllerAs: 'vm' + }; $routeProvider - .when('/:profile', { - templateUrl: 'app/profile/profile.html', - controller: 'ProfileController', - controllerAs: 'vm' - }) - .when('/:profile/:page*', { - templateUrl: 'app/content-viewer/page.html', - controller: 'ContentViewerController', - controllerAs: 'vm' - }) .when('/profile/:profile', { redirectTo: '/:profile' }) + .when('/:profile', profileController) + .when('/:profile/:page*', profileController) .otherwise({ redirectTo: '/' }); -- libgit2 0.21.2