Skip to content

Commit 044cbd6

Browse files
committed
Merge pull request #1156 from kingcody/feature/oauth-buttons
feat(app): implement oauth-buttons directive
2 parents f16cb71 + 8e21ce9 commit 044cbd6

40 files changed

+402
-192
lines changed

Diff for: app/templates/Gruntfile.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,8 @@ module.exports = function (grunt) {
255255
'/es5-shim/'<% if(!filters.css) { %>,
256256
/font-awesome\.css/<% if(filters.bootstrap) { %>,
257257
/bootstrap\.css/<% if(filters.sass) { %>,
258-
/bootstrap-sass-official/<% }}} %>
258+
/bootstrap-sass-official/<% } if(filters.oauth) { %>,
259+
/bootstrap-social\.css/<% }}} %>
259260
]
260261
},
261262
client: {

Diff for: app/templates/_bower.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"json3": "~3.3.1",
77
"es5-shim": "~3.0.1",<% if(filters.bootstrap) { if (filters.sass) { %>
88
"bootstrap-sass-official": "~3.1.1",<% } %>
9-
"bootstrap": "~3.1.1",<% } %>
9+
"bootstrap": "~3.1.1",<% if(filters.oauth) { %>
10+
"bootstrap-social": "~4.9.1",<% }} %>
1011
"angular-resource": "~1.4.0",
1112
"angular-cookies": "~1.4.0",
1213
"angular-sanitize": "~1.4.0",<% if (filters.ngroute) { %>

Diff for: app/templates/client/.jshintrc

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"console": true,
2323
"$": true,
2424
"_": true,
25-
"moment": true,
25+
"moment": true,<% if (filters.jasmine) { %>
26+
"jasmine": true,<% } %>
2627
"describe": true,
2728
"beforeEach": true,
2829
"module": true,

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

+6-12
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,12 @@ <h1>Login</h1>
4141
Register
4242
</a>
4343
</div>
44-
<% if (filters.oauth) {%>
45-
<hr>
46-
<div><% if (filters.facebookAuth) {%>
47-
<a class="btn btn-facebook" href="" ng-click="loginOauth('facebook')">
48-
<i class="fa fa-facebook"></i> Connect with Facebook
49-
</a><% } %><% if (filters.googleAuth) {%>
50-
<a class="btn btn-google-plus" href="" ng-click="loginOauth('google')">
51-
<i class="fa fa-google-plus"></i> Connect with Google+
52-
</a><% } %><% if (filters.twitterAuth) {%>
53-
<a class="btn btn-twitter" href="" ng-click="loginOauth('twitter')">
54-
<i class="fa fa-twitter"></i> Connect with Twitter
55-
</a><% } %>
44+
<% if (filters.oauth) { %>
45+
<hr/>
46+
<div class="row">
47+
<div class="col-sm-4 col-md-3">
48+
<oauth-buttons classes="btn-block"></oauth-buttons>
49+
</div>
5650
</div><% } %>
5751
</form>
5852
</div>

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

+4-12
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,8 @@ navbar
3939
<% if (filters.oauth) {%>
4040
hr
4141

42-
div<% if (filters.facebookAuth) {%>
43-
a.btn.btn-facebook(href='', ng-click='loginOauth("facebook")')
44-
i.fa.fa-facebook
45-
| Connect with Facebook
46-
= ' '<% } %><% if (filters.googleAuth) {%>
47-
a.btn.btn-google-plus(href='', ng-click='loginOauth("google")')
48-
i.fa.fa-google-plus
49-
| Connect with Google+
50-
= ' '<% } %><% if (filters.twitterAuth) {%>
51-
a.btn.btn-twitter(href='', ng-click='loginOauth("twitter")')
52-
i.fa.fa-twitter
53-
| Connect with Twitter<% } %><% } %>
42+
.row
43+
.col-sm-4.col-md-3
44+
oauth-buttons(classes='btn-block')
45+
<% } %>
5446
hr

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

-30
This file was deleted.

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

-30
This file was deleted.

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

-22
This file was deleted.

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

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

33
angular.module '<%= scriptAppName %>'
4-
.controller 'LoginCtrl', ($scope, Auth<% if (filters.ngroute) { %>, $location<% } %><% if (filters.uirouter) { %>, $state<% } %><% if (filters.oauth) {%>, $window<% } %>) ->
4+
.controller 'LoginCtrl', ($scope, Auth<% if (filters.ngroute) { %>, $location<% } %><% if (filters.uirouter) { %>, $state<% } %>) ->
55
$scope.user = {}
66
$scope.errors = {}
77
$scope.login = (form) ->
@@ -18,6 +18,3 @@ angular.module '<%= scriptAppName %>'
1818

1919
.catch (err) ->
2020
$scope.errors.other = err.message
21-
<% if (filters.oauth) {%>
22-
$scope.loginOauth = (provider) ->
23-
$window.location.href = '/auth/' + provider<% } %>

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

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

33
angular.module('<%= scriptAppName %>')
4-
.controller('LoginCtrl', function($scope, Auth<% if (filters.ngroute) { %>, $location<% } %><% if (filters.uirouter) { %>, $state<% } %><% if (filters.oauth) { %>, $window<% } %>) {
4+
.controller('LoginCtrl', function($scope, Auth<% if (filters.ngroute) { %>, $location<% } %><% if (filters.uirouter) { %>, $state<% } %>) {
55
$scope.user = {};
66
$scope.errors = {};
77

@@ -22,8 +22,5 @@ angular.module('<%= scriptAppName %>')
2222
});
2323
}
2424
};
25-
<% if (filters.oauth) {%>
26-
$scope.loginOauth = function(provider) {
27-
$window.location.href = '/auth/' + provider;
28-
};<% } %>
25+
2926
});

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

+6-12
Original file line numberDiff line numberDiff line change
@@ -74,18 +74,12 @@ <h1>Sign up</h1>
7474
Login
7575
</a>
7676
</div>
77-
<% if (filters.oauth) {%>
78-
<hr>
79-
<div><% if (filters.facebookAuth) {%>
80-
<a class="btn btn-facebook" href="" ng-click="loginOauth('facebook')">
81-
<i class="fa fa-facebook"></i> Connect with Facebook
82-
</a><% } %><% if (filters.googleAuth) {%>
83-
<a class="btn btn-google-plus" href="" ng-click="loginOauth('google')">
84-
<i class="fa fa-google-plus"></i> Connect with Google+
85-
</a><% } %><% if (filters.twitterAuth) {%>
86-
<a class="btn btn-twitter" href="" ng-click="loginOauth('twitter')">
87-
<i class="fa fa-twitter"></i> Connect with Twitter
88-
</a><% } %>
77+
<% if (filters.oauth) { %>
78+
<hr/>
79+
<div class="row">
80+
<div class="col-sm-4 col-md-3">
81+
<oauth-buttons classes="btn-block"></oauth-buttons>
82+
</div>
8983
</div><% } %>
9084
</form>
9185
</div>

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

+4-13
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,11 @@ navbar
5353
= ' '
5454
a.btn.btn-default.btn-lg.btn-login(<% if (filters.uirouter) { %>ui-sref='login'<% } else { %>href='/login'<% } %>)
5555
| Login
56-
5756
<% if (filters.oauth) {%>
5857
hr
5958

60-
div<% if (filters.facebookAuth) {%>
61-
a.btn.btn-facebook(href='', ng-click='loginOauth("facebook")')
62-
i.fa.fa-facebook
63-
| Connect with Facebook
64-
= ' '<% } %><% if (filters.googleAuth) {%>
65-
a.btn.btn-google-plus(href='', ng-click='loginOauth("google")')
66-
i.fa.fa-google-plus
67-
| Connect with Google+
68-
= ' '<% } %><% if (filters.twitterAuth) {%>
69-
a.btn.btn-twitter(href='', ng-click='loginOauth("twitter")')
70-
i.fa.fa-twitter
71-
| Connect with Twitter<% } %><% } %>
59+
.row
60+
.col-sm-4.col-md-3
61+
oauth-buttons(classes='btn-block')
62+
<% } %>
7263
hr

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

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

33
angular.module '<%= scriptAppName %>'
4-
.controller 'SignupCtrl', ($scope, Auth<% if (filters.ngroute) { %>, $location<% } %><% if (filters.uirouter) { %>, $state<% } %><% if (filters.oauth) {%>, $window<% } %>) ->
4+
.controller 'SignupCtrl', ($scope, Auth<% if (filters.ngroute) { %>, $location<% } %><% if (filters.uirouter) { %>, $state<% } %>) ->
55
$scope.user = {}
66
$scope.errors = {}
77
$scope.register = (form) ->
@@ -31,6 +31,3 @@ angular.module '<%= scriptAppName %>'
3131
angular.forEach err.fields, (field) ->
3232
form[field].$setValidity 'mongoose', false
3333
$scope.errors[field] = err.message<% } %>
34-
<% if (filters.oauth) {%>
35-
$scope.loginOauth = (provider) ->
36-
$window.location.href = '/auth/' + provider<% } %>

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

+2-5
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<% if (filters.ngroute) { %>, $location<% } %><% if (filters.uirouter) { %>, $state<% } %><% if (filters.oauth) { %>, $window<% } %>) {
4+
.controller('SignupCtrl', function($scope, Auth<% if (filters.ngroute) { %>, $location<% } %><% if (filters.uirouter) { %>, $state<% } %>) {
55
$scope.user = {};
66
$scope.errors = {};
77

@@ -38,8 +38,5 @@ angular.module('<%= scriptAppName %>')
3838
});
3939
}
4040
};
41-
<% if (filters.oauth) {%>
42-
$scope.loginOauth = function(provider) {
43-
$window.location.href = '/auth/' + provider;
44-
};<% } %>
41+
4542
});

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

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
<% if (filters.bootstrap) { %>@import '../bower_components/bootstrap/less/bootstrap.less';<% } %>
2-
@import '../bower_components/font-awesome/less/font-awesome.less';
1+
<% if (filters.bootstrap) { %>@import '../bower_components/bootstrap/less/bootstrap.less';
2+
<% if(filters.oauth) { %>@import '../bower_components/bootstrap-social/bootstrap-social.less';
3+
<% }} %>@import '../bower_components/font-awesome/less/font-awesome.less';
34

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

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

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

77
/**

Diff for: app/templates/client/app/app(stylus).styl

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
@import "../bower_components/font-awesome/css/font-awesome.css"
22
<% if (filters.bootstrap) { %>@import "../bower_components/bootstrap/dist/css/bootstrap.css"
3-
3+
<% if (filters.oauth) { %>@import "../bower_components/bootstrap-social/bootstrap-social.css"
4+
<% } %>
45
//
56
// Bootstrap Fonts
67
//
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<% if(filters.facebookAuth) { %><a ng-class="classes" ng-click="OauthButtons.loginOauth('facebook')" class="btn<% if (filters.bootstrap) { %> btn-social<% } %> btn-facebook">
2+
<i class="fa fa-facebook"></i>
3+
Connect with Facebook
4+
</a>
5+
<% } if (filters.googleAuth) { %><a ng-class="classes" ng-click="OauthButtons.loginOauth('google')" class="btn<% if (filters.bootstrap) { %> btn-social<% } %> btn-google">
6+
<i class="fa fa-google-plus"></i>
7+
Connect with Google+
8+
</a>
9+
<% } if (filters.twitterAuth) { %><a ng-class="classes" ng-click="OauthButtons.loginOauth('twitter')" class="btn<% if (filters.bootstrap) { %> btn-social<% } %> btn-twitter">
10+
<i class="fa fa-twitter"></i>
11+
Connect with Twitter
12+
</a><% } %>

Diff for: app/templates/client/app/account(auth)/login/login(css).css renamed to app/templates/client/components/oauth-buttons(oauth)/oauth-buttons(css).css

+8-11
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
1-
<% if (filters.oauth) { %><% if (filters.facebookAuth) { %>.btn-facebook {
1+
<% if (!filters.bootstrap) { if (filters.facebookAuth) { %>.btn-facebook {
22
color: #fff;
33
background-color: #3B5998;
44
border-color: #133783;
55
}
6-
<% } if (filters.twitterAuth) { %>
7-
.btn-twitter {
8-
color: #fff;
9-
background-color: #2daddc;
10-
border-color: #0271bf;
11-
}
12-
<% } if (filters.googleAuth) { %>
13-
.btn-google-plus {
6+
<% } if (filters.googleAuth) { %>.btn-google {
147
color: #fff;
158
background-color: #dd4b39;
169
border-color: #c53727;
1710
}
18-
<% } %>
19-
.btn-github {
11+
<% } if (filters.twitterAuth) { %>.btn-twitter {
12+
color: #fff;
13+
background-color: #2daddc;
14+
border-color: #0271bf;
15+
}
16+
<% } %>.btn-github {
2017
color: #fff;
2118
background-color: #fafafa;
2219
border-color: #ccc;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<% if(filters.facebookAuth) { %>a.btn<% if (filters.bootstrap) { %>.btn-social<% } %>.btn-facebook(ng-class='classes'
2+
ng-click='OauthButtons.loginOauth("facebook")')
3+
i.fa.fa-facebook
4+
| Connect with Facebook
5+
6+
<% } if(filters.googleAuth) { %>a.btn<% if (filters.bootstrap) { %>.btn-social<% } %>.btn-google(ng-class='classes'
7+
ng-click='OauthButtons.loginOauth("google")')
8+
i.fa.fa-google-plus
9+
| Connect with Google+
10+
11+
<% } if(filters.twitterAuth) { %>a.btn<% if (filters.bootstrap) { %>.btn-social<% } %>.btn-twitter(ng-class='classes'
12+
ng-click='OauthButtons.loginOauth("twitter")')
13+
i.fa.fa-twitter
14+
| Connect with Twitter<% } %>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<% if (!filters.bootstrap) { if (filters.facebookAuth) { %>.btn-facebook {
2+
color: #fff;
3+
background-color: #3B5998;
4+
border-color: #133783;
5+
}
6+
<% } if (filters.googleAuth) { %>.btn-google {
7+
color: #fff;
8+
background-color: #dd4b39;
9+
border-color: #c53727;
10+
}
11+
<% } if (filters.twitterAuth) { %>.btn-twitter {
12+
color: #fff;
13+
background-color: #2daddc;
14+
border-color: #0271bf;
15+
}
16+
<% } %>.btn-github {
17+
color: #fff;
18+
background-color: #fafafa;
19+
border-color: #ccc;
20+
}<% } %>

0 commit comments

Comments
 (0)