Ladder view can now be linked to to play against a specific team.
This commit is contained in:
parent
12f1042530
commit
d14f862359
1 changed files with 4 additions and 2 deletions
|
@ -66,6 +66,7 @@ module.exports = class LadderView extends RootView
|
||||||
@insertSubView(@ladderTab = new LadderTabView({}, @level, @sessions))
|
@insertSubView(@ladderTab = new LadderTabView({}, @level, @sessions))
|
||||||
@insertSubView(@myMatchesTab = new MyMatchesTabView({}, @level, @sessions))
|
@insertSubView(@myMatchesTab = new MyMatchesTabView({}, @level, @sessions))
|
||||||
setInterval(@fetchSessionsAndRefreshViews.bind(@), 10000)
|
setInterval(@fetchSessionsAndRefreshViews.bind(@), 10000)
|
||||||
|
@showPlayModal(document.location.hash[1..]) if document.location.hash and @sessions.loaded
|
||||||
|
|
||||||
fetchSessionsAndRefreshViews: ->
|
fetchSessionsAndRefreshViews: ->
|
||||||
@sessions.fetch({"success": @refreshViews})
|
@sessions.fetch({"success": @refreshViews})
|
||||||
|
@ -112,8 +113,9 @@ module.exports = class LadderView extends RootView
|
||||||
$("#simulation-status-text").text @simulationStatus
|
$("#simulation-status-text").text @simulationStatus
|
||||||
|
|
||||||
onClickPlayButton: (e) ->
|
onClickPlayButton: (e) ->
|
||||||
button = $(e.target).closest('.play-button')
|
@showPlayModal($(e.target).closest('.play-button').data('team'))
|
||||||
teamID = button.data('team')
|
|
||||||
|
showPlayModal: (teamID) ->
|
||||||
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
|
||||||
|
|
Reference in a new issue