Skip to content

Commit 5babe1c

Browse files
committed
feat(client:admin): implement admin components as a seperate module
1 parent 10b5179 commit 5babe1c

File tree

5 files changed

+13
-4
lines changed

5 files changed

+13
-4
lines changed

app/generator.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,7 @@ export default class Generator extends Base {
375375
if(this.filters.uirouter) angModules.push("'ui.router'");
376376
if(this.filters.uibootstrap) angModules.push("'ui.bootstrap'");
377377
if(this.filters.auth) {
378+
angModules.unshift(`'${this.scriptAppName}.admin'`);
378379
angModules.unshift(`'${this.scriptAppName}.auth'`);
379380
angModules.push("'validation.match'");
380381
}

app/templates/client/app/admin(auth)/admin.controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
angular.module('<%= scriptAppName %>')
3+
angular.module('<%= scriptAppName %>.admin')
44
.controller('AdminCtrl', function($scope, $http, Auth, User) {
55

66
// Use the User $resource to fetch all users
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
'use strict';
2+
3+
angular.module('<%= scriptAppName %>.admin', [
4+
'<%= scriptAppName %>.auth'<% if (filters.ngroute) { %>,
5+
'ngRoute'<% } if (filters.uirouter) { %>,
6+
'ui.router'<% } %>
7+
]);

app/templates/client/app/admin(auth)/admin.js renamed to app/templates/client/app/admin(auth)/admin.router.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
'use strict';
22

3-
angular.module('<%= scriptAppName %>')
3+
angular.module('<%= scriptAppName %>.admin')
44
<% if (filters.ngroute) { %>.config(function($routeProvider) {
55
$routeProvider
66
.when('/admin', {
77
templateUrl: 'app/admin/admin.html',
88
controller: 'AdminCtrl',
99
authenticate: 'admin'
1010
});
11-
});<% } %><% if (filters.uirouter) { %>.config(function($stateProvider) {
11+
});<% } if (filters.uirouter) { %>.config(function($stateProvider) {
1212
$stateProvider
1313
.state('admin', {
1414
url: '/admin',

test/test-file-creation.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,8 @@ describe('angular-fullstack generator', function () {
267267
'client/app/account/signup/signup.controller.' + script,
268268
'client/app/admin/admin.' + markup,
269269
'client/app/admin/admin.' + stylesheet,
270-
'client/app/admin/admin.' + script,
270+
'client/app/admin/admin.module.' + script,
271+
'client/app/admin/admin.router.' + script,
271272
'client/app/admin/admin.controller.' + script,
272273
'client/components/auth/auth.module.' + script,
273274
'client/components/auth/auth.service.' + script,

0 commit comments

Comments
 (0)