mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-05-03 09:23:41 -04:00
Added a google plus connect button.
This commit is contained in:
parent
132b22f14a
commit
781b33092c
3 changed files with 31 additions and 28 deletions
app
|
@ -36,9 +36,9 @@
|
||||||
margin-bottom: 5px
|
margin-bottom: 5px
|
||||||
|
|
||||||
.connect-buttons
|
.connect-buttons
|
||||||
margin-bottom: 10px
|
margin-bottom: 15px
|
||||||
.btn
|
.btn
|
||||||
margin-left: 5px
|
margin-right: 5px
|
||||||
|
|
||||||
.friend-entry img
|
.friend-entry img
|
||||||
float: left
|
float: left
|
||||||
|
|
|
@ -47,31 +47,27 @@ div#columns.row
|
||||||
a(data-toggle="coco-modal", data-target="modal/signup") Sign up to play with your friends!
|
a(data-toggle="coco-modal", data-target="modal/signup") Sign up to play with your friends!
|
||||||
|
|
||||||
else
|
else
|
||||||
if !onFacebook
|
if !onFacebook || !onGPlus
|
||||||
div.connect-buttons
|
div.connect-buttons
|
||||||
| Connect:
|
| Connect and play against your friends!
|
||||||
|
br
|
||||||
if !onFacebook
|
if !onFacebook
|
||||||
button.btn.btn-sm.connect-facebook Facebook
|
button.btn.btn-sm.connect-facebook Facebook
|
||||||
//button.btn.btn-sm.connect-google-plus Google+
|
if !onGPlus
|
||||||
|
button.btn.btn-sm.connect-google-plus Google+
|
||||||
if !!friends
|
|
||||||
|
if friends.length
|
||||||
if friends.length
|
for friend in friends
|
||||||
for friend in friends
|
p.friend-entry
|
||||||
p.friend-entry
|
img(src=friend.imageSource).img-thumbnail
|
||||||
img(src=friend.imageSource).img-thumbnail
|
span= friend.creatorName + ' (' + friend.name + ')'
|
||||||
span= friend.creatorName + ' (' + friend.name + ')'
|
br
|
||||||
br
|
span= Math.round(friend.totalScore * 100)
|
||||||
span= Math.round(friend.totalScore * 100)
|
span :
|
||||||
span :
|
span= friend.team
|
||||||
span= friend.team
|
br
|
||||||
br
|
a(href="/play/level/#{level.get('slug') || level.id}/?team=#{friend.otherTeam}&opponent=#{friend._id}")
|
||||||
a(href="/play/level/#{level.get('slug') || level.id}/?team=#{friend.otherTeam}&opponent=#{friend._id}")
|
span(data-i18n="ladder.fight") Fight!
|
||||||
span(data-i18n="ladder.fight") Fight!
|
|
||||||
|
|
||||||
|
|
||||||
else
|
|
||||||
p Invite your friends to join you in battle!
|
|
||||||
|
|
||||||
else
|
else
|
||||||
p Connect to social networks to play with your friends!
|
p Invite your friends to join you in battle!
|
||||||
|
|
|
@ -22,11 +22,13 @@ module.exports = class LadderTabView extends CocoView
|
||||||
|
|
||||||
events:
|
events:
|
||||||
'click .connect-facebook': 'onConnectFacebook'
|
'click .connect-facebook': 'onConnectFacebook'
|
||||||
|
'click .connect-google-plus': 'onConnectGPlus'
|
||||||
|
|
||||||
subscriptions:
|
subscriptions:
|
||||||
'fbapi-loaded': 'checkFriends'
|
'fbapi-loaded': 'checkFriends'
|
||||||
'gapi-loaded': 'checkFriends'
|
'gapi-loaded': 'checkFriends'
|
||||||
'facebook-logged-in': 'onConnectedWithFacebook'
|
'facebook-logged-in': 'onConnectedWithFacebook'
|
||||||
|
'gplus-logged-in': 'onConnectedWithGPlus'
|
||||||
|
|
||||||
constructor: (options, @level, @sessions) ->
|
constructor: (options, @level, @sessions) ->
|
||||||
super(options)
|
super(options)
|
||||||
|
@ -58,8 +60,6 @@ module.exports = class LadderTabView extends CocoView
|
||||||
|
|
||||||
onConnectedWithFacebook: -> location.reload() if @connecting
|
onConnectedWithFacebook: -> location.reload() if @connecting
|
||||||
|
|
||||||
# Load friends
|
|
||||||
|
|
||||||
loadFacebookFriendSessions: ->
|
loadFacebookFriendSessions: ->
|
||||||
FB.api '/me/friends', (response) =>
|
FB.api '/me/friends', (response) =>
|
||||||
@facebookData = response.data
|
@facebookData = response.data
|
||||||
|
@ -84,6 +84,13 @@ module.exports = class LadderTabView extends CocoView
|
||||||
|
|
||||||
# GOOGLE PLUS
|
# GOOGLE PLUS
|
||||||
|
|
||||||
|
onConnectGPlus: ->
|
||||||
|
@connecting = true
|
||||||
|
@listenToOnce application.gplusHandler, 'logged-in', @onConnectedWithGPlus
|
||||||
|
application.gplusHandler.reauthorize()
|
||||||
|
|
||||||
|
onConnectedWithGPlus: -> location.reload() if @connecting
|
||||||
|
|
||||||
gplusSessionStateLoaded: ->
|
gplusSessionStateLoaded: ->
|
||||||
if application.gplusHandler.loggedIn
|
if application.gplusHandler.loggedIn
|
||||||
@loadingGPlusFriends = true
|
@loadingGPlusFriends = true
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue