From f338d0b4b713baf3e1bb818cf0d35cecd9632c79 Mon Sep 17 00:00:00 2001 From: Victor Costa Date: Fri, 8 Jan 2016 11:16:38 -0300 Subject: [PATCH] Fix content viewer --- src/app/components/noosfero-blocks/main-block/main-block.directive.js | 6 ------ src/app/components/noosfero-blocks/main-block/main-block.html | 2 +- src/app/content-viewer/content-viewer.controller.js | 1 + src/app/content-viewer/page.html | 14 +------------- src/app/index.route.js | 29 ++++++----------------------- 5 files changed, 9 insertions(+), 43 deletions(-) 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 index 5bb4d15..e39b204 100644 --- a/src/app/components/noosfero-blocks/main-block/main-block.directive.js +++ b/src/app/components/noosfero-blocks/main-block/main-block.directive.js @@ -24,12 +24,6 @@ /** @ngInject */ function MainBlockController() { var vm = this; - $log.log($stateParams.page); - noosfero.articles().get({path: $stateParams.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 index 1de5f21..31800c0 100644 --- a/src/app/components/noosfero-blocks/main-block/main-block.html +++ b/src/app/components/noosfero-blocks/main-block/main-block.html @@ -1 +1 @@ -
{{vm.article}}
+
diff --git a/src/app/content-viewer/content-viewer.controller.js b/src/app/content-viewer/content-viewer.controller.js index 882f0d7..909738e 100644 --- a/src/app/content-viewer/content-viewer.controller.js +++ b/src/app/content-viewer/content-viewer.controller.js @@ -17,6 +17,7 @@ noosfero.articles().get({path: $stateParams.page, private_token: '1b00325e5f769a0c38550bd35b3f1d64'}).$promise.then(function (article) { //FIXME vm.content = article.articles[0]; + console.log(vm.content); }); } } diff --git a/src/app/content-viewer/page.html b/src/app/content-viewer/page.html index 1164a76..89e3b63 100644 --- a/src/app/content-viewer/page.html +++ b/src/app/content-viewer/page.html @@ -1,13 +1 @@ -
- -
- -
- -
- -
- -
- -{{vm.article}} +
{{vm.content}}
diff --git a/src/app/index.route.js b/src/app/index.route.js index 7ede5d0..dcbe692 100644 --- a/src/app/index.route.js +++ b/src/app/index.route.js @@ -6,40 +6,23 @@ .config(routeConfig); function routeConfig($stateProvider, $urlRouterProvider) { + $urlRouterProvider.when('/profile/:profile', '/:profile'); + $stateProvider .state('profile', { url: '/:profile', templateUrl: 'app/profile/profile.html', controller: 'ProfileController', controllerAs: 'vm' - }); - - $urlRouterProvider.otherwise('/'); - - /* - var profileController = { - templateUrl: 'app/profile/profile.html', - controller: 'ProfileController', - controllerAs: 'vm' - }; - $routeProvider - .when('/profile/:profile', { - redirectTo: '/:profile' - }) - .when('/:profile', { - templateUrl: 'app/profile/profile.html', - controller: 'ProfileController', - controllerAs: 'vm' }) - .when('/:profile/:page*', { + .state('profile.page', { + url: '/{page:.*}', templateUrl: 'app/content-viewer/page.html', controller: 'ContentViewerController', controllerAs: 'vm' - }) - .otherwise({ - redirectTo: '/' }); - */ + + $urlRouterProvider.otherwise('/'); } })(); -- libgit2 0.21.2