show player links on games displayed on my user page

This commit is contained in:
Thibault Duplessis 2012-06-13 22:48:37 +02:00
parent 243acc7302
commit 075efdda8e
4 changed files with 10 additions and 5 deletions

View file

@ -88,8 +88,12 @@ trait GameHelper { self: I18nHelper with UserHelper with StringHelper ⇒
case _ Html("")
}
def gameFen(game: DbGame, color: Color)(implicit ctx: Context) = Html {
val url = routes.Round.watcher(game.id, color.name)
def gameFen(game: DbGame, color: Color, ownerLink: Boolean = false)(implicit ctx: Context) = Html {
val owner = ownerLink.fold(ctx.me flatMap game.player, none)
val url = owner.fold(
o routes.Round.player(game fullIdOf o.color),
routes.Round.watcher(game.id, color.name)
)
"""<a href="%s" title="%s" class="mini_board parse_fen" data-color="%s" data-fen="%s"></a>""".format(
url,
trans.viewInFullSize(),

View file

@ -1,10 +1,10 @@
@(games: List[DbGame], user: Option[User] = None, mini: Boolean = false)(implicit ctx: Context)
@(games: List[DbGame], user: Option[User] = None, ownerLink: Boolean = false, mini: Boolean = false)(implicit ctx: Context)
@games.map { g =>
<div class="game_row paginated_element clearfix">
@defining(user flatMap g.player) { fromPlayer =>
@defining(fromPlayer | g.creator ) { firstPlayer =>
@gameFen(g, firstPlayer.color)
@gameFen(g, firstPlayer.color, ownerLink)
<div class="infos">
@bookmark.toggle(g)
<b>

View file

@ -119,7 +119,7 @@ evenMoreCss = evenMoreCss) {
</div>
<div class="games infinitescroll all_games">
<div class="pager none"><a href="@routes.User.showFilter(u.username, filters.current.name, games.nextPage | 1)">Next</a></div>
@game.widgets(games.currentPageResults, u.some)
@game.widgets(games.currentPageResults, user = u.some, ownerLink = ctx is u)
</div>
}
</div>

1
todo
View file

@ -23,6 +23,7 @@ tournaments http://www.chess.com/tournaments/help.html
fix game list translations
temporary mod IP ban to help stopping cheaters
join game as player from player page
load graphs later
new translations:
-rematchOfferCanceled=Rematch offer canceled