mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-05-04 18:03:45 -04:00
Fixed #638, I hope.
This commit is contained in:
parent
a3dadd6a40
commit
b30bf35945
4 changed files with 8 additions and 7 deletions
app
|
@ -87,7 +87,7 @@ module.exports = nativeDescription: "English", englishDescription: "English", tr
|
||||||
campaign_player_created: "Player-Created"
|
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>."
|
campaign_player_created_description: "... in which you battle against the creativity of your fellow <a href=\"/contribute#artisan\">Artisan Wizards</a>."
|
||||||
level_difficulty: "Difficulty: "
|
level_difficulty: "Difficulty: "
|
||||||
play_as: "Play As "
|
play_as: "Play As"
|
||||||
spectate: "Spectate"
|
spectate: "Spectate"
|
||||||
|
|
||||||
contact:
|
contact:
|
||||||
|
|
|
@ -13,6 +13,7 @@ block content
|
||||||
div.column.col-md-4
|
div.column.col-md-4
|
||||||
a(style="background-color: #{team.primaryColor}", data-team=team.id).play-button.btn.btn-danger.btn-block.btn-lg
|
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(data-i18n="play.play_as") Play As
|
||||||
|
|
|
||||||
span= team.name
|
span= team.name
|
||||||
div.column.col-md-2
|
div.column.col-md-2
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ div#columns.row
|
||||||
a(href="/play/level/#{level.get('slug') || level.id}/?team=#{team.otherTeam}&opponent=#{session.id}")
|
a(href="/play/level/#{level.get('slug') || level.id}/?team=#{team.otherTeam}&opponent=#{session.id}")
|
||||||
span(data-i18n="ladder.fight") Fight!
|
span(data-i18n="ladder.fight") Fight!
|
||||||
|
|
||||||
if !inTheTop && ! me.get('anonymous')
|
if !inTheTop && team.leaderboard.nearbySessions().length
|
||||||
tr(class="active")
|
tr(class="active")
|
||||||
td(colspan=4).ellipsis-row ...
|
td(colspan=4).ellipsis-row ...
|
||||||
for session in team.leaderboard.nearbySessions()
|
for session in team.leaderboard.nearbySessions()
|
||||||
|
|
|
@ -69,7 +69,7 @@ class LeaderboardData
|
||||||
level = "#{level.get('original')}.#{level.get('version').major}"
|
level = "#{level.get('original')}.#{level.get('version').major}"
|
||||||
success = (@myRank) =>
|
success = (@myRank) =>
|
||||||
promises.push $.ajax "/db/level/#{level}/leaderboard_rank?scoreOffset=#{@session.get('totalScore')}&team=#{@team}", {success}
|
promises.push $.ajax "/db/level/#{level}/leaderboard_rank?scoreOffset=#{@session.get('totalScore')}&team=#{@team}", {success}
|
||||||
|
|
||||||
$.when(promises...).then @onLoad
|
$.when(promises...).then @onLoad
|
||||||
|
|
||||||
onLoad: =>
|
onLoad: =>
|
||||||
|
@ -77,12 +77,12 @@ class LeaderboardData
|
||||||
@trigger 'sync'
|
@trigger 'sync'
|
||||||
# TODO: cache user ids -> names mapping, and load them here as needed,
|
# 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.
|
# and apply them to sessions. Fetching each and every time is too costly.
|
||||||
|
|
||||||
inTopSessions: ->
|
inTopSessions: ->
|
||||||
return me.id in (session.attributes.creator for session in @topPlayers.models)
|
return me.id in (session.attributes.creator for session in @topPlayers.models)
|
||||||
|
|
||||||
nearbySessions: ->
|
nearbySessions: ->
|
||||||
return unless @session
|
return [] unless @session
|
||||||
l = []
|
l = []
|
||||||
above = @playersAbove.models
|
above = @playersAbove.models
|
||||||
above.reverse()
|
above.reverse()
|
||||||
|
@ -92,4 +92,4 @@ class LeaderboardData
|
||||||
if @myRank
|
if @myRank
|
||||||
startRank = @myRank - 4
|
startRank = @myRank - 4
|
||||||
session.rank = startRank + i for session, i in l
|
session.rank = startRank + i for session, i in l
|
||||||
l
|
l
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue