Commit b084846224d63124d59a5a67ac62cd9a78ad800c

Authored by Victor Costa
1 parent 08013629

Refactor url generation

src/app/components/navbar/navbar.html
... ... @@ -7,7 +7,7 @@
7 7 <span class="icon-bar"></span>
8 8 <span class="icon-bar"></span>
9 9 </button>
10   - <a class="navbar-brand" ng-href="/">
  10 + <a class="navbar-brand" ui-sref="main">
11 11 <span class="noosfero-logo"><img src="assets/images/logo-noosfero.png"></span> Noosfero
12 12 </a>
13 13 </div>
... ... @@ -31,7 +31,7 @@
31 31 <a ui-sref="main.profile.info({profile: vm.currentUser.person.identifier})"><i class="fa fa-fw fa-user"></i> Profile</a>
32 32 </li>
33 33 <li>
34   - <a target="_self" ng-href="/myprofile/{{vm.currentUser.person.identifier}}"><i class="fa fa-fw fa-gear"></i> Settings</a>
  34 + <a target="_self" ui-sref="main.profile.settings({profile: vm.currentUser.person.identifier})"><i class="fa fa-fw fa-gear"></i> Settings</a>
35 35 </li>
36 36 <li class="divider"></li>
37 37 <li>
... ...
src/app/components/noosfero-activities/activity/create_article.html
... ... @@ -9,7 +9,8 @@
9 9 <div class="timeline-body">
10 10 <div class="article">
11 11 <div class="title">
12   - <a ng-href="/{{vm.activity.target.article.profile.identifier}}/{{vm.activity.target.article.path}}">{{vm.activity.target.article.title}}</a>
  12 + <a ui-sref="main.profile.page({profile: vm.activity.target.article.profile.identifier, page: vm.activity.target.article.path})"
  13 + ng-bind="vm.activity.target.article.title"></a>
13 14 </div>
14 15 <div class="lead small">
15 16 <div ng-bind-html="vm.activity.target.article.body | stripTags | truncate: 100 : '...'"></div>
... ...
src/app/components/noosfero-articles/blog/blog.html
... ... @@ -10,7 +10,7 @@
10 10 <div>
11 11 <div ng-repeat="child in vm.article.children | orderBy: 'created_at':true">
12 12 <div class="page-header">
13   - <a ng-href="/{{vm.profile.identifier}}/{{child.path}}"><h4 ng-bind="child.title"></h4></a>
  13 + <a ui-sref="main.profile.page({profile: vm.profile.identifier, page: child.path})"><h4 ng-bind="child.title"></h4></a>
14 14 <div ng-bind-html="child.body | truncate: 500: '...'"></div>
15 15 </div>
16 16 </div>
... ...
src/app/components/noosfero-blocks/profile-image/profile-image.html
... ... @@ -5,6 +5,6 @@
5 5 </a>
6 6 </div>
7 7 <div class='admin-link'>
8   - <a target="_self" ng-href="/myprofile/{{vm.owner.identifier}}">Control panel</a>
  8 + <a target="_self" ui-sref="main.profile.settings({profile: vm.owner.identifier})">Control panel</a>
9 9 </div>
10 10 </div>
... ...
src/app/index.route.js
... ... @@ -32,10 +32,13 @@
32 32 controllerAs: 'vm'
33 33 })
34 34 .state('main.profile.page', {
35   - url: '/{page:.*}',
  35 + url: '/{page:any}',
36 36 templateUrl: 'app/content-viewer/page.html',
37 37 controller: 'ContentViewerController',
38 38 controllerAs: 'vm'
  39 + })
  40 + .state('main.profile.settings', {
  41 + url: '^/myprofile/:profile'
39 42 });
40 43  
41 44 $urlRouterProvider.otherwise('/');
... ...