Skip to content

Commit b99fd3e

Browse files
committed
* 'canary' of https://github.com/DaftMonk/generator-angular-fullstack: feat(jscs): update to ^2.1.0, rename config file to .jscsrc, use esnext option docs(gen:readme): remove demo chore(npm): grunt-node-inspector ^0.2.0 -> ^0.4.1 Fix typo in readme.md fix(server:config): template db configs and add sequelize prod conf chore(dependencies): require peer-dependant modules directly, per npm 3+ feat(client:admin): use class for AdminController refactor(karma): update file globs, jade preprocessor only when `filters.jade` feat(client:admin): use controllerAs syntax for `AdminController` feat(client:admin): implement admin components as a seperate module chore(travis): add node 4.0.0 to travis targets
2 parents d2929b0 + 85feb4a commit b99fd3e

File tree

16 files changed

+97
-56
lines changed

16 files changed

+97
-56
lines changed

.travis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,15 @@ sudo: false
22
language: node_js
33
node_js:
44
- '0.12'
5+
- '4.0.0'
56
env:
67
global:
78
- SAUCE_USERNAME=fullstack_ci
89
- SAUCE_ACCESS_KEY=1a527ca6-4aa5-4618-86ce-0278bf158cbf
10+
matrix:
11+
fast_finish: true
12+
allow_failures:
13+
- node_js: 4.0.0
914
before_install:
1015
- ./scripts/sauce_connect_setup.sh
1116
- gem update --system

app/generator.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,7 @@ export default class Generator extends Base {
401401
if(this.filters.uirouter) angModules.push("'ui.router'");
402402
if(this.filters.uibootstrap) angModules.push("'ui.bootstrap'");
403403
if(this.filters.auth) {
404+
angModules.unshift(`'${this.scriptAppName}.admin'`);
404405
angModules.unshift(`'${this.scriptAppName}.auth'`);
405406
angModules.push("'validation.match'");
406407
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"esnext": true,
23
"maximumLineLength": {
34
"value": 100,
45
"allowComments": true,

app/templates/.travis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
language: node_js
22
node_js:
33
- '0.12'
4+
- '4.0.0'
5+
matrix:
6+
fast_finish: true
7+
allow_failures:
8+
- node_js: 4.0.0
49
before_script:
510
- npm install -g bower grunt-cli<% if (filters.sass) { %>
611
- gem install sass<% } %>

app/templates/Gruntfile(grunt).js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ module.exports = function (grunt) {
165165

166166
jscs: {
167167
options: {
168-
config: ".jscs.json"
168+
config: ".jscsrc"
169169
},
170170
main: {
171171
files: {

app/templates/_package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,19 +95,20 @@
9595
"grunt-contrib-jshint": "~0.11.2",
9696
"grunt-contrib-uglify": "^0.9.1",
9797
"grunt-contrib-watch": "~0.6.1",<% if (filters.jade) { %>
98-
"grunt-contrib-jade": "^0.15.0",<% } %><% if (filters.less) { %>
98+
"grunt-contrib-jade": "^0.15.0",
99+
"karma-ng-jade2js-preprocessor": "^0.2.0",<% } %><% if (filters.less) { %>
99100
"grunt-contrib-less": "^1.0.0",<% } %><% if(filters.babel) { %>
100101
"karma-babel-preprocessor": "^5.2.1",<% } %>
101102
"grunt-babel": "~5.0.0",
102103
"grunt-google-cdn": "~0.4.0",
103-
"grunt-jscs": "^2.0.0",
104+
"grunt-jscs": "^2.1.0",
104105
"grunt-newer": "^1.1.1",
105106
"grunt-ng-annotate": "^1.0.1",
106107
"grunt-ng-constant": "^1.1.0",
107108
"grunt-filerev": "^2.3.1",
108109
"grunt-usemin": "^3.0.0",
109110
"grunt-env": "~0.4.1",
110-
"grunt-node-inspector": "^0.2.0",
111+
"grunt-node-inspector": "^0.4.1",
111112
"grunt-nodemon": "^0.4.0",
112113
"grunt-angular-templates": "^0.5.4",
113114
"grunt-dom-munger": "^3.4.0",
@@ -129,6 +130,8 @@
129130
"connect-livereload": "^0.5.3",
130131
"mocha": "^2.2.5",
131132
"istanbul": "^0.3.17",
133+
"chai": "^3.2.0",
134+
"sinon": "^1.16.1",
132135
"chai-as-promised": "^5.1.0",
133136
"chai-things": "^0.2.0",
134137
"sinon-chai": "^2.8.0",<% if (filters.mocha) { %>
@@ -142,11 +145,11 @@
142145
"karma-firefox-launcher": "~0.1.6",
143146
"karma-script-launcher": "~0.1.0",
144147
"karma-html2js-preprocessor": "~0.1.0",
145-
"karma-ng-jade2js-preprocessor": "^0.2.0",
146148
"karma-chrome-launcher": "~0.2.0",
147149
"requirejs": "~2.1.11",
148150
"karma-requirejs": "~0.2.2",
149151
"karma-jade-preprocessor": "0.0.11",
152+
"phantomjs": "^1.9.18",
150153
"karma-phantomjs-launcher": "~0.2.0",
151154
"karma": "~0.13.3",
152155
"karma-ng-html2js-preprocessor": "~0.1.2",

app/templates/client/app/admin(auth)/admin(html).html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
<div class="container">
44
<p>The delete user and user index api routes are restricted to users with the 'admin' role.</p>
55
<ul class="list-group">
6-
<li class="list-group-item" ng-repeat="user in users">
6+
<li class="list-group-item" ng-repeat="user in admin.users">
77
<strong>{{user.name}}</strong><br>
88
<span class="text-muted">{{user.email}}</span>
9-
<a ng-click="delete(user)" class="trash"><span class="glyphicon glyphicon-trash pull-right"></span></a>
9+
<a ng-click="admin.delete(user)" class="trash"><span class="glyphicon glyphicon-trash pull-right"></span></a>
1010
</li>
1111
</ul>
1212
</div>

app/templates/client/app/admin(auth)/admin(jade).jade

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ navbar
33
p
44
| The delete user and user index api routes are restricted to users with the 'admin' role.
55
ul.list-group
6-
li.list-group-item(ng-repeat='user in users')
6+
li.list-group-item(ng-repeat='user in admin.users')
77
strong {{user.name}}
88
br
99
span.text-muted {{user.email}}
10-
a.trash(ng-click='delete(user)')
10+
a.trash(ng-click='admin.delete(user)')
1111
span.glyphicon.glyphicon-trash.pull-right
Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
'use strict';
22

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

5+
class AdminController {
6+
7+
constructor(User) {
68
// Use the User $resource to fetch all users
7-
$scope.users = User.query();
9+
this.users = User.query();
10+
}
11+
12+
delete(user) {
13+
user.$remove();
14+
this.users.splice(this.users.indexOf(user), 1);
15+
}
16+
}
17+
18+
angular.module('<%= scriptAppName %>.admin')
19+
.controller('AdminController', AdminController);
820

9-
$scope.delete = function(user) {
10-
User.remove({ id: user._id });
11-
$scope.users.splice(this.$index, 1);
12-
};
13-
});
21+
})();
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+
]);

0 commit comments

Comments
 (0)