more work on correspondance chess
This commit is contained in:
parent
b26c83eb50
commit
ea5bc83c63
|
@ -2,11 +2,18 @@ package lila.app
|
|||
package templating
|
||||
|
||||
import chess.{ Mode, Variant, Speed }
|
||||
import lila.setup.TimeMode
|
||||
import lila.api.Context
|
||||
import lila.tournament.System
|
||||
|
||||
trait SetupHelper { self: I18nHelper =>
|
||||
|
||||
def translatedTimeModeChoices(implicit ctx: Context) = List(
|
||||
(TimeMode.Clock.id.toString, trans.clock.str(), none),
|
||||
(TimeMode.Correspondance.id.toString, trans.correspondance.str(), none),
|
||||
(TimeMode.Unlimited.id.toString, trans.unlimited.str(), none)
|
||||
)
|
||||
|
||||
def translatedModeChoices(implicit ctx: Context) = List(
|
||||
(Mode.Casual.id.toString, trans.casual.str(), none),
|
||||
(Mode.Rated.id.toString, trans.rated.str(), none)
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
@trans.variant() @setup.select(form("variant"), translatedVariantChoicesWithFenAndKingOfTheHill)
|
||||
</div>
|
||||
@fenInput(form("fen"), true)
|
||||
@setup.clock(form, lila.setup.AiConfig)
|
||||
@setup.timeMode(form, lila.setup.AiConfig)
|
||||
@trans.level()
|
||||
<div class="level buttons">
|
||||
<div id="config_level">
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
@(form: Form[_], config: lila.setup.BaseConfig)(implicit ctx: Context)
|
||||
|
||||
@import lila.setup.FriendConfig
|
||||
|
||||
<div class="clock_config optional_config">
|
||||
<div class="clock_choice">
|
||||
<label class="required pointer" for="clock">@trans.timeControl()</label>
|
||||
@setup.checkbox(form("clock"))
|
||||
</div>
|
||||
<div class="time_choice">
|
||||
@trans.minutesPerSide(): <span>@form("time").value</span>
|
||||
@setup.input(
|
||||
form("time"))
|
||||
</div>
|
||||
<div class="increment_choice">
|
||||
@trans.incrementInSeconds(): <span>@form("increment").value</span>
|
||||
@setup.input(
|
||||
form("increment"))
|
||||
</div>
|
||||
</div>
|
|
@ -10,7 +10,7 @@
|
|||
@trans.variant() @setup.select(form("variant"), translatedVariantChoicesWithVariantsAndFen)
|
||||
</div>
|
||||
@fenInput(form("fen"), false)
|
||||
@setup.clock(form, lila.setup.FriendConfig)
|
||||
@setup.timeMode(form, lila.setup.FriendConfig)
|
||||
@if(ctx.isAuth) {
|
||||
<div class="mode_choice buttons">
|
||||
@globalCasualOnlyMessage.getOrElse {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<div class="variants">
|
||||
@trans.variant() @setup.select(form("variant"), translatedVariantChoicesWithVariants)
|
||||
</div>
|
||||
@setup.clock(form, lila.setup.HookConfig)
|
||||
@setup.timeMode(form, lila.setup.HookConfig)
|
||||
@if(ctx.isAuth) {
|
||||
<div class="mode_choice buttons">
|
||||
@globalCasualOnlyMessage.getOrElse {
|
||||
|
|
26
app/views/setup/timeMode.scala.html
Normal file
26
app/views/setup/timeMode.scala.html
Normal file
|
@ -0,0 +1,26 @@
|
|||
@(form: Form[_], config: lila.setup.BaseConfig)(implicit ctx: Context)
|
||||
|
||||
@import lila.setup.FriendConfig
|
||||
|
||||
<div class="time_mode_config optional_config">
|
||||
<div class="time_mode_choice">
|
||||
@trans.timeControl()
|
||||
@setup.select(form("timeMode"), translatedTimeModeChoices)
|
||||
</div>
|
||||
<div class="clock">
|
||||
<div class="time_choice">
|
||||
@trans.minutesPerSide(): <span>@form("time").value</span>
|
||||
@setup.input(form("time"))
|
||||
</div>
|
||||
<div class="increment_choice">
|
||||
@trans.incrementInSeconds(): <span>@form("increment").value</span>
|
||||
@setup.input(form("increment"))
|
||||
</div>
|
||||
</div>
|
||||
<div class="correspondance">
|
||||
<div class="days_choice">
|
||||
@trans.daysPerTurn(): <span>@form("days").value</span>
|
||||
@setup.input(form("days"))
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
16
bin/mongodb/config-timemode.js
Normal file
16
bin/mongodb/config-timemode.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
db.config.find({_id:'thibault'}).forEach(function(o) {
|
||||
var sets = {};
|
||||
var unsets = {};
|
||||
['friend', 'hook', 'ai'].forEach(function(type) {
|
||||
if (!o[type]) return;
|
||||
sets[type + '.tm'] = o[type].k ? NumberInt(1) : NumberInt(0);
|
||||
sets[type + '.d'] = NumberInt(2);
|
||||
unsets[type + '.k'] = true;
|
||||
});
|
||||
db.config.update({
|
||||
_id: o._id
|
||||
}, {
|
||||
$set: sets,
|
||||
$unset: unsets
|
||||
});
|
||||
});
|
|
@ -80,6 +80,9 @@ players=Players
|
|||
minutesPerSide=Minutes per side
|
||||
variant=Variant
|
||||
timeControl=Time control
|
||||
clock=Clock
|
||||
correspondance=Correspondance
|
||||
daysPerTurn=Days per turn
|
||||
time=Time
|
||||
username=User name
|
||||
password=Password
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -94,9 +94,9 @@ trait BaseConfig {
|
|||
val variantDefault = Variant.Standard
|
||||
|
||||
val variantsWithFen = variants :+ Variant.FromPosition.id
|
||||
val variantsWithFenAndKingOfTheHill = variantsWithFen :+ Variant.KingOfTheHill.id
|
||||
val variantsWithFenAndKingOfTheHill = variants :+ Variant.KingOfTheHill.id :+ Variant.FromPosition.id
|
||||
val variantsWithVariants = variants :+ Variant.KingOfTheHill.id :+ Variant.ThreeCheck.id
|
||||
val variantsWithFenAndVariants = variantsWithFen :+ Variant.KingOfTheHill.id :+ Variant.ThreeCheck.id
|
||||
val variantsWithFenAndVariants = variants :+ Variant.KingOfTheHill.id :+ Variant.ThreeCheck.id :+ Variant.FromPosition.id
|
||||
|
||||
val speeds = Speed.all map (_.id)
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ private[setup] case class RawFriendConfig(
|
|||
def decode = for {
|
||||
variant ← Variant(v)
|
||||
mode ← Mode(m)
|
||||
timeMode <- TimeMode(t)
|
||||
timeMode <- TimeMode(tm)
|
||||
} yield FriendConfig(
|
||||
variant = variant,
|
||||
timeMode = timeMode,
|
||||
|
|
|
@ -1150,6 +1150,7 @@ var storage = {
|
|||
|
||||
function prepareForm() {
|
||||
var $form = $('div.lichess_overboard');
|
||||
var $timeModeChoices = $form.find('.time_mode_choice input');
|
||||
var $modeChoicesWrap = $form.find('.mode_choice');
|
||||
var $modeChoices = $modeChoicesWrap.find('input');
|
||||
var $casual = $modeChoices.eq(0),
|
||||
|
@ -1159,6 +1160,7 @@ var storage = {
|
|||
var $clockCheckbox = $form.find('.clock_choice input');
|
||||
var $timeInput = $form.find('.time_choice input');
|
||||
var $incrementInput = $form.find('.increment_choice input');
|
||||
var $daysInput = $form.find('.days_choice input');
|
||||
var isHook = $form.hasClass('game_config_hook');
|
||||
var $ratings = $form.find('.ratings > div');
|
||||
var toggleButtons = function() {
|
||||
|
@ -1206,7 +1208,7 @@ var storage = {
|
|||
}
|
||||
$form.find('div.buttons').buttonset().disableSelection();
|
||||
$form.find('button.submit').button().disableSelection();
|
||||
$timeInput.add($incrementInput).each(function() {
|
||||
$timeInput.add($incrementInput).add($daysInput).each(function() {
|
||||
var $input = $(this),
|
||||
$value = $input.siblings('span'),
|
||||
time;
|
||||
|
|
|
@ -525,7 +525,7 @@ div.game_config input[type="text"] {
|
|||
div.game_config .variants {
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
div.game_config .variants select {
|
||||
div.game_config select {
|
||||
font-weight: bold;
|
||||
}
|
||||
div.game_config .fen_position {
|
||||
|
|
Loading…
Reference in a new issue