From b30bf35945f3ef516ab59580c691b7d9ce38a244 Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Fri, 21 Mar 2014 08:09:08 -0700 Subject: [PATCH] Fixed #638, I hope. --- app/locale/en.coffee | 2 +- app/templates/play/ladder.jade | 1 + app/templates/play/ladder/ladder_tab.jade | 2 +- app/views/play/ladder/ladder_tab.coffee | 10 +++++----- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/locale/en.coffee b/app/locale/en.coffee index 69cd93343..3e19adc57 100644 --- a/app/locale/en.coffee +++ b/app/locale/en.coffee @@ -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 Artisan Wizards." level_difficulty: "Difficulty: " - play_as: "Play As " + play_as: "Play As" spectate: "Spectate" contact: diff --git a/app/templates/play/ladder.jade b/app/templates/play/ladder.jade index d9f8bd6c0..1fe679657 100644 --- a/app/templates/play/ladder.jade +++ b/app/templates/play/ladder.jade @@ -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 diff --git a/app/templates/play/ladder/ladder_tab.jade b/app/templates/play/ladder/ladder_tab.jade index 3d41c4ec5..1af06860b 100644 --- a/app/templates/play/ladder/ladder_tab.jade +++ b/app/templates/play/ladder/ladder_tab.jade @@ -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() diff --git a/app/views/play/ladder/ladder_tab.coffee b/app/views/play/ladder/ladder_tab.coffee index 226ab5f54..9faf5049e 100644 --- a/app/views/play/ladder/ladder_tab.coffee +++ b/app/views/play/ladder/ladder_tab.coffee @@ -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 \ No newline at end of file + l