Merge branch 'master' into production

This commit is contained in:
Nick Winter 2014-09-18 08:13:15 -07:00
commit d26548cf20
6 changed files with 19 additions and 5 deletions

View file

@ -137,6 +137,10 @@
color: #172 color: #172
.loss .loss
color: #712 color: #712
.code-language-cell
padding: 0 10px
background: transparent url(/images/common/code_languages/javascript_icon.png) no-repeat center center
height: 16px
@media only screen and (max-width: 800px) @media only screen and (max-width: 800px)
#ladder-view #ladder-view

View file

@ -48,7 +48,7 @@ block content
if level.get('name') == 'Criss-Cross' if level.get('name') == 'Criss-Cross'
.tournament-blurb .tournament-blurb
h2 h2
span(data-i18n="ladder.tournament_ends") Tournament ends span(data-i18n="ladder.tournament_ended") Tournament ended
| #{tournamentTimeLeft} | #{tournamentTimeLeft}
p p
span(data-i18n="ladder.tournament_blurb_criss_cross") Win bids, construct paths, outwit opponents, grab gems, and upgrade your career in our Criss-Cross tournament! Check out the details span(data-i18n="ladder.tournament_blurb_criss_cross") Win bids, construct paths, outwit opponents, grab gems, and upgrade your career in our Criss-Cross tournament! Check out the details
@ -745,11 +745,15 @@ block content
thead thead
tr tr
th(data-i18n="ladder_prizes.rank") Rank th(data-i18n="ladder_prizes.rank") Rank
if level.get('name') == 'Criss-Cross'
th
th Human th Human
if level.get('name') == 'Greed' if level.get('name') == 'Greed'
th Human wins/losses/ties th Human wins/losses/ties
else else
th Human score th Human score
if level.get('name') == 'Criss-Cross'
th
th Ogre th Ogre
if level.get('name') == 'Greed' if level.get('name') == 'Greed'
th Ogre wins/losses/ties th Ogre wins/losses/ties
@ -761,6 +765,8 @@ block content
- var ogre = winners.ogres[index] - var ogre = winners.ogres[index]
tr tr
td= human.rank td= human.rank
if level.get('name') == 'Criss-Cross'
td.code-language-cell(style="background-image: url(/images/common/code_languages/" + human.codeLanguage + "_icon.png)" title=_.string.capitalize(human.codeLanguage))
td= human.name td= human.name
if level.get('name') == 'Greed' if level.get('name') == 'Greed'
td td
@ -773,6 +779,8 @@ block content
td td
span= Math.round(100 * human.score) span= Math.round(100 * human.score)
if ogre if ogre
if level.get('name') == 'Criss-Cross'
td.code-language-cell(style="background-image: url(/images/common/code_languages/" + ogre.codeLanguage + "_icon.png)" title=_.string.capitalize(ogre.codeLanguage))
td= ogre.name td= ogre.name
if level.get('name') == 'Greed' if level.get('name') == 'Greed'
td td

View file

@ -183,7 +183,7 @@ module.exports = class SpectateLevelView extends RootView
ctx.fillText("Loaded #{@modelsLoaded} thingies",50,50) ctx.fillText("Loaded #{@modelsLoaded} thingies",50,50)
insertSubviews: -> insertSubviews: ->
@insertSubView @tome = new TomeView levelID: @levelID, session: @session, thangs: @world.thangs, supermodel: @supermodel, spectateView: true @insertSubView @tome = new TomeView levelID: @levelID, session: @session, thangs: @world.thangs, supermodel: @supermodel, spectateView: true, spectateOpponentCodeLanguage: @otherSession?.get('submittedCodeLanguage')
@insertSubView new PlaybackView {} @insertSubView new PlaybackView {}
@insertSubView new GoldView {} @insertSubView new GoldView {}

View file

@ -65,7 +65,7 @@ module.exports = class LadderView extends RootView
@insertSubView(@simulateTab = new SimulateTabView()) @insertSubView(@simulateTab = new SimulateTabView())
@refreshInterval = setInterval(@fetchSessionsAndRefreshViews.bind(@), 20 * 1000) @refreshInterval = setInterval(@fetchSessionsAndRefreshViews.bind(@), 20 * 1000)
hash = document.location.hash[1..] if document.location.hash hash = document.location.hash[1..] if document.location.hash
if hash and not (hash in ['my-matches', 'simulate', 'ladder', 'prizes', 'rules']) if hash and not (hash in ['my-matches', 'simulate', 'ladder', 'prizes', 'rules', 'winners'])
@showPlayModal(hash) if @sessions.loaded @showPlayModal(hash) if @sessions.loaded
fetchSessionsAndRefreshViews: -> fetchSessionsAndRefreshViews: ->

View file

@ -14,6 +14,7 @@ module.exports = class Spell
@session = options.session @session = options.session
@otherSession = options.otherSession @otherSession = options.otherSession
@spectateView = options.spectateView @spectateView = options.spectateView
@spectateOpponentCodeLanguage = options.spectateOpponentCodeLanguage
@supermodel = options.supermodel @supermodel = options.supermodel
@skipProtectAPI = options.skipProtectAPI @skipProtectAPI = options.skipProtectAPI
@worker = options.worker @worker = options.worker
@ -27,7 +28,7 @@ module.exports = class Spell
if @canWrite() if @canWrite()
@setLanguage options.language @setLanguage options.language
else if @isEnemySpell() else if @isEnemySpell()
@setLanguage options.otherSession.get 'submittedCodeLanguage' @setLanguage @otherSession?.get('submittedCodeLanguage') ? @spectateOpponentCodeLanguage
else else
@setLanguage 'javascript' @setLanguage 'javascript'
@useTranspiledCode = @shouldUseTranspiledCode() @useTranspiledCode = @shouldUseTranspiledCode()
@ -150,7 +151,7 @@ module.exports = class Spell
isEnemySpell: -> isEnemySpell: ->
return false unless @permissions.readwrite.length return false unless @permissions.readwrite.length
return false unless @otherSession return false unless @otherSession or @spectateView
teamSpells = @session.get('teamSpells') teamSpells = @session.get('teamSpells')
team = @session.get('team') ? 'humans' team = @session.get('team') ? 'humans'
teamSpells and not _.contains(teamSpells[team], @spellKey) teamSpells and not _.contains(teamSpells[team], @spellKey)

View file

@ -133,6 +133,7 @@ module.exports = class TomeView extends CocoView
worker: @worker worker: @worker
language: language language: language
spectateView: @options.spectateView spectateView: @options.spectateView
spectateOpponentCodeLanguage: @options.spectateOpponentCodeLanguage
levelID: @options.levelID levelID: @options.levelID
for thangID, spellKeys of @thangSpells for thangID, spellKeys of @thangSpells