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
.loss
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)
#ladder-view

View file

@ -48,7 +48,7 @@ block content
if level.get('name') == 'Criss-Cross'
.tournament-blurb
h2
span(data-i18n="ladder.tournament_ends") Tournament ends
span(data-i18n="ladder.tournament_ended") Tournament ended
| #{tournamentTimeLeft}
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
@ -745,11 +745,15 @@ block content
thead
tr
th(data-i18n="ladder_prizes.rank") Rank
if level.get('name') == 'Criss-Cross'
th
th Human
if level.get('name') == 'Greed'
th Human wins/losses/ties
else
th Human score
if level.get('name') == 'Criss-Cross'
th
th Ogre
if level.get('name') == 'Greed'
th Ogre wins/losses/ties
@ -761,6 +765,8 @@ block content
- var ogre = winners.ogres[index]
tr
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
if level.get('name') == 'Greed'
td
@ -773,6 +779,8 @@ block content
td
span= Math.round(100 * human.score)
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
if level.get('name') == 'Greed'
td

View file

@ -183,7 +183,7 @@ module.exports = class SpectateLevelView extends RootView
ctx.fillText("Loaded #{@modelsLoaded} thingies",50,50)
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 GoldView {}

View file

@ -65,7 +65,7 @@ module.exports = class LadderView extends RootView
@insertSubView(@simulateTab = new SimulateTabView())
@refreshInterval = setInterval(@fetchSessionsAndRefreshViews.bind(@), 20 * 1000)
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
fetchSessionsAndRefreshViews: ->

View file

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

View file

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