open explorer game with the same orientation
parent
05f08aaab4
commit
ba8bb24f01
|
@ -39,7 +39,7 @@ object Importer extends LilaController {
|
|||
)
|
||||
}
|
||||
|
||||
def masterGame(id: String) = Open { implicit ctx =>
|
||||
def masterGame(id: String, orientation: String) = Open { implicit ctx =>
|
||||
lila.game.GameRepo game id flatMap {
|
||||
case Some(game) => fuccess(Redirect(routes.Round.watcher(game.id, game.firstPlayer.color.name)))
|
||||
case _ => Env.explorer.fetchPgn(id) flatMap {
|
||||
|
@ -49,7 +49,7 @@ object Importer extends LilaController {
|
|||
user = ctx.userId,
|
||||
forceId = id.some) map { game =>
|
||||
Redirect {
|
||||
val url = routes.Round.watcher(game.id, game.firstPlayer.color.name).url
|
||||
val url = routes.Round.watcher(game.id, orientation).url
|
||||
s"$url#${~getInt("ply")}"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -320,7 +320,7 @@ DELETE /notification/$id<\w{8}> controllers.Notification.remove(id)
|
|||
# Paste
|
||||
GET /paste controllers.Importer.importGame
|
||||
POST /import controllers.Importer.sendGame
|
||||
GET /import/master/$id<\w{8}> controllers.Importer.masterGame(id: String)
|
||||
GET /import/master/$id<\w{8}>/:color controllers.Importer.masterGame(id: String, color: String)
|
||||
|
||||
# Edit
|
||||
GET /editor/*urlFen controllers.Editor.load(urlFen: String)
|
||||
|
|
|
@ -85,10 +85,11 @@ function showGameTable(ctrl, type, games) {
|
|||
onclick: function(e) {
|
||||
var $tr = $(e.target).parents('tr');
|
||||
if (!$tr.length) return;
|
||||
var orientation = ctrl.chessground.data.orientation;
|
||||
if (ctrl.explorer.config.data.db.selected() === 'lichess')
|
||||
window.open('/' + $tr.data('id') + '#' + ctrl.vm.step.ply, '_blank');
|
||||
window.open('/' + $tr.data('id') + '/' + orientation + '#' + ctrl.vm.step.ply, '_blank');
|
||||
else
|
||||
window.open('/import/master' + $tr.data('id') + '?ply=' + ctrl.vm.step.ply, '_blank');
|
||||
window.open('/import/master/' + $tr.data('id') + '/' + orientation + '?ply=' + ctrl.vm.step.ply, '_blank');
|
||||
}
|
||||
}, games.map(function(game) {
|
||||
return m('tr', {
|
||||
|
|
Loading…
Reference in New Issue