diff --git a/app/core/CoreEnv.scala b/app/core/CoreEnv.scala index ba316642ee..40651404ba 100644 --- a/app/core/CoreEnv.scala +++ b/app/core/CoreEnv.scala @@ -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._ diff --git a/app/templating/ConfigHelper.scala b/app/templating/ConfigHelper.scala new file mode 100644 index 0000000000..a741207176 --- /dev/null +++ b/app/templating/ConfigHelper.scala @@ -0,0 +1,11 @@ +package lila +package templating + +import core.CoreEnv + +trait ConfigHelper { + + protected def env: CoreEnv + + def moretimeSeconds = env.settings.MoretimeSeconds +} diff --git a/app/templating/Environment.scala b/app/templating/Environment.scala index c79411a03b..9cd3e2957c 100644 --- a/app/templating/Environment.scala +++ b/app/templating/Environment.scala @@ -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 } diff --git a/app/templating/I18nHelper.scala b/app/templating/I18nHelper.scala index 950ccfa228..03011568ae 100644 --- a/app/templating/I18nHelper.scala +++ b/app/templating/I18nHelper.scala @@ -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 diff --git a/app/templating/UserHelper.scala b/app/templating/UserHelper.scala new file mode 100644 index 0000000000..14d0fc0a62 --- /dev/null +++ b/app/templating/UserHelper.scala @@ -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 + } +} diff --git a/app/views/round/player.scala.html b/app/views/round/player.scala.html index d19e47a69a..533f046944 100644 --- a/app/views/round/player.scala.html +++ b/app/views/round/player.scala.html @@ -38,13 +38,17 @@