Semaphore/public/js/routes/router.js
Matej Kramny 0b417594a4 Improve setup, upgrade, new API
- Improve upgrade process (fixes #106)
- Improve upgrade UI
- Delete Users API
- Get user API
- User update API
- Security improvement (does not spill secret over api)
- Improve setup (fixes #100)
2016-05-23 20:29:38 +01:00

71 lines
1.7 KiB
JavaScript

app.config(function ($stateProvider, $urlRouterProvider, $locationProvider, $couchPotatoProvider) {
$locationProvider.html5Mode({
enabled: true,
requireBase: false
});
$urlRouterProvider.otherwise('/');
$stateProvider
.state('dashboard', {
url: '/',
pageTitle: 'Dashboard',
templateUrl: '/tpl/dashboard.html',
controller: 'DashboardCtrl',
resolve: {
$d: $couchPotatoProvider.resolveDependencies(['controllers/dashboard'])
}
})
.state('users', {
url: '/users',
abstract: true,
templateUrl: '/tpl/abstract.html'
})
.state('users.list', {
url: '',
pageTitle: 'Users',
templateUrl: '/tpl/users/list.html',
controller: 'UsersCtrl',
resolve: {
$d: $couchPotatoProvider.resolve(['controllers/users'])
}
})
.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);
}]
}
})
.state('admin', {
url: '/admin',
pageTitle: 'System Info',
templateUrl: '/tpl/admin.html',
controller: 'AdminCtrl',
resolve: {
$d: $couchPotatoProvider.resolve(['controllers/admin'])
}
})
.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');
}]
}
});
});
app.run(function($rootScope, $state, $stateParams, $http) {
$rootScope.$state = $state;
$rootScope.$stateParams = $stateParams;
});