link game setup FEN to board editor

pull/83/head
Thibault Duplessis 2013-09-14 18:37:56 +02:00
parent 8a34b28543
commit 68db2ee7fe
4 changed files with 9 additions and 6 deletions

View File

@ -1,6 +1,6 @@
@(field: play.api.data.Field, strict: Boolean)(implicit ctx: Context)
<div class="fen_position optional_config" data-validate-url="@routes.Setup.validateFen@strict.fold("?strict=1", "")">
<div class="fen_position optional_config" data-validate-url="@routes.Setup.validateFen@{strict.??("?strict=1")}">
@base.input(field, placeholder=trans.pasteTheFenStringHere.str().some)
<div class="preview"></div>
<a class="board_editor" href="@routes.Editor.index(~field.value)"><span class="preview"></span>@trans.boardEditor()</a>
</div>

View File

@ -1921,15 +1921,19 @@ var storage = {
var validateFen = _.debounce(function() {
$fenInput.removeClass("success failure");
if ($fenInput.val()) {
var fen = $fenInput.val();
if (fen) {
$.ajax({
url: $fenInput.parent().data('validate-url'),
data: {
fen: $fenInput.val()
fen: fen
},
success: function(data) {
$fenInput.addClass("success");
$fenPosition.find('.preview').html(data);
$fenPosition.find('a.board_editor').each(function() {
$(this).attr('href', $(this).attr('href').replace(/editor\/.+$/, "editor/" + fen));
});
$('body').trigger('lichess.content_loaded');
$.centerOverboard();
},

View File

@ -1389,7 +1389,7 @@ div.game_config input#fen.failure {
color: #aa0000;
}
div.game_config .fen_position .mini_board {
margin: 10px auto;
margin: 10px auto 0 auto;
}
div.game_config .time_choice, div.game_config .increment_choice, div.game_config .elo_range_config {
padding-bottom: 1em;

1
todo
View File

@ -60,7 +60,6 @@ many tv ideas (answer)
http://i.imgur.com/ZSi90k0.jpg
separate games in spectator chat
real board editor save
edit board from play fen
clickable mistakes list in analysis
FEN/editor castle/enpassant https://github.com/ornicar/lila/issues/42 white/black to play
stupid team forum slug http://ru.lichess.org/forum/team-4epa250h