From b1fd171a2732db5fe00202037a072b3b60ad8ddc Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Tue, 8 Sep 2015 06:44:26 -0700 Subject: [PATCH] Opening up the ladder tab view by hiding the FB/G+ ladder column for now. Adding submitted dates to the leaderboards. --- app/styles/play/ladder/ladder-tab-view.sass | 8 +++----- app/templates/play/ladder/ladder-tab-view.jade | 11 +++++++---- app/templates/play/ladder/my_matches_tab.jade | 4 ++-- app/views/ladder/LadderTabView.coffee | 10 ++++++---- server/levels/level_handler.coffee | 2 +- 5 files changed, 19 insertions(+), 16 deletions(-) diff --git a/app/styles/play/ladder/ladder-tab-view.sass b/app/styles/play/ladder/ladder-tab-view.sass index b510c3655..c296a9770 100644 --- a/app/styles/play/ladder/ladder-tab-view.sass +++ b/app/styles/play/ladder/ladder-tab-view.sass @@ -1,9 +1,7 @@ #ladder-tab-view - .name-col-cell - max-width: 100px - white-space: nowrap - overflow: hidden - text-overflow: ellipsis + .ladder-table + .name-col-cell + max-width: 170px .histogram-display height: 130px diff --git a/app/templates/play/ladder/ladder-tab-view.jade b/app/templates/play/ladder/ladder-tab-view.jade index c8b5f8855..77cb556de 100644 --- a/app/templates/play/ladder/ladder-tab-view.jade +++ b/app/templates/play/ladder/ladder-tab-view.jade @@ -1,8 +1,8 @@ -div#columns.row +.row for team, teamIndex in teams - div.column.col-md-4 + div.column.col-md-6 div(id="histogram-display-#{team.name}", class="histogram-display", data-team-name=team.name) - table.table.table-bordered.table-condensed.table-hover(data-team=team.id) + table.table.table-bordered.table-condensed.table-hover.ladder-table(data-team=team.id) thead tr th(colspan=level.get('type', true) == 'hero-ladder' ? 3 : 2) @@ -13,6 +13,7 @@ div#columns.row th(colspan=level.get('type', true) == 'hero-ladder' ? 3 : 2) th(data-i18n="general.score") Score th(data-i18n="general.name").name-col-cell Name + th(data-i18n="general.when") When th th.iconic-cell .glyphicon.glyphicon-eye-open @@ -31,6 +32,7 @@ div#columns.row td.rank-cell= rank + 1 td.score-cell= Math.round(sessionStats.totalScore * 100) td.name-col-cell= session.get('creatorName') || "Anonymous" + td.age-cell= moment(session.get('submitDate')).fromNow().replace('a few ', '') td.fight-cell a(href="/play/level/#{level.get('slug') || level.id}?team=#{team.otherTeam}&opponent=#{session.id}" + (league ? "&league=" + league.id : "")) span(data-i18n="ladder.fight") Fight! @@ -50,6 +52,7 @@ div#columns.row td.rank-cell= session.rank td.score-cell= Math.round(sessionStats.totalScore * 100) td.name-col-cell= session.get('creatorName') || "Anonymous" + td.age-cell= moment(session.get('submitDate')).fromNow().replace('a few ', '') td.fight-cell a(href="/play/level/#{level.get('slug') || level.id}?team=#{team.otherTeam}&opponent=#{session.id}" + (league ? "&league=" + league.id : "")) span(data-i18n="ladder.fight") Fight! @@ -58,7 +61,7 @@ div#columns.row if teamIndex == 1 .btn.btn-sm.load-more-ladder-entries(data-i18n="editor.more") More - div.column.col-md-4 + div.column.col-md-4.secret h4.friends-header(data-i18n="ladder.friends_playing") Friends Playing if me.get('anonymous') div.alert.alert-info diff --git a/app/templates/play/ladder/my_matches_tab.jade b/app/templates/play/ladder/my_matches_tab.jade index fabbb7117..36de7fe81 100644 --- a/app/templates/play/ladder/my_matches_tab.jade +++ b/app/templates/play/ladder/my_matches_tab.jade @@ -1,7 +1,7 @@ -div#columns.row +.row for team in teams div.matches-column.col-md-6 - table.table.table-bordered.table-condensed + table.table.table-bordered.table-condensed.my-matches-table tr th(colspan=5, style="color: #{team.primaryColor}") diff --git a/app/views/ladder/LadderTabView.coffee b/app/views/ladder/LadderTabView.coffee index 63301fae5..218210449 100644 --- a/app/views/ladder/LadderTabView.coffee +++ b/app/views/ladder/LadderTabView.coffee @@ -33,8 +33,9 @@ module.exports = class LadderTabView extends CocoView @teams = teamDataFromLevel @level @leaderboards = {} @refreshLadder() - @socialNetworkRes = @supermodel.addSomethingResource('social_network_apis', 0) - @checkFriends() + # Trying not loading the FP/G+ stuff for now to see if anyone complains they were using it so we can have just two columns. + #@socialNetworkRes = @supermodel.addSomethingResource('social_network_apis', 0) + #@checkFriends() checkFriends: -> return if @checked or (not window.FB) or (not window.gapi) @@ -185,6 +186,7 @@ module.exports = class LadderTabView extends CocoView ctx.capitalize = _.string.capitalize ctx.league = @options.league ctx._ = _ + ctx.moment = moment ctx generateHistogram: (histogramElement, histogramData, teamName) -> @@ -196,9 +198,9 @@ module.exports = class LadderTabView extends CocoView top: 20 right: 20 bottom: 30 - left: 0 + left: 15 - width = 300 - margin.left - margin.right + width = 470 - margin.left - margin.right height = 125 - margin.top - margin.bottom formatCount = d3.format(',.0') diff --git a/server/levels/level_handler.coffee b/server/levels/level_handler.coffee index 2ed106990..534e16552 100644 --- a/server/levels/level_handler.coffee +++ b/server/levels/level_handler.coffee @@ -205,7 +205,7 @@ LevelHandler = class LevelHandler extends Handler sortParameters = 'totalScore': req.query.order - selectProperties = ['totalScore', 'creatorName', 'creator', 'submittedCodeLanguage', 'heroConfig', 'leagues.leagueID', 'leagues.stats.totalScore'] + selectProperties = ['totalScore', 'creatorName', 'creator', 'submittedCodeLanguage', 'heroConfig', 'leagues.leagueID', 'leagues.stats.totalScore', 'submitDate'] query = Session .find(sessionsQueryParameters)