mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-07-28 17:30:44 +02:00
fix(articles): Article controllers name conflicts (#1428)
* fix(articles): Article controllers name conflicts Fixes the naming conflicts for the Articles controllers. Due to how Angular injects the controllers into the StateProvider, naming conflicts were caused between the Articles public & admin module controllers. To resolve the issue the referenced controllers in the Articles admin route configurations must be unique, and match up with the Admin controllers. * Client-side tests failing Fixed the client-side tests that were failing due to the naming conflicts.
This commit is contained in:
committed by
Liran Tal
parent
96aec09488
commit
c96f8c0b56
@@ -17,7 +17,7 @@
|
||||
.state('admin.articles.list', {
|
||||
url: '',
|
||||
templateUrl: 'modules/articles/client/views/admin/list-articles.client.view.html',
|
||||
controller: 'ArticlesListController',
|
||||
controller: 'ArticlesAdminListController',
|
||||
controllerAs: 'vm',
|
||||
data: {
|
||||
roles: ['admin']
|
||||
@@ -26,7 +26,7 @@
|
||||
.state('admin.articles.create', {
|
||||
url: '/create',
|
||||
templateUrl: 'modules/articles/client/views/admin/form-article.client.view.html',
|
||||
controller: 'ArticlesController',
|
||||
controller: 'ArticlesAdminController',
|
||||
controllerAs: 'vm',
|
||||
data: {
|
||||
roles: ['admin']
|
||||
@@ -38,7 +38,7 @@
|
||||
.state('admin.articles.edit', {
|
||||
url: '/:articleId/edit',
|
||||
templateUrl: 'modules/articles/client/views/admin/form-article.client.view.html',
|
||||
controller: 'ArticlesController',
|
||||
controller: 'ArticlesAdminController',
|
||||
controllerAs: 'vm',
|
||||
data: {
|
||||
roles: ['admin']
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
|
||||
angular
|
||||
.module('articles.admin')
|
||||
.controller('ArticlesController', ArticlesController);
|
||||
.controller('ArticlesAdminController', ArticlesAdminController);
|
||||
|
||||
ArticlesController.$inject = ['$scope', '$state', '$window', 'articleResolve', 'Authentication'];
|
||||
ArticlesAdminController.$inject = ['$scope', '$state', '$window', 'articleResolve', 'Authentication'];
|
||||
|
||||
function ArticlesController($scope, $state, $window, article, Authentication) {
|
||||
function ArticlesAdminController($scope, $state, $window, article, Authentication) {
|
||||
var vm = this;
|
||||
|
||||
vm.article = article;
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('articles')
|
||||
.controller('ArticlesListController', ArticlesListController);
|
||||
.module('articles.admin')
|
||||
.controller('ArticlesAdminListController', ArticlesAdminListController);
|
||||
|
||||
ArticlesListController.$inject = ['ArticlesService'];
|
||||
ArticlesAdminListController.$inject = ['ArticlesService'];
|
||||
|
||||
function ArticlesListController(ArticlesService) {
|
||||
function ArticlesAdminListController(ArticlesService) {
|
||||
var vm = this;
|
||||
|
||||
vm.articles = ArticlesService.query();
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
describe('Articles Controller Tests', function () {
|
||||
describe('Articles Admin Controller Tests', function () {
|
||||
// Initialize global variables
|
||||
var ArticlesController,
|
||||
var ArticlesAdminController,
|
||||
$scope,
|
||||
$httpBackend,
|
||||
$state,
|
||||
@@ -59,7 +59,7 @@
|
||||
};
|
||||
|
||||
// Initialize the Articles controller.
|
||||
ArticlesController = $controller('ArticlesController as vm', {
|
||||
ArticlesAdminController = $controller('ArticlesAdminController as vm', {
|
||||
$scope: $scope,
|
||||
articleResolve: {}
|
||||
});
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
|
||||
describe('Create Route', function () {
|
||||
var createstate,
|
||||
ArticlesController,
|
||||
ArticlesAdminController,
|
||||
mockArticle;
|
||||
|
||||
beforeEach(inject(function ($controller, $state, $templateCache) {
|
||||
@@ -70,7 +70,7 @@
|
||||
mockArticle = new ArticlesService();
|
||||
|
||||
// Initialize Controller
|
||||
ArticlesController = $controller('ArticlesController as vm', {
|
||||
ArticlesAdminController = $controller('ArticlesAdminController as vm', {
|
||||
$scope: $scope,
|
||||
articleResolve: mockArticle
|
||||
});
|
||||
@@ -105,7 +105,7 @@
|
||||
|
||||
describe('Edit Route', function () {
|
||||
var editstate,
|
||||
ArticlesController,
|
||||
ArticlesAdminController,
|
||||
mockArticle;
|
||||
|
||||
beforeEach(inject(function ($controller, $state, $templateCache) {
|
||||
@@ -120,7 +120,7 @@
|
||||
});
|
||||
|
||||
// Initialize Controller
|
||||
ArticlesController = $controller('ArticlesController as vm', {
|
||||
ArticlesAdminController = $controller('ArticlesAdminController as vm', {
|
||||
$scope: $scope,
|
||||
articleResolve: mockArticle
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
describe('Admin Articles List Controller Tests', function () {
|
||||
// Initialize global variables
|
||||
var ArticlesListController,
|
||||
var ArticlesAdminListController,
|
||||
$scope,
|
||||
$httpBackend,
|
||||
$state,
|
||||
@@ -59,7 +59,7 @@
|
||||
};
|
||||
|
||||
// Initialize the Articles List controller.
|
||||
ArticlesListController = $controller('ArticlesListController as vm', {
|
||||
ArticlesAdminListController = $controller('ArticlesAdminListController as vm', {
|
||||
$scope: $scope
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user