mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-26 05:53:39 -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
|
||||
|
||||
.connect-buttons
|
||||
margin-bottom: 10px
|
||||
margin-bottom: 15px
|
||||
.btn
|
||||
margin-left: 5px
|
||||
margin-right: 5px
|
||||
|
||||
.friend-entry img
|
||||
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!
|
||||
|
||||
else
|
||||
if !onFacebook
|
||||
if !onFacebook || !onGPlus
|
||||
div.connect-buttons
|
||||
| Connect:
|
||||
| Connect and play against your friends!
|
||||
br
|
||||
if !onFacebook
|
||||
button.btn.btn-sm.connect-facebook Facebook
|
||||
//button.btn.btn-sm.connect-google-plus Google+
|
||||
|
||||
if !!friends
|
||||
|
||||
if friends.length
|
||||
for friend in friends
|
||||
p.friend-entry
|
||||
img(src=friend.imageSource).img-thumbnail
|
||||
span= friend.creatorName + ' (' + friend.name + ')'
|
||||
br
|
||||
span= Math.round(friend.totalScore * 100)
|
||||
span :
|
||||
span= friend.team
|
||||
br
|
||||
a(href="/play/level/#{level.get('slug') || level.id}/?team=#{friend.otherTeam}&opponent=#{friend._id}")
|
||||
span(data-i18n="ladder.fight") Fight!
|
||||
|
||||
|
||||
else
|
||||
p Invite your friends to join you in battle!
|
||||
|
||||
if !onGPlus
|
||||
button.btn.btn-sm.connect-google-plus Google+
|
||||
|
||||
if friends.length
|
||||
for friend in friends
|
||||
p.friend-entry
|
||||
img(src=friend.imageSource).img-thumbnail
|
||||
span= friend.creatorName + ' (' + friend.name + ')'
|
||||
br
|
||||
span= Math.round(friend.totalScore * 100)
|
||||
span :
|
||||
span= friend.team
|
||||
br
|
||||
a(href="/play/level/#{level.get('slug') || level.id}/?team=#{friend.otherTeam}&opponent=#{friend._id}")
|
||||
span(data-i18n="ladder.fight") Fight!
|
||||
|
||||
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:
|
||||
'click .connect-facebook': 'onConnectFacebook'
|
||||
'click .connect-google-plus': 'onConnectGPlus'
|
||||
|
||||
subscriptions:
|
||||
'fbapi-loaded': 'checkFriends'
|
||||
'gapi-loaded': 'checkFriends'
|
||||
'facebook-logged-in': 'onConnectedWithFacebook'
|
||||
'gplus-logged-in': 'onConnectedWithGPlus'
|
||||
|
||||
constructor: (options, @level, @sessions) ->
|
||||
super(options)
|
||||
|
@ -58,8 +60,6 @@ module.exports = class LadderTabView extends CocoView
|
|||
|
||||
onConnectedWithFacebook: -> location.reload() if @connecting
|
||||
|
||||
# Load friends
|
||||
|
||||
loadFacebookFriendSessions: ->
|
||||
FB.api '/me/friends', (response) =>
|
||||
@facebookData = response.data
|
||||
|
@ -84,6 +84,13 @@ module.exports = class LadderTabView extends CocoView
|
|||
|
||||
# GOOGLE PLUS
|
||||
|
||||
onConnectGPlus: ->
|
||||
@connecting = true
|
||||
@listenToOnce application.gplusHandler, 'logged-in', @onConnectedWithGPlus
|
||||
application.gplusHandler.reauthorize()
|
||||
|
||||
onConnectedWithGPlus: -> location.reload() if @connecting
|
||||
|
||||
gplusSessionStateLoaded: ->
|
||||
if application.gplusHandler.loggedIn
|
||||
@loadingGPlusFriends = true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue