Skip to content

Commit

Permalink
Use font-awesome icons
Browse files Browse the repository at this point in the history
  • Loading branch information
Resseguie committed May 6, 2014
1 parent 759892a commit cc9d49b
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 10 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
Version numbers correspond to `bower.json` version

# 0.0.3

## Features
Switched to Font Awesome icons to support more providers with consistent look and feel

## Bug Fixes

## Breaking Changes

# 0.0.2

## Features
Support generic providers by returning just the endpoint

## Bug Fixes

## Breaking Changes
Format of returned oauthUser changed

# 0.0.1

## Features
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ If you use Twitter, Facebook, or GitHub, the API call to populate the user objec
3. include the module in angular (i.e. in `app.js`) - `resseguie.angular-oauthio-login`

## Dependencies
At a minimum, this module just depends on AngularJS, but the directive adds classes that support Bootstrap buttons.
At a minimum, this module just depends on AngularJS, but the directive adds classes that support Bootstrap buttons with Font Awesome icons for each OAuth provider. If the provider name (in lowercase) matches the Font Awesome class name, the icon is added automatically.

## Documentation

Expand Down
6 changes: 4 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-oauthio-login",
"version": "0.0.2",
"version": "0.0.3",
"authors": [
"David Resseguie <david@resseguie.com>"
],
Expand All @@ -20,7 +20,9 @@
],
"dependencies": {
"angular":"~1.2.11",
"oauth-js": "~0.1.7"
"oauth-js": "~0.1.7",
"bootstrap": "3.1.x",
"font-awesome": "latest"
},
"repository": {
"type": "git",
Expand Down
13 changes: 6 additions & 7 deletions oauthio-login.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ angular.module('resseguie.angular-oauthio-login', [])
OAuth.initialize(key);
},
login : function(provider){
provider = provider.toLowerCase();

var deferred = $q.defer();

OAuth.popup(provider, function(err, res){
Expand All @@ -47,7 +49,7 @@ angular.module('resseguie.angular-oauthio-login', [])
return deferred.promise;
},
knownProvider: function(provider){
var valid = providerAPI.hasOwnProperty(provider);
var valid = providerAPI.hasOwnProperty(provider.toLowerCase());
return valid;
}
};
Expand All @@ -63,17 +65,14 @@ angular.module('resseguie.angular-oauthio-login', [])
return {
restrict : "EA",
template : '<div class="oauthio-login">'+
'<button class="btn btn-xs" ng-click="login()">'+
'<div ng-show="oauthProvider==\'twitter\'"><img src="https://oauth.io/api/providers/twitter/logo" /> Connect with Twitter</div>'+
'<div ng-show="oauthProvider==\'facebook\'"><img src="https://oauth.io/api/providers/facebook/logo" /> Connect with Facebook</div>'+
'<div ng-show="oauthProvider==\'github\'"><img src="https://oauth.io/api/providers/github/logo" /> Connect with GitHub</div>'+
'<div ng-show="!knownProvider(oauthProvider)">Connect with {{oauthProvider}}</div>'+
'<button class="btn btn-s btn-primary" ng-click="login()">'+
'<i class="fa fa-{{oauthProvider | lowercase}}" style="margin-right: 5px;"></i> Connect with {{oauthProvider}}'+
'</button>'+
'</div>',
scope : {
oauthUser : "=", // model to store the results
oauthioKey : "@", // OAuthi.io public key
oauthProvider : "@" // currently only supports 'twitter'
oauthProvider : "@"
},
link: function(scope,element,attrs){
scope.knownProvider = function(provider){
Expand Down

0 comments on commit cc9d49b

Please sign in to comment.