mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-05-02 17:03:42 -04:00
Improved next game routing and speed. Hid that catastrophically dangerous reset all games button.
This commit is contained in:
parent
e88c79681d
commit
f02f4e77d0
3 changed files with 13 additions and 7 deletions
app
|
@ -17,7 +17,7 @@ module.exports = class CocoRouter extends Backbone.Router
|
||||||
|
|
||||||
# editor views tend to have the same general structure
|
# editor views tend to have the same general structure
|
||||||
'editor/:model(/:slug_or_id)(/:subview)': 'editorModelView'
|
'editor/:model(/:slug_or_id)(/:subview)': 'editorModelView'
|
||||||
|
|
||||||
# Experimenting with direct links
|
# Experimenting with direct links
|
||||||
# 'play/ladder/:levelID/team/:team': go('play/ladder/team_view')
|
# 'play/ladder/:levelID/team/:team': go('play/ladder/team_view')
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ module.exports = class CocoRouter extends Backbone.Router
|
||||||
home: -> @openRoute('home')
|
home: -> @openRoute('home')
|
||||||
general: (name) ->
|
general: (name) ->
|
||||||
@openRoute(name)
|
@openRoute(name)
|
||||||
|
|
||||||
editorModelView: (modelName, slugOrId, subview) ->
|
editorModelView: (modelName, slugOrId, subview) ->
|
||||||
modulePrefix = "views/editor/#{modelName}/"
|
modulePrefix = "views/editor/#{modelName}/"
|
||||||
suffix = subview or (if slugOrId then 'edit' else 'home')
|
suffix = subview or (if slugOrId then 'edit' else 'home')
|
||||||
|
@ -92,7 +92,7 @@ module.exports = class CocoRouter extends Backbone.Router
|
||||||
view = @getView(route)
|
view = @getView(route)
|
||||||
@cache[route] = view if view?.cache
|
@cache[route] = view if view?.cache
|
||||||
return view
|
return view
|
||||||
|
|
||||||
routeDirectly: (path, args) ->
|
routeDirectly: (path, args) ->
|
||||||
path = "views/#{path}"
|
path = "views/#{path}"
|
||||||
ViewClass = @tryToLoadModule path
|
ViewClass = @tryToLoadModule path
|
||||||
|
@ -154,7 +154,7 @@ module.exports = class CocoRouter extends Backbone.Router
|
||||||
|
|
||||||
onNavigate: (e) ->
|
onNavigate: (e) ->
|
||||||
manualView = e.view or e.viewClass
|
manualView = e.view or e.viewClass
|
||||||
@navigate e.route, {trigger:not manualView}
|
@navigate e.route, {trigger: not manualView}
|
||||||
return unless manualView
|
return unless manualView
|
||||||
if e.viewClass
|
if e.viewClass
|
||||||
args = e.viewArgs or []
|
args = e.viewArgs or []
|
||||||
|
|
|
@ -44,6 +44,6 @@ block content
|
||||||
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
|
p
|
||||||
button(data-i18n="ladder.simulate_games").btn.btn-warning.btn-lg.highlight#simulate-button Simulate Games!
|
button(data-i18n="ladder.simulate_games").btn.btn-warning.btn-lg.highlight#simulate-button Simulate Games!
|
||||||
if me.isAdmin()
|
if false && me.isAdmin()
|
||||||
p
|
p
|
||||||
button(data-i18n="ladder.simulate_all").btn.btn-danger.btn-lg.highlight#simulate-all-button RESET AND SIMULATE GAMES
|
button(data-i18n="ladder.simulate_all").btn.btn-danger.btn-lg.highlight#simulate-all-button RESET AND SIMULATE GAMES
|
||||||
|
|
|
@ -66,7 +66,6 @@ module.exports = class SpectateLevelView extends View
|
||||||
'ctrl+s': 'onCtrlS'
|
'ctrl+s': 'onCtrlS'
|
||||||
|
|
||||||
constructor: (options, @levelID) ->
|
constructor: (options, @levelID) ->
|
||||||
@originalOptions = _.cloneDeep(options)
|
|
||||||
console.profile?() if PROFILE_ME
|
console.profile?() if PROFILE_ME
|
||||||
super options
|
super options
|
||||||
$(window).on('resize', @onWindowResize)
|
$(window).on('resize', @onWindowResize)
|
||||||
|
@ -446,7 +445,14 @@ module.exports = class SpectateLevelView extends View
|
||||||
Backbone.Mediator.publish 'router:navigate', {
|
Backbone.Mediator.publish 'router:navigate', {
|
||||||
route: url,
|
route: url,
|
||||||
viewClass: SpectateLevelView,
|
viewClass: SpectateLevelView,
|
||||||
viewArgs: [{spectateSessions:{sessionOne: @sessionOne, sessionTwo: @sessionTwo}}, @levelID ]}
|
viewArgs: [
|
||||||
|
{
|
||||||
|
spectateSessions: {sessionOne: @sessionOne, sessionTwo: @sessionTwo}
|
||||||
|
supermodel: @supermodel
|
||||||
|
}
|
||||||
|
@levelID ]
|
||||||
|
}
|
||||||
|
history?.pushState? {}, "", url # Backbone won't update the URL if just query parameters change
|
||||||
|
|
||||||
fetchRandomSessionPair: (cb) ->
|
fetchRandomSessionPair: (cb) ->
|
||||||
console.log "Fetching random session pair!"
|
console.log "Fetching random session pair!"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue