Fixed #638, I hope.

This commit is contained in:
Nick Winter 2014-03-21 08:09:08 -07:00
parent a3dadd6a40
commit b30bf35945
4 changed files with 8 additions and 7 deletions

View file

@ -87,7 +87,7 @@ module.exports = nativeDescription: "English", englishDescription: "English", tr
campaign_player_created: "Player-Created"
campaign_player_created_description: "... in which you battle against the creativity of your fellow <a href=\"/contribute#artisan\">Artisan Wizards</a>."
level_difficulty: "Difficulty: "
play_as: "Play As "
play_as: "Play As"
spectate: "Spectate"
contact:

View file

@ -13,6 +13,7 @@ block content
div.column.col-md-4
a(style="background-color: #{team.primaryColor}", data-team=team.id).play-button.btn.btn-danger.btn-block.btn-lg
span(data-i18n="play.play_as") Play As
|
span= team.name
div.column.col-md-2

View file

@ -27,7 +27,7 @@ div#columns.row
a(href="/play/level/#{level.get('slug') || level.id}/?team=#{team.otherTeam}&opponent=#{session.id}")
span(data-i18n="ladder.fight") Fight!
if !inTheTop && ! me.get('anonymous')
if !inTheTop && team.leaderboard.nearbySessions().length
tr(class="active")
td(colspan=4).ellipsis-row ...
for session in team.leaderboard.nearbySessions()

View file

@ -69,7 +69,7 @@ class LeaderboardData
level = "#{level.get('original')}.#{level.get('version').major}"
success = (@myRank) =>
promises.push $.ajax "/db/level/#{level}/leaderboard_rank?scoreOffset=#{@session.get('totalScore')}&team=#{@team}", {success}
$.when(promises...).then @onLoad
onLoad: =>
@ -77,12 +77,12 @@ class LeaderboardData
@trigger 'sync'
# TODO: cache user ids -> names mapping, and load them here as needed,
# and apply them to sessions. Fetching each and every time is too costly.
inTopSessions: ->
return me.id in (session.attributes.creator for session in @topPlayers.models)
nearbySessions: ->
return unless @session
return [] unless @session
l = []
above = @playersAbove.models
above.reverse()
@ -92,4 +92,4 @@ class LeaderboardData
if @myRank
startRank = @myRank - 4
session.rank = startRank + i for session, i in l
l
l