Merge branch 'master' into production

This commit is contained in:
Nick Winter 2014-11-02 18:45:50 -08:00
commit 45ae15efad
8 changed files with 31 additions and 11 deletions

View file

@ -162,7 +162,7 @@ module.exports = class CocoRouter extends Backbone.Router
service = require service
service()
renderLoginButtons: ->
renderLoginButtons: =>
@initializeSocialMediaServices()
$('.share-buttons, .partner-badges').addClass('fade-in').delay(10000).removeClass('fade-in', 5000)
setTimeout(FB.XFBML.parse, 10) if FB?.XFBML?.parse # Handles FB login and Like

View file

@ -8,6 +8,8 @@ module.exports =
'auth:logging-in-with-facebook': c.object {}
'auth:logging-out': c.object {}
'auth:logged-in-with-facebook': c.object {title: 'Facebook logged in', description: 'Published when you successfully logged in with Facebook', required: ['response']},
response:
type: 'object'

View file

@ -169,5 +169,6 @@ $heroCanvasHeight: 265px
background-image: url(/images/common/code_languages/io_small.png)
body.ipad #choose-hero-view
// iPad is Python-only for now, and has its own reset button.
.form
display: none

View file

@ -245,7 +245,7 @@ $gameControlMargin: 30px
.old-levels
position: absolute
bottom: 1%
bottom: 5%
left: 1%
z-index: 3
@ -261,9 +261,7 @@ $gameControlMargin: 30px
.user-status
position: absolute
bottom: 1%
left: 50%
width: 400px
margin-left: -200px
left: 1%
text-align: center
font-size: 24px
color: white
@ -302,10 +300,10 @@ body:not(.ipad) #world-map-view
.level-info-container
pointer-events: none
.old-levels
display: none
body.ipad #world-map-view
// iPad only supports up to Kithgard Gates for now.
.campaign-switch
display: none
.old-levels
display: none

View file

@ -56,8 +56,9 @@ block modal-body-content
else
input.btn.btn-info.btn-large#login-button(value=translate("login.log_in"), type="submit")
.btn.btn-default.btn-large#switch-to-signup-button(data-i18n="login.sign_up") Create Account
if mode === 'signup'
else if mode === 'signup'
input.btn.btn-info.btn-large#signup-button(value=translate("signup.sign_up"), type="submit")
.btn.btn-default.btn-large#switch-to-login-button(data-i18n="login.log_in")
block modal-body-wait-content

View file

@ -43,6 +43,7 @@ module.exports = class RootView extends CocoView
success: (achievement) => @showNewAchievement(achievement, earnedAchievement)
logoutAccount: ->
Backbone.Mediator.publish("auth:logging-out")
window.tracker?.trackEvent 'Homepage', Action: 'Log Out' if @id is 'home-view'
logoutUser($('#login-email').val())

View file

@ -8,11 +8,12 @@ application = require 'application'
module.exports = class AuthModal extends ModalView
id: 'auth-modal'
template: template
mode: 'login' # or 'signup'
mode: 'signup' # or 'login'
events:
# login buttons
'click #switch-to-signup-button': 'onSignupInstead'
'click #switch-to-login-button': 'onLoginInstead'
'click #confirm-age': 'checkAge'
'click #github-login-button': 'onGitHubLoginClicked'
'submit': 'onSubmitForm' # handles both submit buttons
@ -51,6 +52,12 @@ module.exports = class AuthModal extends ModalView
@render()
_.delay application.router.renderLoginButtons, 500
onLoginInstead: (e) ->
@mode = 'login'
@previousFormInputs = forms.formToObject @$el
@render()
_.delay application.router.renderLoginButtons, 500
onSubmitForm: (e) ->
e.preventDefault()
if @mode is 'login' then @loginAccount() else @createAccount()

View file

@ -7,6 +7,7 @@ PlayLevelModal = require 'views/play/modal/PlayLevelModal'
ThangType = require 'models/ThangType'
MusicPlayer = require 'lib/surface/MusicPlayer'
storage = require 'lib/storage'
AuthModal = require 'views/modal/AuthModal'
class LevelSessionsCollection extends CocoCollection
url: ''
@ -106,6 +107,15 @@ module.exports = class WorldMapView extends RootView
@updateVolume()
@highlightElement '.level.next', delay: 500, duration: 60000, rotation: 0, sides: ['top'] unless window.currentModal
afterInsert: ->
super()
return unless @getQueryVariable 'signup'
return if me.get('email')
@endHighlight()
authModal = new AuthModal supermodel: @supermodel
authModal.mode = 'signup'
@openModalView authModal
onSessionsLoaded: (e) ->
for session in @sessions.models
@levelStatusMap[session.get('levelID')] = if session.get('state')?.complete then 'complete' else 'started'