Skip to content

Commit 0aca9b5

Browse files
committed
Merge branch 'master' into pr/344
Conflicts: app/templates/_bower.json app/templates/_package.json
2 parents 1b90c44 + 8df4901 commit 0aca9b5

27 files changed

+209
-83
lines changed

Diff for: Gruntfile.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,5 @@ module.exports = function (grunt) {
5656
}, grunt.task.current.async());
5757
});
5858

59-
grunt.registerTask('default', ['bump', 'changelog', 'stage', 'release']);
59+
//grunt.registerTask('default', ['bump', 'changelog', 'stage', 'release']);
6060
};

Diff for: app/index.js

+22-4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ var AngularFullstackGenerator = yeoman.generators.Base.extend({
2222
this.scriptAppName = this.appname + genUtils.appName(this);
2323
this.appPath = this.env.options.appPath;
2424
this.pkg = require('../package.json');
25+
2526
this.filters = {};
2627
},
2728

@@ -87,12 +88,25 @@ var AngularFullstackGenerator = yeoman.generators.Base.extend({
8788
message: "What Angular router would you like to use?",
8889
choices: [ "ngRoute", "uiRouter"],
8990
filter: function( val ) { return val.toLowerCase(); }
91+
}, {
92+
type: "confirm",
93+
name: "bootstrap",
94+
message: "Would you like to include Bootstrap?"
95+
}, {
96+
type: "confirm",
97+
name: "uibootstrap",
98+
message: "Would you like to include UI Bootstrap?",
99+
when: function (answers) {
100+
return answers.bootstrap;
101+
}
90102
}], function (answers) {
91103
this.filters[answers.script] = true;
92104
this.filters[answers.markup] = true;
93105
this.filters[answers.stylesheet] = true;
94106
this.filters[answers.router] = true;
95-
cb();
107+
this.filters['bootstrap'] = answers.bootstrap;
108+
this.filters['uibootstrap'] = answers.uibootstrap;
109+
cb();
96110
}.bind(this));
97111
},
98112

@@ -206,16 +220,20 @@ var AngularFullstackGenerator = yeoman.generators.Base.extend({
206220
},
207221

208222
ngModules: function() {
209-
this.filters = this.config.get('filters');
223+
this.filters = this._.defaults(this.config.get('filters'), {
224+
bootstrap: true,
225+
uibootstrap: true
226+
});
227+
210228
var angModules = [
211229
"'ngCookies'",
212230
"'ngResource'",
213-
"'ngSanitize'",
214-
"'ui.bootstrap'"
231+
"'ngSanitize'"
215232
];
216233
if(this.filters['ngroute']) angModules.push("'ngRoute'");
217234
if(this.filters['socketio']) angModules.push("'btford.socket-io'");
218235
if(this.filters['uirouter']) angModules.push("'ui.router'");
236+
if(this.filters['uibootstrap']) angModules.push("'ui.bootstrap'");
219237

220238
this.angularModules = "\n " + angModules.join(",\n ") +"\n";
221239
},

Diff for: app/templates/Gruntfile.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ module.exports = function (grunt) {
244244
target: {
245245
src: '<%%= yeoman.client %>/index.html',
246246
ignorePath: '<%%= yeoman.client %>/',
247-
exclude: [/bootstrap-sass-official/, /bootstrap.js/<% if(!filters.css) { %>, /bootstrap.css/, /font-awesome.css/ <% } %>]
247+
exclude: [/bootstrap-sass-official/, /bootstrap.js/, '/json3/', '/es5-shim/'<% if(!filters.css) { %>, /bootstrap.css/, /font-awesome.css/ <% } %>]
248248
}
249249
},
250250

Diff for: app/templates/_bower.json

+5-6
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@
55
"angular": ">=1.2.*",
66
"json3": "~3.3.1",
77
"es5-shim": "~3.0.1",
8-
"jquery": "~1.11.0",<% if(filters.sass) { %>
9-
"bootstrap-sass-official": "~3.1.1",<% } %><% if(filters.stylus) { %>
10-
"bootstrap-stylus": "latest",<% } %>
11-
"bootstrap": "~3.1.1",
8+
"jquery": "~1.11.0",<% if(filters.bootstrap) { %><% if (filters.sass) { %>
9+
"bootstrap-sass-official": "~3.1.1",<% } %>
10+
"bootstrap": "~3.1.1",<% } %>
1211
"angular-resource": ">=1.2.*",
1312
"angular-cookies": ">=1.2.*",
1413
"angular-sanitize": ">=1.2.*",<% if(filters.ngroute) { %>
15-
"angular-route": ">=1.2.*",<% } %>
16-
"angular-bootstrap": "~0.11.0",
14+
"angular-route": ">=1.2.*",<% } %><% if(filters.uibootstrap) { %>
15+
"angular-bootstrap": "~0.11.0",<% } %>
1716
"font-awesome": ">=4.1.0",
1817
"lodash": "~2.4.1"<% if(filters.socketio) { %>,
1918
"angular-socket-io": "~0.6.0"<% } %><% if(filters.uirouter) { %>,

Diff for: app/templates/_package.json

+9-10
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
"express-session": "~1.0.2",
1313
"errorhandler": "~1.0.0",
1414
"compression": "~1.0.1",
15-
"lodash": "~2.4.1",<% if (filters.jade) { %>
16-
"jade": "~1.2.0",<% } %><% if (filters.html) { %>
15+
"lodash": "~2.4.1",<% if(filters.jade) { %>
16+
"jade": "~1.2.0",<% } %><% if(filters.html) { %>
1717
"ejs": "~0.8.4",<% } %><% if(filters.mongoose) { %>
1818
"mongoose": "~3.8.8",<% } %><% if(filters.auth) { %>
1919
"jsonwebtoken": "^0.3.0",
@@ -24,28 +24,27 @@
2424
"passport-twitter": "latest",<% } %><% if(filters.googleAuth) { %>
2525
"passport-google-oauth": "latest",<% } %>
2626
"composable-middleware": "^0.3.0",
27-
"connect-mongo": "^0.4.1",
28-
"socket.io": "~0.9.16",
29-
"socketio-jwt": "^2.0.2"
27+
"connect-mongo": "^0.4.1"<% if(filters.socketio) { %>,
28+
"socket.io": "~1.0.6",
29+
"socketio-jwt": "^2.0.2"<% } %>
3030
},
3131
"devDependencies": {
3232
"grunt": "~0.4.4",
3333
"grunt-autoprefixer": "~0.7.2",
3434
"grunt-bower-install": "~1.4.0",
3535
"grunt-concurrent": "~0.5.0",
3636
"grunt-contrib-clean": "~0.5.0",
37-
"grunt-contrib-compass": "~0.7.2",
3837
"grunt-contrib-concat": "~0.4.0",
3938
"grunt-contrib-copy": "~0.5.0",
4039
"grunt-contrib-cssmin": "~0.9.0",
4140
"grunt-contrib-htmlmin": "~0.2.0",
4241
"grunt-contrib-imagemin": "~0.7.1",
4342
"grunt-contrib-jshint": "~0.10.0",
4443
"grunt-contrib-uglify": "~0.4.0",
45-
"grunt-contrib-watch": "~0.6.1",
46-
"grunt-contrib-coffee": "^0.10.1",
47-
"grunt-contrib-jade": "^0.11.0",
48-
"grunt-contrib-less": "^0.11.0",
44+
"grunt-contrib-watch": "~0.6.1",<% if(filters.coffee) { %>
45+
"grunt-contrib-coffee": "^0.10.1",<% } %><% if(filters.jade) { %>
46+
"grunt-contrib-jade": "^0.11.0",<% } %><% if(filters.less) { %>
47+
"grunt-contrib-less": "^0.11.0",<% } %>
4948
"grunt-google-cdn": "~0.4.0",
5049
"grunt-newer": "~0.7.0",
5150
"grunt-ngmin": "~0.0.3",

Diff for: app/templates/client/app/account(auth)/account(coffee).coffee

+4-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ angular.module('<%= scriptAppName %>')
1313
)
1414
.when('/settings',
1515
templateUrl: 'app/account/settings/settings.html'
16-
controller: 'SettingsCtrl'
16+
controller: 'SettingsCtrl',
17+
authenticate: true
1718
)<% } %><% if(filters.uirouter) { %>.config ($stateProvider) ->
1819
$stateProvider
1920
.state('login',
@@ -29,5 +30,6 @@ angular.module('<%= scriptAppName %>')
2930
.state('settings',
3031
url: '/settings',
3132
templateUrl: 'app/account/settings/settings.html'
32-
controller: 'SettingsCtrl'
33+
controller: 'SettingsCtrl',
34+
authenticate: true
3335
)<% } %>

Diff for: app/templates/client/app/account(auth)/account(js).js

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ angular.module('<%= scriptAppName %>')
3131
.state('settings', {
3232
url: '/settings',
3333
templateUrl: 'app/account/settings/settings.html',
34-
controller: 'SettingsCtrl'
34+
controller: 'SettingsCtrl',
35+
authenticate: true
3536
});
3637
});<% } %>

Diff for: app/templates/client/app/account(auth)/login/login(less).less

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<% if(filters.bootstrap) { %>
12
// Colors
23
// --------------------------------------------------
34

@@ -34,4 +35,4 @@
3435

3536
.btn-google-plus {
3637
.button-variant(@btnText; @btnGooglePlusBackground; @btnGooglePlusBackgroundHighlight);
37-
}
38+
}<% } %>

Diff for: app/templates/client/app/account(auth)/login/login(sass).scss

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<% if(filters.bootstrap) { %>
12
// Colors
23
// --------------------------------------------------
34

@@ -34,4 +35,4 @@ $btnGooglePlusBackgroundHighlight: #c53727;
3435

3536
.btn-google-plus {
3637
@include button-variant($btnText, $btnGooglePlusBackground, $btnGooglePlusBackgroundHighlight);
37-
}
38+
}<% } %>

Diff for: app/templates/client/app/account(auth)/signup/signup(html).html

+16-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,22 @@ <h1>Sign up</h1>
6262
Login
6363
</a>
6464
</div>
65+
66+
<% if(filters.facebookAuth || filters.twitterAuth || filters.googleAuth) {%>
67+
<hr>
68+
<div><% if(filters.facebookAuth) {%>
69+
<a class="btn btn-facebook" href="" ng-click="loginOauth('facebook')">
70+
<i class="fa fa-facebook"></i> Connect with Facebook
71+
</a><% } %><% if(filters.googleAuth) {%>
72+
<a class="btn btn-google-plus" href="" ng-click="loginOauth('google')">
73+
<i class="fa fa-google-plus"></i> Connect with Google+
74+
</a><% } %><% if(filters.twitterAuth) {%>
75+
<a class="btn btn-twitter" href="" ng-click="loginOauth('twitter')">
76+
<i class="fa fa-twitter"></i> Connect with Twitter
77+
</a><% } %>
78+
</div><% } %>
6579
</form>
6680
</div>
6781
</div>
68-
</div>
82+
<hr>
83+
</div>

Diff for: app/templates/client/app/account(auth)/signup/signup(jade).jade

+18
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,21 @@ div(ng-include='"components/navbar/navbar.html"')
3838
= ' '
3939
a.btn.btn-default.btn-lg.btn-register(href='/login')
4040
| Login
41+
42+
43+
<% if(filters.facebookAuth || filters.twitterAuth || filters.googleAuth) {%>
44+
hr
45+
46+
div<% if(filters.facebookAuth) {%>
47+
a.btn.btn-facebook(href='', ng-click='loginOauth("facebook")')
48+
i.fa.fa-facebook
49+
| Connect with Facebook
50+
= ' '<% } %><% if(filters.googleAuth) {%>
51+
a.btn.btn-google-plus(href='', ng-click='loginOauth("google")')
52+
i.fa.fa-google-plus
53+
| Connect with Google+
54+
= ' '<% } %><% if(filters.twitterAuth) {%>
55+
a.btn.btn-twitter(href='', ng-click='loginOauth("twitter")')
56+
i.fa.fa-twitter
57+
| Connect with Twitter<% } %><% } %>
58+
hr

Diff for: app/templates/client/app/account(auth)/signup/signup.controller(coffee).coffee

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict'
22

3-
angular.module('<%= scriptAppName %>').controller 'SignupCtrl', ($scope, Auth, $location) ->
3+
angular.module('<%= scriptAppName %>').controller 'SignupCtrl', ($scope, Auth, $location, $window) ->
44
$scope.user = {}
55
$scope.errors = {}
66
$scope.register = (form) ->
@@ -22,4 +22,7 @@ angular.module('<%= scriptAppName %>').controller 'SignupCtrl', ($scope, Auth, $
2222
# Update validity of form fields that match the mongoose errors
2323
angular.forEach err.errors, (error, field) ->
2424
form[field].$setValidity 'mongoose', false
25-
$scope.errors[field] = error.message
25+
$scope.errors[field] = error.message
26+
27+
$scope.loginOauth = (provider) ->
28+
$window.location.href = '/auth/' + provider

Diff for: app/templates/client/app/account(auth)/signup/signup.controller(js).js

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
angular.module('<%= scriptAppName %>')
4-
.controller('SignupCtrl', function ($scope, Auth, $location) {
4+
.controller('SignupCtrl', function ($scope, Auth, $location, $window) {
55
$scope.user = {};
66
$scope.errors = {};
77

@@ -30,4 +30,8 @@ angular.module('<%= scriptAppName %>')
3030
});
3131
}
3232
};
33-
});
33+
34+
$scope.loginOauth = function(provider) {
35+
$window.location.href = '/auth/' + provider;
36+
};
37+
});

Diff for: app/templates/client/app/app(coffee).coffee

+2-1
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,6 @@ angular.module('<%= scriptAppName %>', [<%= angularModules %>])
3535
.run (($rootScope, $location, Auth) ->
3636
# Redirect to login if route requires auth and you're not logged in
3737
$rootScope.$on <% if(filters.ngroute) { %>'$routeChangeStart'<% } %><% if(filters.uirouter) { %>'$stateChangeStart'<% } %>, (event, next) ->
38-
$location.path '/login' if next.authenticate and not Auth.isLoggedIn()
38+
Auth.isLoggedInAsync (loggedIn) ->
39+
$location.path "/login" if next.authenticate and not loggedIn
3940
)<% } %>

Diff for: app/templates/client/app/app(css).css

+14
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1+
<% if(filters.bootstrap) { %>
12
/**
3+
* Bootstrap Fonts
4+
*/
5+
6+
@font-face {
7+
font-family: 'Glyphicons Halflings';
8+
src: url('../bower_components/bootstrap/fonts/glyphicons-halflings-regular.eot');
9+
src: url('../bower_components/bootstrap/fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'),
10+
url('../bower_components/bootstrap/fonts/glyphicons-halflings-regular.woff') format('woff'),
11+
url('../bower_components/bootstrap/fonts/glyphicons-halflings-regular.ttf') format('truetype'),
12+
url('../bower_components/bootstrap/fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg');
13+
}
14+
15+
<% } %>/**
216
* App-wide Styles
317
*/
418

Diff for: app/templates/client/app/app(js).js

+5-3
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@ angular.module('<%= scriptAppName %>', [<%= angularModules %>])
4646
.run(function ($rootScope, $location, Auth) {
4747
// Redirect to login if route requires auth and you're not logged in
4848
$rootScope.$on(<% if(filters.ngroute) { %>'$routeChangeStart'<% } %><% if(filters.uirouter) { %>'$stateChangeStart'<% } %>, function (event, next) {
49-
if (next.authenticate && !Auth.isLoggedIn()) {
50-
$location.path('/login');
51-
}
49+
Auth.isLoggedInAsync(function(loggedIn) {
50+
if (next.authenticate && !loggedIn) {
51+
$location.path('/login');
52+
}
53+
});
5254
});
5355
})<% } %>;

Diff for: app/templates/client/app/app(less).less

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
@import 'bootstrap/less/bootstrap.less';
1+
<% if(filters.bootstrap) { %>@import 'bootstrap/less/bootstrap.less';<% } %>
22
@import 'font-awesome/less/font-awesome.less';
33

4-
@icon-font-path: '/bower_components/bootstrap/fonts/';
4+
<% if(filters.bootstrap) { %>@icon-font-path: '/bower_components/bootstrap/fonts/';<% } %>
55
@fa-font-path: '/bower_components/font-awesome/fonts';
66

77
/**

Diff for: app/templates/client/app/app(sass).scss

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
$icon-font-path: "/bower_components/bootstrap-sass-official/vendor/assets/fonts/bootstrap/";
1+
<% if(filters.bootstrap) { %>$icon-font-path: "/bower_components/bootstrap-sass-official/vendor/assets/fonts/bootstrap/";<% } %>
22
$fa-font-path: "/bower_components/font-awesome/fonts";
3-
4-
@import 'bootstrap-sass-official/vendor/assets/stylesheets/bootstrap';
3+
<% if(filters.bootstrap) { %>
4+
@import 'bootstrap-sass-official/vendor/assets/stylesheets/bootstrap';<% } %>
55
@import 'font-awesome/scss/font-awesome';
66

77
/**

Diff for: app/templates/client/components/auth(auth)/auth.service(coffee).coffee

+18-1
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,31 @@ angular.module('<%= scriptAppName %>').factory 'Auth', ($location, $rootScope, $
9292

9393

9494
###
95-
Check if a user is logged in
95+
Check if a user is logged in synchronously
9696
9797
@return {Boolean}
9898
###
9999
isLoggedIn: ->
100100
currentUser.hasOwnProperty 'role'
101101

102102

103+
###
104+
Waits for currentUser to resolve before checking if user is logged in
105+
###
106+
isLoggedInAsync: (cb) ->
107+
if currentUser.hasOwnProperty('$promise')
108+
currentUser.$promise.then(->
109+
cb true
110+
return
111+
).catch ->
112+
cb false
113+
return
114+
115+
else if currentUser.hasOwnProperty('role')
116+
cb true
117+
else
118+
cb false
119+
103120
###
104121
Check if a user is an admin
105122

0 commit comments

Comments
 (0)