2016-03-18 23:03:28 +01:00
|
|
|
app.config(function ($stateProvider, $urlRouterProvider, $locationProvider, $couchPotatoProvider) {
|
|
|
|
$locationProvider.html5Mode({
|
|
|
|
enabled: true,
|
|
|
|
requireBase: false
|
|
|
|
});
|
|
|
|
|
|
|
|
$urlRouterProvider.otherwise('/');
|
|
|
|
|
|
|
|
$stateProvider
|
2016-03-28 19:28:26 +02:00
|
|
|
.state('dashboard', {
|
2016-03-18 23:03:28 +01:00
|
|
|
url: '/',
|
2016-03-28 19:28:26 +02:00
|
|
|
pageTitle: 'Dashboard',
|
|
|
|
templateUrl: '/tpl/dashboard.html',
|
|
|
|
controller: 'DashboardCtrl',
|
|
|
|
resolve: {
|
|
|
|
$d: $couchPotatoProvider.resolveDependencies(['controllers/dashboard'])
|
2016-03-18 23:03:28 +01:00
|
|
|
}
|
2016-04-10 20:03:12 +02:00
|
|
|
})
|
|
|
|
.state('users', {
|
|
|
|
url: '/users',
|
2016-05-23 21:29:38 +02:00
|
|
|
abstract: true,
|
|
|
|
templateUrl: '/tpl/abstract.html'
|
|
|
|
})
|
|
|
|
.state('users.list', {
|
|
|
|
url: '',
|
2016-04-10 20:03:12 +02:00
|
|
|
pageTitle: 'Users',
|
2016-05-17 17:18:26 +02:00
|
|
|
templateUrl: '/tpl/users/list.html',
|
2016-04-10 20:03:12 +02:00
|
|
|
controller: 'UsersCtrl',
|
|
|
|
resolve: {
|
|
|
|
$d: $couchPotatoProvider.resolve(['controllers/users'])
|
|
|
|
}
|
2016-05-17 17:18:26 +02:00
|
|
|
})
|
2016-05-23 21:29:38 +02:00
|
|
|
.state('users.user', {
|
|
|
|
url: '/:user_id',
|
|
|
|
pageTitle: 'User',
|
|
|
|
templateUrl: '/tpl/users/user.html',
|
|
|
|
controller: 'UserCtrl',
|
|
|
|
resolve: {
|
|
|
|
$d: $couchPotatoProvider.resolve(['controllers/user']),
|
|
|
|
user: ['$http', '$stateParams', function ($http, $stateParams) {
|
|
|
|
return $http.get('/users/' + $stateParams.user_id);
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
})
|
2016-05-17 17:18:26 +02:00
|
|
|
.state('admin', {
|
|
|
|
url: '/admin',
|
|
|
|
pageTitle: 'System Info',
|
|
|
|
templateUrl: '/tpl/admin.html',
|
|
|
|
controller: 'AdminCtrl',
|
|
|
|
resolve: {
|
|
|
|
$d: $couchPotatoProvider.resolve(['controllers/admin'])
|
|
|
|
}
|
2016-05-23 21:29:38 +02:00
|
|
|
})
|
|
|
|
.state('user', {
|
|
|
|
url: '/user',
|
|
|
|
pageTitle: 'User',
|
|
|
|
templateUrl: '/tpl/users/user.html',
|
|
|
|
controller: 'UserCtrl',
|
|
|
|
resolve: {
|
|
|
|
$d: $couchPotatoProvider.resolve(['controllers/user']),
|
|
|
|
user: ['$http', function ($http) {
|
|
|
|
return $http.get('/user');
|
|
|
|
}]
|
|
|
|
}
|
2016-04-10 20:03:12 +02:00
|
|
|
});
|
2016-03-18 23:03:28 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
app.run(function($rootScope, $state, $stateParams, $http) {
|
|
|
|
$rootScope.$state = $state;
|
|
|
|
$rootScope.$stateParams = $stateParams;
|
|
|
|
});
|