mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-05-02 17:03:42 -04:00
Set up the multiplayer modal with a submit button for the ladder queue.
This commit is contained in:
parent
850942b895
commit
2e280fad6b
3 changed files with 14 additions and 1 deletions
app
templates/play/level/modal
views/play/level
|
@ -34,5 +34,8 @@
|
||||||
else
|
else
|
||||||
a(href=joinLink + "&skip_protect_api=true&team=" + team)= "Play as " + team
|
a(href=joinLink + "&skip_protect_api=true&team=" + team)= "Play as " + team
|
||||||
|
|
||||||
|
if ladderGame
|
||||||
|
#submit-session-button.btn.btn-primary Update Ladder Score
|
||||||
|
|
||||||
.modal-footer
|
.modal-footer
|
||||||
a(href='#', data-dismiss="modal", aria-hidden="true", data-i18n="modal.close").btn.btn-primary Close
|
a(href='#', data-dismiss="modal", aria-hidden="true", data-i18n="modal.close").btn.btn-primary Close
|
||||||
|
|
|
@ -57,7 +57,7 @@ module.exports = class ControlBarView extends View
|
||||||
@openModalView(new DocsModal(options))
|
@openModalView(new DocsModal(options))
|
||||||
|
|
||||||
showMultiplayerModal: ->
|
showMultiplayerModal: ->
|
||||||
@openModalView(new MultiplayerModal(session: @session, playableTeams: @playableTeams))
|
@openModalView(new MultiplayerModal(session: @session, playableTeams: @playableTeams, level: @level))
|
||||||
|
|
||||||
showRestartModal: ->
|
showRestartModal: ->
|
||||||
@openModalView(new ReloadModal())
|
@openModalView(new ReloadModal())
|
||||||
|
|
|
@ -9,10 +9,12 @@ module.exports = class MultiplayerModal extends View
|
||||||
events:
|
events:
|
||||||
'click textarea': 'onClickLink'
|
'click textarea': 'onClickLink'
|
||||||
'change #multiplayer': 'updateLinkSection'
|
'change #multiplayer': 'updateLinkSection'
|
||||||
|
'click #submit-session-button': 'submitSession'
|
||||||
|
|
||||||
constructor: (options) ->
|
constructor: (options) ->
|
||||||
super(options)
|
super(options)
|
||||||
@session = options.session
|
@session = options.session
|
||||||
|
@level = options.level
|
||||||
@session.on 'change:multiplayer', @updateLinkSection, @
|
@session.on 'change:multiplayer', @updateLinkSection, @
|
||||||
@playableTeams = options.playableTeams
|
@playableTeams = options.playableTeams
|
||||||
|
|
||||||
|
@ -23,6 +25,7 @@ module.exports = class MultiplayerModal extends View
|
||||||
@session.id)
|
@session.id)
|
||||||
c.multiplayer = @session.get('multiplayer')
|
c.multiplayer = @session.get('multiplayer')
|
||||||
c.playableTeams = @playableTeams
|
c.playableTeams = @playableTeams
|
||||||
|
c.ladderGame = @level?.get('name') is 'Project DotA'
|
||||||
c
|
c
|
||||||
|
|
||||||
afterRender: ->
|
afterRender: ->
|
||||||
|
@ -38,6 +41,13 @@ module.exports = class MultiplayerModal extends View
|
||||||
la.toggle Boolean(multiplayer)
|
la.toggle Boolean(multiplayer)
|
||||||
true
|
true
|
||||||
|
|
||||||
|
submitSession: ->
|
||||||
|
$.ajax('/queue/scoring', {
|
||||||
|
method: 'POST'
|
||||||
|
data:
|
||||||
|
session: @session.id
|
||||||
|
})
|
||||||
|
|
||||||
onHidden: ->
|
onHidden: ->
|
||||||
multiplayer = Boolean(@$el.find('#multiplayer').prop('checked'))
|
multiplayer = Boolean(@$el.find('#multiplayer').prop('checked'))
|
||||||
@session.set('multiplayer', multiplayer)
|
@session.set('multiplayer', multiplayer)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue