Commit 66abb3310e25d6a5055a0a78120018b36c59168f

Authored by Victor Costa
1 parent 9571bf30

Fix profile query

src/app/index.config.js
... ... @@ -6,16 +6,11 @@
6 6 .config(config);
7 7  
8 8 /** @ngInject */
9   - function config($logProvider, toastrConfig) {
  9 + function config($logProvider, $locationProvider) {
10 10 // Enable log
11 11 $logProvider.debugEnabled(true);
12 12  
13   - // Set options third-party lib
14   - toastrConfig.allowHtml = true;
15   - toastrConfig.timeOut = 3000;
16   - toastrConfig.positionClass = 'toast-top-right';
17   - toastrConfig.preventDuplicates = true;
18   - toastrConfig.progressBar = true;
  13 + $locationProvider.html5Mode({enabled: true});
19 14 }
20 15  
21 16 })();
... ...
src/app/index.route.js
... ... @@ -7,7 +7,7 @@
7 7  
8 8 function routeConfig($routeProvider) {
9 9 $routeProvider
10   - .when('/', {
  10 + .when('/:profile', {
11 11 templateUrl: 'app/main/main.html',
12 12 controller: 'MainController',
13 13 controllerAs: 'main'
... ...
src/app/main/main.controller.js
... ... @@ -5,16 +5,17 @@
5 5 .module('angular')
6 6 .controller('MainController', MainController);
7 7  
  8 +
8 9 /** @ngInject */
9   - function MainController($timeout, noosfero, $log) {
  10 + function MainController($timeout, noosfero, $log, $routeParams) {
10 11 var vm = this;
11 12 vm.boxes = [];
12 13 activate();
13 14  
14 15 function activate() {
15   - noosfero.communities().get({id: 67, private_token: '1b00325e5f769a0c38550bd35b3f1d64'}).$promise.then(function (profile) {
  16 + noosfero.communities().get({identifier: $routeParams.profile, private_token: '1b00325e5f769a0c38550bd35b3f1d64'}).$promise.then(function (profile) {
16 17 $log.log(profile);
17   - vm.owner = profile.community;
  18 + vm.owner = profile.communities[0];
18 19 });
19 20 }
20 21  
... ...
src/index.html
1 1 <!doctype html>
2 2 <html ng-app="angular">
3 3 <head>
  4 + <base href="/test">
4 5 <meta charset="utf-8">
5 6 <title>angular</title>
6 7 <meta name="description" content="">
... ...