mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-29 07:24:08 -04:00
Ladder page now shows the ladder for anonymous users, and prods them to sign up if they click a link or button that would have them play.
This commit is contained in:
parent
a3df986567
commit
296a7584a6
4 changed files with 53 additions and 38 deletions
app
|
@ -6,7 +6,11 @@ block modal-header-content
|
||||||
block modal-body-content
|
block modal-body-content
|
||||||
.modal-content
|
.modal-content
|
||||||
.modal-body
|
.modal-body
|
||||||
p(data-i18n="signup.description") It's free. Just need a couple things and you'll be good to go:
|
if showRequiredError
|
||||||
|
.alert.alert-success
|
||||||
|
span(data-i18n="signup.required") You need to sign up first before you can go over there. Luckily, it's really easy.
|
||||||
|
else
|
||||||
|
p(data-i18n="signup.description") It's free. Just need a couple things and you'll be good to go:
|
||||||
.form
|
.form
|
||||||
.form-group
|
.form-group
|
||||||
label.control-label(for="signup-email", data-i18n="general.email") Email
|
label.control-label(for="signup-email", data-i18n="general.email") Email
|
||||||
|
|
|
@ -7,47 +7,39 @@ block content
|
||||||
else
|
else
|
||||||
h1= level.get('name')
|
h1= level.get('name')
|
||||||
|
|
||||||
if me.get('anonymous')
|
div#columns.row
|
||||||
div#must-log-in
|
div.column.col-md-2
|
||||||
p
|
for team in teams
|
||||||
strong(data-i18n="ladder.please_login") Please log in first before playing a ladder game.
|
div.column.col-md-4
|
||||||
button.btn.btn-primary(data-toggle="coco-modal", data-target="modal/login", data-i18n="login.log_in") Log In
|
a(style="background-color: #{team.primaryColor}", data-team=team.id).play-button.btn.btn-danger.btn-block.btn-lg
|
||||||
button.btn.btn-primary(data-toggle="coco-modal", data-target="modal/signup", data-i18n="login.sign_up") Create Account
|
span(data-i18n="play.play_as") Play As
|
||||||
|
span= team.name
|
||||||
|
div.column.col-md-2
|
||||||
else
|
|
||||||
div#columns.row
|
hr
|
||||||
div.column.col-md-2
|
|
||||||
for team in teams
|
|
||||||
div.column.col-md-4
|
|
||||||
a(style="background-color: #{team.primaryColor}", data-team=team.id).play-button.btn.btn-danger.btn-block.btn-lg
|
|
||||||
span(data-i18n="play.play_as") Play As
|
|
||||||
span= team.name
|
|
||||||
div.column.col-md-2
|
|
||||||
|
|
||||||
hr
|
ul.nav.nav-pills
|
||||||
|
li.active
|
||||||
ul.nav.nav-pills
|
a(href="#ladder", data-toggle="tab", data-i18n="general.ladder") Ladder
|
||||||
li.active
|
if !me.get('anonymous')
|
||||||
a(href="#ladder", data-toggle="tab", data-i18n="general.ladder") Ladder
|
|
||||||
li
|
li
|
||||||
a(href="#my-matches", data-toggle="tab", data-i18n="ladder.my_matches") My Matches
|
a(href="#my-matches", data-toggle="tab", data-i18n="ladder.my_matches") My Matches
|
||||||
li
|
li
|
||||||
a(href="#simulate", data-toggle="tab", data-i18n="ladder.simulate") Simulate
|
a(href="#simulate", data-toggle="tab", data-i18n="ladder.simulate") Simulate
|
||||||
|
|
||||||
div.tab-content
|
div.tab-content
|
||||||
.tab-pane.active.well#ladder
|
.tab-pane.active.well#ladder
|
||||||
#ladder-tab-view
|
#ladder-tab-view
|
||||||
.tab-pane.well#my-matches
|
.tab-pane.well#my-matches
|
||||||
#my-matches-tab-view
|
#my-matches-tab-view
|
||||||
.tab-pane.well#simulate
|
.tab-pane.well#simulate
|
||||||
p(id="simulation-status-text")
|
p(id="simulation-status-text")
|
||||||
if simulationStatus
|
if simulationStatus
|
||||||
| #{simulationStatus}
|
| #{simulationStatus}
|
||||||
else
|
else
|
||||||
span(data-i18n="ladder.simulation_explanation") By simulating games you can get your game ranked faster!
|
span(data-i18n="ladder.simulation_explanation") By simulating games you can get your game ranked faster!
|
||||||
|
p
|
||||||
|
button(data-i18n="ladder.simulate_games").btn.btn-warning.btn-lg.highlight#simulate-button Simulate Games!
|
||||||
|
if me.isAdmin()
|
||||||
p
|
p
|
||||||
button(data-i18n="ladder.simulate_games").btn.btn-warning.btn-lg.highlight#simulate-button Simulate Games!
|
button(data-i18n="ladder.simulate_all").btn.btn-danger.btn-lg.highlight#simulate-all-button RESET AND SIMULATE GAMES
|
||||||
if me.isAdmin()
|
|
||||||
p
|
|
||||||
button(data-i18n="ladder.simulate_all").btn.btn-danger.btn-lg.highlight#simulate-all-button RESET AND SIMULATE GAMES
|
|
|
@ -37,6 +37,11 @@ module.exports = class SignupModalView extends View
|
||||||
|
|
||||||
checkAge: (e) ->
|
checkAge: (e) ->
|
||||||
$("#signup-button", @$el).prop 'disabled', not $(e.target).prop('checked')
|
$("#signup-button", @$el).prop 'disabled', not $(e.target).prop('checked')
|
||||||
|
|
||||||
|
getRenderData: ->
|
||||||
|
c = super()
|
||||||
|
c.showRequiredError = @options.showRequiredError
|
||||||
|
c
|
||||||
|
|
||||||
createAccount: (e) =>
|
createAccount: (e) =>
|
||||||
forms.clearFormAlerts(@$el)
|
forms.clearFormAlerts(@$el)
|
||||||
|
|
|
@ -4,6 +4,7 @@ Simulator = require 'lib/simulator/Simulator'
|
||||||
LevelSession = require 'models/LevelSession'
|
LevelSession = require 'models/LevelSession'
|
||||||
CocoCollection = require 'models/CocoCollection'
|
CocoCollection = require 'models/CocoCollection'
|
||||||
{teamDataFromLevel} = require './ladder/utils'
|
{teamDataFromLevel} = require './ladder/utils'
|
||||||
|
{me} = require 'lib/auth'
|
||||||
application = require 'application'
|
application = require 'application'
|
||||||
|
|
||||||
LadderTabView = require './ladder/ladder_tab'
|
LadderTabView = require './ladder/ladder_tab'
|
||||||
|
@ -32,6 +33,7 @@ module.exports = class LadderView extends RootView
|
||||||
'click #simulate-button': 'onSimulateButtonClick'
|
'click #simulate-button': 'onSimulateButtonClick'
|
||||||
'click #simulate-all-button': 'onSimulateAllButtonClick'
|
'click #simulate-all-button': 'onSimulateAllButtonClick'
|
||||||
'click .play-button': 'onClickPlayButton'
|
'click .play-button': 'onClickPlayButton'
|
||||||
|
'click a': 'onClickedLink'
|
||||||
|
|
||||||
constructor: (options, @levelID) ->
|
constructor: (options, @levelID) ->
|
||||||
super(options)
|
super(options)
|
||||||
|
@ -121,10 +123,22 @@ module.exports = class LadderView extends RootView
|
||||||
@showPlayModal($(e.target).closest('.play-button').data('team'))
|
@showPlayModal($(e.target).closest('.play-button').data('team'))
|
||||||
|
|
||||||
showPlayModal: (teamID) ->
|
showPlayModal: (teamID) ->
|
||||||
|
return @showApologeticSignupModal() if me.get('anonymous')
|
||||||
session = (s for s in @sessions.models when s.get('team') is teamID)[0]
|
session = (s for s in @sessions.models when s.get('team') is teamID)[0]
|
||||||
modal = new LadderPlayModal({}, @level, session, teamID)
|
modal = new LadderPlayModal({}, @level, session, teamID)
|
||||||
@openModalView modal
|
@openModalView modal
|
||||||
|
|
||||||
|
showApologeticSignupModal: ->
|
||||||
|
SignupModal = require 'views/modal/signup_modal'
|
||||||
|
@openModalView(new SignupModal({showRequiredError:true}))
|
||||||
|
|
||||||
|
onClickedLink: (e) ->
|
||||||
|
link = $(e.target).closest('a').attr('href')
|
||||||
|
if link?.startsWith '/play/level'
|
||||||
|
e.stopPropagation()
|
||||||
|
e.preventDefault()
|
||||||
|
@showApologeticSignupModal()
|
||||||
|
|
||||||
destroy: ->
|
destroy: ->
|
||||||
clearInterval @refreshInterval
|
clearInterval @refreshInterval
|
||||||
@simulator.destroy()
|
@simulator.destroy()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue