remove in-game preferences
This commit is contained in:
parent
a0bc0dc61a
commit
59cd481af7
|
@ -32,16 +32,6 @@ object Pref extends LilaController {
|
|||
}
|
||||
}
|
||||
|
||||
def miniFormApply = AuthBody { implicit ctx =>
|
||||
me =>
|
||||
implicit val req = ctx.body
|
||||
FormFuResult(forms.miniPref) { err =>
|
||||
fuccess("nope")
|
||||
} { data =>
|
||||
api.setPref(data(ctx.pref), notifyChange = true) inject Ok("saved")
|
||||
}
|
||||
}
|
||||
|
||||
def set(name: String) = OpenBody { implicit ctx =>
|
||||
implicit val req = ctx.body
|
||||
(setters get name) ?? {
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
@(pov: Pov, prefs: Option[Form[_]])(implicit ctx: Context)
|
||||
|
||||
<div class="chat_menu">
|
||||
@if(pov.game.hasChat) {
|
||||
<a data-panel="messages_container" class="active">
|
||||
@trans.chatRoom()
|
||||
<input title="@trans.toggleTheChat()" class="toggle_chat" type="checkbox" />
|
||||
</a>
|
||||
}
|
||||
@if(ctx.isAuth) { <a data-panel="notes">@trans.notes()</a> }
|
||||
@if(prefs.isDefined) {
|
||||
<a data-panel="preferences" data-hint="@trans.preferences()" class="hint--top">
|
||||
<span data-icon="%"></span>
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
<div id="chat" class="side_box">
|
||||
<div class="chat_panels">
|
||||
@if(pov.game.hasChat) {
|
||||
<div class="messages_container active">
|
||||
<ol class="messages content scroll-shadow-soft"></ol>
|
||||
<form action="#">
|
||||
<input class="lichess_say" value="" placeholder="@trans.talkInChat()" maxlength="140" />
|
||||
<a class="send" data-icon="z"></a>
|
||||
</form>
|
||||
</div>
|
||||
}
|
||||
@if(ctx.isAuth) {
|
||||
<div class="notes">
|
||||
<textarea placeholder="@trans.typePrivateNotesHere()"></textarea>
|
||||
</div>
|
||||
}
|
||||
@prefs.map { form =>
|
||||
<div class="preferences">
|
||||
<form class="autosubmit" action="@routes.Pref.miniFormApply" method="POST">
|
||||
<div>
|
||||
<h2>@trans.tenthsOfSeconds()</h2>
|
||||
@base.radios(form("clockTenths"), translatedClockTenthsChoices, prefix = "igp_")
|
||||
</div>
|
||||
<div>
|
||||
<h2>@trans.moveConfirmation()</h2>
|
||||
@base.radios(form("submitMove"), submitMoveChoices, prefix = "igp_")
|
||||
</div>
|
||||
<div>
|
||||
<h2>@trans.promoteToQueenAutomatically()</h2>
|
||||
@base.radios(form("autoQueen"), translatedAutoQueenChoices, prefix = "igp_")
|
||||
</div>
|
||||
<div>
|
||||
<h2>@trans.blindfoldChess()</h2>
|
||||
@base.radios(form("blindfold"), translatedBlindfoldChoices, prefix = "igp_")
|
||||
</div>
|
||||
</form>
|
||||
<a target="_blank" class="prefs button text" data-icon="%" href="@routes.Pref.form("game-display")">@trans.preferences()</a>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
|
@ -241,7 +241,6 @@ GET /fishnet/key/$key<\w{8}> controllers.Fishnet.keyExists(key:
|
|||
POST /pref/:name controllers.Pref.set(name: String)
|
||||
GET /account/preferences/:categ controllers.Pref.form(categ: String)
|
||||
POST /account/preferences controllers.Pref.formApply
|
||||
POST /account/preferences/mini controllers.Pref.miniFormApply
|
||||
POST /account/preferences/tag/:name/:value controllers.Pref.saveTag(name: String, value: String)
|
||||
|
||||
# Setup
|
||||
|
|
|
@ -101,35 +101,6 @@ private[pref] final class DataForm {
|
|||
|
||||
def prefOf(p: Pref): Form[PrefData] = pref fill PrefData(p)
|
||||
|
||||
val miniPref = Form(mapping(
|
||||
"autoQueen" -> number.verifying(Pref.AutoQueen.choices.toMap contains _),
|
||||
"blindfold" -> number.verifying(Pref.Blindfold.choices.toMap contains _),
|
||||
"clockTenths" -> number.verifying(Pref.ClockTenths.choices.toMap contains _),
|
||||
"submitMove" -> number.verifying(Pref.SubmitMove.choices.toMap contains _)
|
||||
)(MiniPrefData.apply)(MiniPrefData.unapply))
|
||||
|
||||
case class MiniPrefData(
|
||||
autoQueen: Int,
|
||||
blindfold: Int,
|
||||
clockTenths: Int,
|
||||
submitMove: Int) {
|
||||
def apply(pref: Pref) = pref.copy(
|
||||
autoQueen = autoQueen,
|
||||
blindfold = blindfold,
|
||||
clockTenths = clockTenths,
|
||||
submitMove = submitMove)
|
||||
}
|
||||
|
||||
object MiniPrefData {
|
||||
def apply(pref: Pref): MiniPrefData = MiniPrefData(
|
||||
autoQueen = pref.autoQueen,
|
||||
blindfold = pref.blindfold,
|
||||
clockTenths = pref.clockTenths,
|
||||
submitMove = pref.submitMove)
|
||||
}
|
||||
|
||||
def miniPrefOf(p: Pref): Form[MiniPrefData] = miniPref fill MiniPrefData(p)
|
||||
|
||||
val theme = Form(single(
|
||||
"theme" -> nonEmptyText.verifying(Theme contains _)
|
||||
))
|
||||
|
|
Loading…
Reference in a new issue