Commit 2651201cd296322879ed00bddcb489f49398803d
1 parent
4b131cec
Exists in
master
and in
38 other branches
Add content viewer page
Showing
4 changed files
with
33 additions
and
0 deletions
Show diff stats
src/app/components/noosfero/noosfero.service.js
@@ -5,8 +5,12 @@ | @@ -5,8 +5,12 @@ | ||
5 | 5 | ||
6 | function noosfero($resource) { | 6 | function noosfero($resource) { |
7 | this.communities = communities; | 7 | this.communities = communities; |
8 | + this.articles = articles; | ||
8 | function communities() { | 9 | function communities() { |
9 | return $resource('/api/v1/communities/:id'); | 10 | return $resource('/api/v1/communities/:id'); |
10 | } | 11 | } |
12 | + function articles() { | ||
13 | + return $resource('/api/v1/articles/:id'); | ||
14 | + } | ||
11 | } | 15 | } |
12 | })(); | 16 | })(); |
@@ -0,0 +1,23 @@ | @@ -0,0 +1,23 @@ | ||
1 | +(function() { | ||
2 | + 'use strict'; | ||
3 | + | ||
4 | + angular | ||
5 | + .module('angular') | ||
6 | + .controller('ContentViewerController', ContentViewerController); | ||
7 | + | ||
8 | + | ||
9 | + /** @ngInject */ | ||
10 | + function ContentViewerController($timeout, noosfero, $log, $routeParams) { | ||
11 | + var vm = this; | ||
12 | + vm.article = null; | ||
13 | + activate(); | ||
14 | + | ||
15 | + function activate() { | ||
16 | + $log.log($routeParams.page); | ||
17 | + noosfero.articles().get({path: $routeParams.page, private_token: '1b00325e5f769a0c38550bd35b3f1d64'}).$promise.then(function (article) { | ||
18 | + //FIXME | ||
19 | + vm.article = article.articles[0]; | ||
20 | + }); | ||
21 | + } | ||
22 | + } | ||
23 | +})(); |
@@ -0,0 +1 @@ | @@ -0,0 +1 @@ | ||
1 | +{{vm.article.title}} |
src/app/index.route.js
@@ -12,6 +12,11 @@ | @@ -12,6 +12,11 @@ | ||
12 | controller: 'ProfileController', | 12 | controller: 'ProfileController', |
13 | controllerAs: 'vm' | 13 | controllerAs: 'vm' |
14 | }) | 14 | }) |
15 | + .when('/:profile/:page*', { | ||
16 | + templateUrl: 'app/content-viewer/page.html', | ||
17 | + controller: 'ContentViewerController', | ||
18 | + controllerAs: 'vm' | ||
19 | + }) | ||
15 | .when('/profile/:profile', { | 20 | .when('/profile/:profile', { |
16 | redirectTo: '/:profile' | 21 | redirectTo: '/:profile' |
17 | }) | 22 | }) |