irc channels for languages and teams
This commit is contained in:
parent
1c0a9390bc
commit
2dd634715e
|
@ -33,7 +33,8 @@ object Environment
|
|||
with TeamHelper
|
||||
with AnalysisHelper
|
||||
with RelationHelper
|
||||
with TournamentHelper {
|
||||
with TournamentHelper
|
||||
with IRCHelper {
|
||||
|
||||
implicit val LilaHtmlZero = new Zero[Html] {
|
||||
val zero = Html("")
|
||||
|
|
30
app/templating/IRCHelper.scala
Normal file
30
app/templating/IRCHelper.scala
Normal file
|
@ -0,0 +1,30 @@
|
|||
package lila.app
|
||||
package templating
|
||||
|
||||
import lila.user.Context
|
||||
|
||||
trait IRCHelper { self: TeamHelper with SecurityHelper with I18nHelper ⇒
|
||||
|
||||
private val prompt = "1"
|
||||
private val uio = "OT10cnVlde"
|
||||
|
||||
def myIrcUrl(implicit ctx: Context) =
|
||||
"""http://webchat.freenode.net?nick=%s&channels=%s&prompt=%s&uio=%s""".format(
|
||||
ctx.username | "Anon-.",
|
||||
myIrcChannels mkString ",",
|
||||
prompt,
|
||||
uio)
|
||||
|
||||
def myIrcChannels(implicit ctx: Context): List[String] =
|
||||
teamChans ::: staffChans ::: langChans
|
||||
|
||||
private def teamChans(implicit ctx: Context) = ctx.userId ?? { userId ⇒
|
||||
teamIds(userId) map { "lichess-team-" + _ }
|
||||
}
|
||||
|
||||
private def staffChans(implicit ctx: Context) =
|
||||
isGranted(_.StaffForum) ?? List("lichess-staff")
|
||||
|
||||
private def langChans(implicit ctx: Context) =
|
||||
List("lichess", lang.language + ".lichess")
|
||||
}
|
|
@ -9,7 +9,12 @@ You can login here,<br />
|
|||
or use your own <a href="http://www.wikihow.com/Get-Started-with-IRC-(Internet-Relay-Chat)">IRC client</a>.<br />
|
||||
<br />
|
||||
Server: freenode<br />
|
||||
Channel: #lichess
|
||||
Channels: <br />
|
||||
<ul class="channels">
|
||||
@myIrcChannels.map { chan =>
|
||||
<li>#@chan</li>
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
|
||||
@site.layout(
|
||||
|
@ -19,6 +24,6 @@ moreCss = cssTag("irc.css")) {
|
|||
|
||||
<div class="content_box irc_box">
|
||||
<h1 class="lichess_title">@title</h1>
|
||||
<iframe src="http://webchat.freenode.net?nick=@ctx.username.getOrElse("Anon-.")&channels=lichess,@{lang.language}.lichess&prompt=1&uio=OT10cnVlde"></iframe>
|
||||
<iframe src="@myIrcUrl"></iframe>
|
||||
</div>
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue