show simul results on host game page - closes #3600

pull/3613/head
Thibault Duplessis 2017-09-17 12:24:58 -05:00
parent e032525397
commit 4705dd99aa
9 changed files with 55 additions and 38 deletions

View File

@ -103,14 +103,6 @@ object Round extends LilaController with TheftPrevention {
pov.isMyTurn && (pov.game.hasClock || !currentGame.hasClock)
}
def others(gameId: String) = Open { implicit ctx =>
OptionFuResult(GameRepo game gameId) { currentGame =>
otherPovs(currentGame) map { povs =>
Ok(html.round.others(povs))
}
}
}
def whatsNext(fullId: String) = Open { implicit ctx =>
OptionFuResult(GameRepo pov fullId) { currentPov =>
if (currentPov.isMyTurn) fuccess {

View File

@ -1,6 +1,16 @@
@(playing: List[Pov])(implicit ctx: Context)
@(playing: List[Pov], simul: Option[lila.simul.Simul])(implicit ctx: Context)
<h3>
@simul.map { s =>
<span class="simul">
SIMUL
<span class="win">@s.wins W</span>/
<span class="draw">@s.draws D</span>/
<span class="loss">@s.losses L</span>/
@s.ongoing ongoing
</span>
}.getOrElse {
@trans.currentGames()
}
@defining("round-toggle-autoswitch") { id =>
<span class="move_on switcher hint--bottom-left" data-hint="@trans.automaticallyProceedToNextGameAfterMoving()">
<label for="@id">@trans.autoSwitch()</label>

View File

@ -54,9 +54,9 @@ atom = atom.some) {
}
</div></div>
</div>
@if(playing.nonEmpty) {
<div id="now_playing" class="other_games @if(ctx.pref.isBlindfold){blindfold}" data-reload-url="@routes.Round.others(pov.gameId)">
@others(playing)
@if(playing.nonEmpty || simul.nonEmpty) {
<div id="now_playing" class="other_games @if(ctx.pref.isBlindfold){blindfold}">
@others(playing, simul)
</div>
}
}

View File

@ -10,7 +10,7 @@ net {
ip = "5.196.91.160"
asset {
domain = ${net.domain}
version = 1885
version = 1892
}
email = "contact@lichess.org"
crawlable = false

View File

@ -184,7 +184,6 @@ GET /$fullId<\w{12}> controllers.Round.player(fullId
GET /$gameId<\w{8}>/$color<white|black>/socket controllers.Round.websocketWatcher(gameId: String, color: String)
GET /$fullId<\w{12}>/socket/v:apiVersion controllers.Round.websocketPlayer(fullId: String, apiVersion: Int)
GET /$gameId<\w{8}>/$color<white|black>/sides controllers.Round.sides(gameId: String, color: String)
GET /$gameId<\w{8}>/others controllers.Round.others(gameId: String)
GET /$gameId<\w{8}>/continue/:mode controllers.Round.continue(gameId: String, mode: String)
GET /$gameId<\w{8}>/note controllers.Round.readNote(gameId: String)
POST /$gameId<\w{8}>/note controllers.Round.writeNote(gameId: String)

View File

@ -130,6 +130,7 @@ case class Simul(
def wins = pairings.count(p => p.finished && p.wins.has(false))
def draws = pairings.count(p => p.finished && p.wins.isEmpty)
def losses = pairings.count(p => p.finished && p.wins.has(true))
def ongoing = pairings.count(_.ongoing)
}
object Simul {

View File

@ -11,6 +11,7 @@ case class SimulPairing(
) {
def finished = status >= chess.Status.Mate
def ongoing = !finished
def is(userId: String): Boolean = player is userId
def is(other: SimulPlayer): Boolean = player is other

View File

@ -1052,6 +1052,44 @@ div.underboard a {
display: inline-block;
}
#now_playing.other_games {
width: 512px;
}
#now_playing .switcher {
font-size: 0.7em;
display: flex;
height: 1.5em;
line-height: 22px;
}
#now_playing .switcher label {
cursor: pointer;
}
#now_playing .switcher .switch {
margin-left: 10px;
}
#now_playing.other_games > a {
padding: 5px;
}
#now_playing h3 {
font-size: 1.4em;
flex: 0 0 100%;
display: flex;
justify-content: space-between;
}
#now_playing .simul span {
font-weight: bold;
margin: 0 .5em;
}
#now_playing .simul .win {
color: #759900;
}
#now_playing .simul .draw {
color: #bf811d;
}
#now_playing .simul .loss {
color: #ac524f;
}
body.playing.zen .table {
padding: 0;
}

View File

@ -1297,35 +1297,11 @@ div.vstext .right {
display: flex;
flex-flow: row wrap;
}
#now_playing.other_games {
width: 512px;
}
#now_playing h3 {
font-size: 1.4em;
flex: 0 0 100%;
display: flex;
justify-content: space-between;
}
#now_playing > a {
padding: 4px;
transition: background 0.13s;
background: rgba(255, 255, 255, 0.6);
}
#now_playing .switcher {
font-size: 0.7em;
display: flex;
height: 1.5em;
line-height: 22px;
}
#now_playing .switcher label {
cursor: pointer;
}
#now_playing .switcher .switch {
margin-left: 10px;
}
#now_playing.other_games > a {
padding: 5px;
}
#now_playing > a:hover {
background: rgba(191, 231, 255, 0.7);
}