show tournament standing on game page

This commit is contained in:
Thibault Duplessis 2014-05-11 00:49:32 +02:00
parent 140f179e98
commit bebaca453f
7 changed files with 73 additions and 6 deletions

View file

@ -120,7 +120,7 @@ object Round extends LilaController with TheftPrevention {
val table = if (player) html.round.table.end(pov, tour) else html.round.table.watch(pov)
Json.obj(
"players" -> players,
"infobox" -> html.game.infoBox(pov, tour).toString,
"infobox" -> html.game.infoBox(pov, tour, withTourStanding = player).toString,
"table" -> table.toString)
}
}

View file

@ -37,7 +37,7 @@
@analyse.layout(
title = title,
goodies = views.html.game.infoBox(pov, tour).some,
goodies = views.html.game.infoBox(pov, tour, withTourStanding = false).some,
chat = chat.map(c => base.chat(c, trans.spectatorRoom.str())),
underchat = underchat.some,
moreCss = moreCss,

View file

@ -1,4 +1,4 @@
@(pov: Pov, tour: Option[lila.tournament.Tournament])(implicit ctx: Context)
@(pov: Pov, tour: Option[lila.tournament.Tournament], withTourStanding: Boolean)(implicit ctx: Context)
@import pov._
@ -47,12 +47,53 @@
</div>
@tour match {
case Some(t: lila.tournament.Started) => {
case Some(t: lila.tournament.StartedOrFinished) => {
<div class="game_tournament box">
<span class="title">&nbsp;@if(t.scheduled) {@t.name} else {@trans.xTournament(t.name)}</span>
@t match {
case t: lila.tournament.Started => {
<div class="clock" data-time="@t.remainingSeconds">
<div class="time" data-icon="p">@t.clockStatus</div>
</div>
}
case _ => {
}
}
@if(withTourStanding) {
<table class="slist standing">
<tbody>
@t.rankedPlayers.map {
case (rank, player) => {
@defining((
if(t.isFinished && rank == 1) "winner" else if (player.withdraw) "withdraw" else "",
t scoreSheet player
)) {
case (flag, scoreSheet) => {
<tr @if(ctx.userId.exists(player.id==)) { class="me" }>
<td class="name">
@if(player.withdraw) {
<span data-icon="b" title="@trans.withdraw()"></span>
} else {
@if(t.isFinished && rank == 1) {
<span data-icon="g" title="@trans.winner()"></span>
} else {
<span class="rank">@rank</span>
}
}
@userInfosLink(player.id, none, withOnline = false)
</td>
<td class="total">
<strong@if(scoreSheet.onFire) { class="is-gold" data-icon="Q" }>@scoreSheet.total</strong>
</td>
</tr>
<tr><td class="around-bar" colspan="3"><div class="bar" data-value="@scoreSheet.total"></div></td></tr>
}
}
}
}
</tbody>
</table>
}
</div>
}
case _ => {

View file

@ -12,7 +12,7 @@
@round.layout(
title = title,
goodies = views.html.game.infoBox(pov, tour),
goodies = views.html.game.infoBox(pov, tour, withTourStanding = true),
chat = chat.map(c => base.chat(c, trans.chatRoom.str())),
underchat = underchat.some,
signedJs = hijackEnabled(pov.game) option routes.Round.signedJs(pov.gameId) map (_.toString)) {

View file

@ -12,7 +12,7 @@
@round.layout(
title = title,
goodies = views.html.game.infoBox(pov, tour),
goodies = views.html.game.infoBox(pov, tour, withTourStanding = false),
chat = chat.map(c => base.chat(c, trans.spectatorRoom.str())),
underchat = underchat.some) {
@watcherGame(pov)

View file

@ -718,6 +718,11 @@ div.under_chat .watchtv {
div.game_tournament {
text-align: center;
line-height: 2em;
max-height: 400px;
overflow: hidden;
}
div.game_tournament:hover {
overflow-y: auto;
}
div.game_tournament .title {
display: block;
@ -730,6 +735,24 @@ div.game_tournament .clock {
font-family: monospace;
font-weight: bold;
}
div.game_tournament table.standing {
margin-top: 10px;
border-bottom: none;
}
div.game_tournament table.standing tr.me td {
background: #e4e4e4;
}
div.game_tournament table.standing td {
padding: 0;
text-align: left;
}
div.game_tournament table.standing td.name span {
display: inline-block;
width: 20px;
}
div.game_tournament table.standing td.total {
text-align: right;
}
span.inline_userlist {
display: inline;
color: #9a9a9a;

View file

@ -380,6 +380,9 @@ body.dark #puzzle > .right .please_vote {
background: #103410;
color: #74a962;
}
body.dark div.game_tournament table.standing tr.me td {
background: #333;
}
body.dark::-webkit-input-placeholder {
color: #666;
}