improve watcher and replay UIs

pull/1/merge
Thibault Duplessis 2012-06-09 00:10:15 +02:00
parent 201c3c9b69
commit a56e459df8
4 changed files with 10 additions and 7 deletions

View File

@ -6,13 +6,14 @@ import chess.{ Status, Variant, Color, Clock, Mode }
import user.{ User, UserHelper }
import http.Context
import i18n.I18nHelper
import templating.StringHelper
import controllers.routes
import play.api.templates.Html
import play.api.mvc.Call
trait GameHelper { self: I18nHelper with UserHelper
trait GameHelper { self: I18nHelper with UserHelper with StringHelper
val aiName = "Crafty A.I."
@ -36,7 +37,8 @@ trait GameHelper { self: I18nHelper with UserHelper ⇒
def playerLink(
player: DbPlayer,
cssClass: Option[String] = None,
withOnline: Boolean = true)(implicit ctx: Context) = Html {
withOnline: Boolean = true,
withDiff: Boolean = true)(implicit ctx: Context) = Html {
player.userId.fold(
userId userIdToUsername(userId) |> { username
"""<a class="user_link%s%s" href="%s">%s</a>""".format(
@ -45,8 +47,9 @@ trait GameHelper { self: I18nHelper with UserHelper ⇒
isUsernameOnline(username).fold(" online", " offline"),
""),
routes.User.show(username),
usernameWithElo(player) + player.eloDiff.fold(
diff " (%s)".format((diff < 0).fold(diff, "+" + diff)), "")
usernameWithElo(player) + player.eloDiff.filter(_ withDiff.pp).fold(
diff " (%s)".format(showNumber(diff)),
"")
)
},
"""<span class="user_link %s">%s</span>""".format(

View File

@ -33,7 +33,7 @@
<div>
@{ p.aiLevel.fold(
trans.aiNameLevelAiLevel(aiName, _),
playerLink(p, withOnline = false, cssClass = p.color.name.some))
playerLink(p, withOnline = false, withDiff = false, cssClass = p.color.name.some))
}
</div>
}

View File

@ -20,7 +20,7 @@
<br /><br />
@List(opponent, player).map { p =>
<div class="player">
@playerLink(p, withOnline = false, cssClass = Some("s16 " + p.color.name))
@playerLink(p, withOnline = false, withDiff = false, cssClass = Some("s16 " + p.color.name))
</div>
}
<br />

View File

@ -605,7 +605,7 @@ span.star_game .icon {
padding-left: 28px;
line-height: 28px;
text-decoration: none;
color: #aaa;
color: #a0a0a0;
}
span.star_game .icon.starred {
background-position: 0 -24px;