improve analysis replay template

This commit is contained in:
Thibault Duplessis 2018-12-17 13:01:18 +08:00
parent 72cdeee3d3
commit fa656127db

View file

@ -29,6 +29,10 @@ object replay {
import pov._
val chatJson = chatOption map { c =>
views.html.chat.json(c.chat, name = trans.spectatorRoom.txt(), timeout = c.timeout, withNote = ctx.isAuth, public = true)
}
bits.layout(
title = s"${playerText(pov.game.whitePlayer)} vs ${playerText(pov.game.blackPlayer)} in $gameId : ${game.opening.fold(trans.analysis.txt())(_.opening.ecoName)}",
side = Some(views.html.game.side(pov, initialFen, none, simul = simul, userTv = userTv, bookmarked = bookmarked)),
@ -37,21 +41,9 @@ object replay {
moreCss = cssTags("analyse.css", "chat.css"),
moreJs = frag(
jsAt(s"compiled/lichess.analyse${isProd ?? (".min")}.js"),
embedJs(s"""lichess = lichess || {};
lichess.analyse = {
data: ${safeJsonValue(data)},
i18n: ${jsI18n()},
userId: $jsUserId,
chat: ${
jsOrNull(chatOption map { c =>
views.html.chat.json(c.chat, name = trans.spectatorRoom.txt(), timeout = c.timeout, withNote = ctx.isAuth, public = true)
})
},
explorer: {
endpoint: "$explorerEndpoint",
tablebaseEndpoint: "$tablebaseEndpoint"
}
}""")
embedJs(s"""lichess=lichess||{};
lichess.analyse={data:${safeJsonValue(data)},i18n:${jsI18n()},userId:$jsUserId,chat:${jsOrNull(chatJson)},
explorer:{endpoint:"$explorerEndpoint",tablebaseEndpoint:"$tablebaseEndpoint"}}""")
),
openGraph = povOpenGraph(pov).some,
chessground = false