forked from lichess-org/lila
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make the site template layout compile
- Loading branch information
Showing
41 changed files
with
355 additions
and
326 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package lila.app | ||
|
||
trait Modules { | ||
|
||
def userEnv = lila.user.Env.current | ||
def gameEnv = lila.game.Env.current | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package controllers | ||
|
||
import lila.app._ | ||
import views._ | ||
|
||
object ForumCateg extends LilaController with ForumController { | ||
|
||
// def index = Open { implicit ctx ⇒ | ||
// IOk(categApi list ~ctx.me.map(teamCache.teamIds) map { | ||
// html.forum.categ.index(_) | ||
// }) | ||
// } | ||
|
||
def show(slug: String, page: Int) = TODO | ||
// Open { implicit ctx ⇒ | ||
// CategGrantRead(slug) { | ||
// IOptionOk(categApi.show(slug, page)) { | ||
// case (categ, topics) ⇒ html.forum.categ.show(categ, topics) | ||
// } | ||
// } | ||
// } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package controllers | ||
|
||
import lila.app._ | ||
import views._ | ||
import lila.user.Context | ||
import lila.common.LilaCookie | ||
import lila.i18n._ | ||
|
||
import play.api.data.Form | ||
|
||
object I18n extends LilaController { | ||
|
||
// private def transInfos = env.i18n.transInfos | ||
// private def pool = env.i18n.pool | ||
// private def translator = env.i18n.translator | ||
// private def forms = env.i18n.forms | ||
// private def i18nKeys = env.i18n.keys | ||
// private def repo = env.i18n.translationRepo | ||
|
||
def contribute = TODO | ||
// Open { implicit ctx ⇒ | ||
// val mines = (pool fixedReqAcceptLanguages ctx.req map { lang ⇒ | ||
// transInfos get lang | ||
// }).toList.flatten | ||
// Ok(html.i18n.contribute(transInfos.all, mines)) | ||
// } | ||
|
||
// def translationForm(lang: String) = Open { implicit ctx ⇒ | ||
// OptionOk(transInfos get lang) { info ⇒ | ||
// val (form, captcha) = forms.translationWithCaptcha | ||
// renderTranslationForm(form, info, captcha) | ||
// } | ||
// } | ||
|
||
// def translationPost(lang: String) = OpenBody { implicit ctx ⇒ | ||
// OptionResult(transInfos get lang) { info ⇒ | ||
// implicit val req = ctx.body | ||
// val data = forms.decodeTranslationBody | ||
// FormIOResult(forms.translation) { form ⇒ | ||
// renderTranslationForm(form, info, forms.captchaCreate, data) | ||
// } { metadata ⇒ | ||
// forms.process(lang, metadata, data) map { _ ⇒ | ||
// Redirect(routes.I18n.contribute).flashing("success" -> "1") | ||
// } | ||
// } | ||
// } | ||
// } | ||
|
||
// private def renderTranslationForm(form: Form[_], info: TransInfo, captcha: Captcha.Challenge, data: Map[String, String] = Map.empty)(implicit ctx: Context) = | ||
// html.i18n.translationForm( | ||
// info, | ||
// form, | ||
// i18nKeys, | ||
// pool.default, | ||
// translator.rawTranslation(info.lang) _, | ||
// captcha, | ||
// data) | ||
|
||
// def fetch(from: Int) = Open { implicit ctx ⇒ | ||
// JsonOk((repo findFrom from map { | ||
// _ map (_.toJson) | ||
// }).unsafePerformIO) | ||
// } | ||
|
||
// val hideCalls = Open { implicit ctx ⇒ | ||
// implicit val req = ctx.req | ||
// val cookie = LilaCookie.cookie( | ||
// env.i18n.hideCallsCookieName, | ||
// "1", | ||
// maxAge = env.i18n.hideCallsCookieMaxAge.some) | ||
// Redirect(routes.Lobby.home()) withCookies cookie | ||
// } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package controllers | ||
|
||
import lila.app._ | ||
import views._ | ||
|
||
import play.api.mvc._ | ||
import play.api.mvc.Results._ | ||
import play.api.data._ | ||
import play.api.data.Forms._ | ||
import play.api.libs.json._ | ||
import play.api.libs.iteratee._ | ||
import play.api.libs.concurrent.Akka | ||
|
||
object Main extends LilaController { | ||
|
||
// def websocket = WebSocket.async[JsValue] { implicit req ⇒ | ||
// implicit val ctx = reqToCtx(req) | ||
// env.site.socket.join( | ||
// uidOption = get("sri"), | ||
// username = ctx.me map (_.username), | ||
// flag = get("flag") | ||
// ) | ||
// } | ||
|
||
// def captchaCheck(id: String) = Open { implicit ctx ⇒ | ||
// Ok(env.site.captcha get id valid ~get("solution") fold (1, 0)) | ||
// } | ||
|
||
// def embed = Open { implicit ctx ⇒ | ||
// JsOk("""document.write("<iframe src='%s?embed=" + document.domain + "' class='lichess-iframe' allowtransparency='true' frameBorder='0' style='width: %dpx; height: %dpx;' title='Lichess free online chess'></iframe>");""" | ||
// .format(env.settings.NetBaseUrl, getInt("w") | 820, getInt("h") | 650), | ||
// CACHE_CONTROL -> "max-age=86400" | ||
// ) | ||
// } | ||
|
||
def developers = TODO | ||
// Open { implicit ctx ⇒ | ||
// Ok(views.html.site.developers()) | ||
// } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package controllers | ||
|
||
import play.api.mvc._ | ||
import play.api.libs.Comet | ||
import play.api.libs.concurrent._ | ||
import play.api.libs.json._ | ||
import akka.pattern.ask | ||
import play.api.libs.concurrent.Execution.Implicits._ | ||
|
||
import lila.app._ | ||
import lila.socket.actorApi.GetNbMembers | ||
// import lila.monitor._ | ||
import makeTimeout.short | ||
|
||
object Monitor extends LilaController { | ||
|
||
// private def reporting = env.monitor.reporting | ||
// private def usernameMemo = env.user.usernameMemo | ||
// private def userRepo = env.user.userRepo | ||
// private def gameRepo = env.game.gameRepo | ||
|
||
def index = TODO | ||
// Action { | ||
// Ok(views.html.monitor.monitor()) | ||
// } | ||
|
||
// def websocket = WebSocket.async[JsValue] { implicit req ⇒ | ||
// env.monitor.socket.join(uidOption = get("sri", req)) | ||
// } | ||
|
||
// def status = Open { implicit ctx ⇒ | ||
// Async { | ||
// import lila.common.Futuristic.ioToFuture | ||
// (~get("key") match { | ||
// case "elo" ⇒ | ||
// userRepo.idsAverageElo(usernameMemo.keys).toFuture zip | ||
// gameRepo.recentAverageElo(5).toFuture map { | ||
// case (users, (rated, casual)) ⇒ List(users, rated, casual) mkString " " | ||
// } | ||
// case "moves" ⇒ (reporting ? GetNbMoves).mapTo[Int] | ||
// case "players" ⇒ (reporting ? GetNbMembers).mapTo[Int] map { "%d %d".format(_, usernameMemo.preciseCount) } | ||
// case _ ⇒ (reporting ? GetStatus).mapTo[String] | ||
// }) map { x ⇒ Ok(x.toString) } | ||
// } | ||
// } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package controllers | ||
|
||
import lila.app._ | ||
import views._ | ||
import lila.user.{ Context, BodyContext, Setting ⇒ UserSetting } | ||
|
||
import play.api.data.Form | ||
import play.api.mvc.{ Result, Cookie } | ||
import play.api.mvc.Results._ | ||
import play.api.libs.concurrent.Execution.Implicits._ | ||
|
||
object Setting extends LilaController { | ||
|
||
def set(name: String) = OpenBody { implicit ctx ⇒ | ||
implicit val req = ctx.body | ||
(setters get name) zmap { | ||
case (form, fn) ⇒ FormResult(form) { v ⇒ | ||
fn(UserSetting(ctx), v) map { Ok() withCookies _ } | ||
} | ||
} | ||
} | ||
|
||
private type Setter = (Form[String], (UserSetting, String) ⇒ Fu[Cookie]) | ||
|
||
private def forms = userEnv.forms | ||
|
||
private lazy val setters = Map( | ||
"theme" -> setTheme, | ||
"sound" -> setSound, | ||
"chat" -> setChat, | ||
"bg" -> setBg) | ||
|
||
private lazy val setTheme: Setter = forms.theme -> { | ||
(setting, v) ⇒ setting.theme(v) | ||
} | ||
|
||
private lazy val setSound: Setter = forms.sound -> { | ||
(setting, v) ⇒ setting.sound(v) | ||
} | ||
|
||
private lazy val setChat: Setter = forms.chat -> { | ||
(setting, v) ⇒ setting.chat(v) | ||
} | ||
|
||
private lazy val setBg: Setter = forms.bg -> { | ||
(setting, v) ⇒ setting.bg(v) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
package lila | ||
|
||
package object app extends PackageObject with WithPlay | ||
import scalaz.Zero | ||
import play.api.mvc.{ Result, Results } | ||
|
||
package object app extends PackageObject with WithPlay { | ||
|
||
implicit val LilaResultZero = new Zero[Result] { | ||
val zero = Results.NotFound | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.