more cg board helper integration

pull/5118/head
Thibault Duplessis 2019-05-13 16:43:18 +07:00
parent 78a0bd1cd7
commit 3ea26a36f3
9 changed files with 10 additions and 11 deletions

View File

@ -13,6 +13,7 @@ trait ChessgroundHelper {
private val cgHelper = tag("cg-helper")
private val cgContainer = tag("cg-container")
val cgBoard = tag("cg-board")
val cgWrapContent = cgHelper(cgContainer(cgBoard))
def chessground(board: Board, orient: Color, lastMove: List[Pos] = Nil)(implicit ctx: Context): Frag = wrap {
cgBoard {

View File

@ -249,7 +249,7 @@ trait GameHelper { self: I18nHelper with UserHelper with AiHelper with StringHel
dataColor := pov.color.name,
dataFen := Forsyth.exportBoard(game.board),
dataLastmove := ~game.lastMoveKeys
)(cgBoard)
)(cgWrapContent)
}
def gameFenNoCtx(pov: Pov, tv: Boolean = false, blank: Boolean = false): Frag = {
@ -267,7 +267,7 @@ trait GameHelper { self: I18nHelper with UserHelper with AiHelper with StringHel
dataFen := Forsyth.exportBoard(pov.game.board),
dataLastmove := ~pov.game.lastMoveKeys,
target := blank.option("_blank")
)(cgBoard)
)(cgWrapContent)
}
def challengeTitle(c: lila.challenge.Challenge)(implicit ctx: UserContext) = {

File diff suppressed because one or more lines are too long

View File

@ -171,5 +171,5 @@ function makeCg(preview: ChapterPreview): VNode {
vnode.data!.cp = old.data!.cp;
}
}
}, [h('cg-board')])
})
}

View File

@ -13,7 +13,7 @@ function miniGame(game) {
config: function(el, isUpdate) {
if (!isUpdate) lichess.parseFen($(el));
}
}, m('cg-board')),
}),
m('span.vstext', [
m('span.vstext__pl', [
game.user1.name,

View File

@ -35,7 +35,7 @@ export default function(ctrl: LobbyController) {
});
}
}
}, [h('cg-board')]),
}),
h('span.meta', [
pov.opponent.ai ? ctrl.trans('aiNameLevelAiLevel', 'Stockfish', pov.opponent.ai) : pov.opponent.username,
h('span.indicator',

View File

@ -9,7 +9,7 @@ export default function(ctrl) {
insert: vnode => ctrl.ground(Chessground((vnode.elm as HTMLElement), makeConfig(ctrl))),
destroy: _ => ctrl.ground().destroy()
}
}, [ h('cg-board') ]);
});
}
function makeConfig(ctrl): CgConfig {

View File

@ -103,7 +103,5 @@ export function boardOrientation(data: RoundData, flip: boolean): Color {
export function render(ctrl: RoundController) {
return h('div.cg-wrap', {
hook: util.onInsert(el => ctrl.setChessground(Chessground(el, makeConfig(ctrl))))
}, [
h('cg-board')
]);
});
};

View File

@ -21,7 +21,7 @@ function miniPairing(ctrl) {
config: function(el, isUpdate) {
if (!isUpdate) lichess.parseFen($(el));
}
}, m('div.cg-wrap', m('cg-board'))),
}, m('div.cg-wrap')),
m('span.vstext', [
m('span.vstext__pl', [
util.playerVariant(ctrl, player).name,