mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-26 05:53:39 -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
|
||||
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
|
||||
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))
|
||||
|
||||
showMultiplayerModal: ->
|
||||
@openModalView(new MultiplayerModal(session: @session, playableTeams: @playableTeams))
|
||||
@openModalView(new MultiplayerModal(session: @session, playableTeams: @playableTeams, level: @level))
|
||||
|
||||
showRestartModal: ->
|
||||
@openModalView(new ReloadModal())
|
||||
|
|
|
@ -9,10 +9,12 @@ module.exports = class MultiplayerModal extends View
|
|||
events:
|
||||
'click textarea': 'onClickLink'
|
||||
'change #multiplayer': 'updateLinkSection'
|
||||
'click #submit-session-button': 'submitSession'
|
||||
|
||||
constructor: (options) ->
|
||||
super(options)
|
||||
@session = options.session
|
||||
@level = options.level
|
||||
@session.on 'change:multiplayer', @updateLinkSection, @
|
||||
@playableTeams = options.playableTeams
|
||||
|
||||
|
@ -23,6 +25,7 @@ module.exports = class MultiplayerModal extends View
|
|||
@session.id)
|
||||
c.multiplayer = @session.get('multiplayer')
|
||||
c.playableTeams = @playableTeams
|
||||
c.ladderGame = @level?.get('name') is 'Project DotA'
|
||||
c
|
||||
|
||||
afterRender: ->
|
||||
|
@ -38,6 +41,13 @@ module.exports = class MultiplayerModal extends View
|
|||
la.toggle Boolean(multiplayer)
|
||||
true
|
||||
|
||||
submitSession: ->
|
||||
$.ajax('/queue/scoring', {
|
||||
method: 'POST'
|
||||
data:
|
||||
session: @session.id
|
||||
})
|
||||
|
||||
onHidden: ->
|
||||
multiplayer = Boolean(@$el.find('#multiplayer').prop('checked'))
|
||||
@session.set('multiplayer', multiplayer)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue