Templating
This commit is contained in:
parent
04c8703e4a
commit
5c1005d1c2
|
@ -11,7 +11,7 @@ import play.api.Application
|
|||
|
||||
import ui._
|
||||
|
||||
final class CoreEnv private (application: Application, settings: Settings) {
|
||||
final class CoreEnv private (application: Application, val settings: Settings) {
|
||||
|
||||
implicit val app = application
|
||||
import settings._
|
||||
|
|
11
app/templating/ConfigHelper.scala
Normal file
11
app/templating/ConfigHelper.scala
Normal file
|
@ -0,0 +1,11 @@
|
|||
package lila
|
||||
package templating
|
||||
|
||||
import core.CoreEnv
|
||||
|
||||
trait ConfigHelper {
|
||||
|
||||
protected def env: CoreEnv
|
||||
|
||||
def moretimeSeconds = env.settings.MoretimeSeconds
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package lila
|
||||
package templating
|
||||
|
||||
import core.Global.{ env ⇒ coreEnv } // OMG
|
||||
import http.{ HttpEnvironment, Setting }
|
||||
|
||||
object Environment
|
||||
|
@ -11,6 +12,9 @@ object Environment
|
|||
with I18nHelper
|
||||
with UiHelper
|
||||
with RequestHelper
|
||||
with SettingHelper {
|
||||
with SettingHelper
|
||||
with UserHelper
|
||||
with ConfigHelper {
|
||||
|
||||
protected def env = coreEnv
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package lila
|
||||
package templating
|
||||
|
||||
import core.CoreEnv
|
||||
import controllers._
|
||||
import http.Context
|
||||
import i18n.{ LangList, I18nDomain }
|
||||
import core.Global.env // OMG
|
||||
|
||||
import play.api.i18n.Lang
|
||||
import play.api.templates.Html
|
||||
|
@ -12,6 +12,8 @@ import play.api.mvc.RequestHeader
|
|||
|
||||
trait I18nHelper {
|
||||
|
||||
protected def env: CoreEnv
|
||||
|
||||
private val pool = env.i18n.pool
|
||||
|
||||
val trans = env.i18n.keys
|
||||
|
|
13
app/templating/UserHelper.scala
Normal file
13
app/templating/UserHelper.scala
Normal file
|
@ -0,0 +1,13 @@
|
|||
package lila
|
||||
package templating
|
||||
|
||||
import play.api.templates.Html
|
||||
|
||||
import game.DbPlayer
|
||||
|
||||
trait UserHelper {
|
||||
|
||||
def playerLink(player: DbPlayer, cssClass: String) = Html {
|
||||
"link " + player.id
|
||||
}
|
||||
}
|
|
@ -38,13 +38,17 @@
|
|||
</div>
|
||||
<div class="lichess_separator"></div>
|
||||
<div class="table_inner">
|
||||
{% include (game.isPlayable ? "LichessBundle:Game:table.html.twig" : "LichessBundle:Game:tableEnd.html.twig") with {"player": player} %}
|
||||
@if(game.playable) {
|
||||
@round.table(pov)
|
||||
} else {
|
||||
@round.tableEnd(pov)
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@game.clock.map { c =>
|
||||
@round.clock(c, pov.color, "bottom")
|
||||
@if(!game.finished) {
|
||||
<a class="moretime" href="#" title="@trans.giveNbSeconds(15)"></a>
|
||||
<a class="moretime" href="#" title="@trans.giveNbSeconds(moretimeSeconds)"></a>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
|
|
3
app/views/round/table.scala.html
Normal file
3
app/views/round/table.scala.html
Normal file
|
@ -0,0 +1,3 @@
|
|||
@(pov: Pov)(implicit ctx: Context)
|
||||
|
||||
table
|
3
app/views/round/tableEnd.scala.html
Normal file
3
app/views/round/tableEnd.scala.html
Normal file
|
@ -0,0 +1,3 @@
|
|||
@(pov: Pov)(implicit ctx: Context)
|
||||
|
||||
table end
|
|
@ -1,3 +1,11 @@
|
|||
@(player: DbPlayer)(implicit ctx: Context)
|
||||
|
||||
player @player
|
||||
@if(player.isAi) {
|
||||
<div class="username connected">
|
||||
@trans.aiNameLevelAiLevel("Crafty A.I.", player.aiLevel)
|
||||
</div>
|
||||
} else {
|
||||
<div class="username @player.color.name">
|
||||
@playerLink(player, "blank_if_play")
|
||||
</div>
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue