mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-01-18 13:22:20 +01:00
Fixes the client-side tests after the removal of the <base/> tag from the main layout. These fixes aren't ideal. At the moment, they will suffice. This comment (https://github.com/angular-ui/ui-router/issues/212#issuecomment-60803437), among others in that issue, led me to choose this method as the fix to avoid having to change any other core code.
66 lines
1.7 KiB
JavaScript
66 lines
1.7 KiB
JavaScript
(function () {
|
|
'use strict';
|
|
|
|
angular
|
|
.module('articles.admin.routes')
|
|
.config(routeConfig);
|
|
|
|
routeConfig.$inject = ['$stateProvider'];
|
|
|
|
function routeConfig($stateProvider) {
|
|
$stateProvider
|
|
.state('admin.articles', {
|
|
abstract: true,
|
|
url: '/articles',
|
|
template: '<ui-view/>'
|
|
})
|
|
.state('admin.articles.list', {
|
|
url: '',
|
|
templateUrl: '/modules/articles/client/views/admin/list-articles.client.view.html',
|
|
controller: 'ArticlesAdminListController',
|
|
controllerAs: 'vm',
|
|
data: {
|
|
roles: ['admin']
|
|
}
|
|
})
|
|
.state('admin.articles.create', {
|
|
url: '/create',
|
|
templateUrl: '/modules/articles/client/views/admin/form-article.client.view.html',
|
|
controller: 'ArticlesAdminController',
|
|
controllerAs: 'vm',
|
|
data: {
|
|
roles: ['admin']
|
|
},
|
|
resolve: {
|
|
articleResolve: newArticle
|
|
}
|
|
})
|
|
.state('admin.articles.edit', {
|
|
url: '/:articleId/edit',
|
|
templateUrl: '/modules/articles/client/views/admin/form-article.client.view.html',
|
|
controller: 'ArticlesAdminController',
|
|
controllerAs: 'vm',
|
|
data: {
|
|
roles: ['admin']
|
|
},
|
|
resolve: {
|
|
articleResolve: getArticle
|
|
}
|
|
});
|
|
}
|
|
|
|
getArticle.$inject = ['$stateParams', 'ArticlesService'];
|
|
|
|
function getArticle($stateParams, ArticlesService) {
|
|
return ArticlesService.get({
|
|
articleId: $stateParams.articleId
|
|
}).$promise;
|
|
}
|
|
|
|
newArticle.$inject = ['ArticlesService'];
|
|
|
|
function newArticle(ArticlesService) {
|
|
return new ArticlesService();
|
|
}
|
|
}());
|