show more info on challenge join page, and allow to decline it
This commit is contained in:
parent
79c6583bb3
commit
48fb6eb5bb
|
@ -80,10 +80,12 @@ object Round extends LilaController with TheftPrevention {
|
|||
}
|
||||
|
||||
private def join(pov: Pov)(implicit ctx: Context): Fu[SimpleResult] =
|
||||
GameRepo initialFen pov.gameId zip env.version(pov.gameId) map {
|
||||
case (fen, version) ⇒ Ok(html.setup.join(
|
||||
pov, version, Env.setup.friendConfigMemo get pov.game.id, fen))
|
||||
}
|
||||
GameRepo initialFen pov.gameId zip
|
||||
env.version(pov.gameId) zip
|
||||
((pov.player.userId orElse pov.opponent.userId) ?? UserRepo.byId) map {
|
||||
case ((fen, version), opponent) ⇒ Ok(html.setup.join(
|
||||
pov, opponent, version, Env.setup.friendConfigMemo get pov.game.id, fen))
|
||||
}
|
||||
|
||||
def tableWatcher(gameId: String, color: String) = Open { implicit ctx ⇒
|
||||
OptionOk(GameRepo.pov(gameId, color)) { html.round.table.watch(_) }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@(pov: Pov, version: Int, config: Option[lila.setup.FriendConfig], initialFen: Option[String])(implicit ctx: Context)
|
||||
@(pov: Pov, opponentUser: Option[User], version: Int, config: Option[lila.setup.FriendConfig], initialFen: Option[String])(implicit ctx: Context)
|
||||
|
||||
@import pov._
|
||||
|
||||
|
@ -11,7 +11,11 @@ signedJs = routes.Round.signedJs(pov.gameId).toString.some) {
|
|||
<div class="lichess_board_wrap">
|
||||
@color.fold(board.white(), board.black())
|
||||
<div class="lichess_overboard auto_center joining">
|
||||
@trans.joinTheGame()
|
||||
@opponentUser.map { u =>
|
||||
@userLink(u, withOnline = false)
|
||||
}.getOrElse {
|
||||
@User.anonymous
|
||||
}
|
||||
@config.map { c =>
|
||||
<p class="explanations">
|
||||
@trans.variant(): @variantName(c.variant)<br />
|
||||
|
|
|
@ -361,17 +361,32 @@ var storage = {
|
|||
}
|
||||
},
|
||||
challengeReminder: function(data) {
|
||||
if (!storage.get('challenge-refused-' + data.id) && !$('div.lichess_overboard.joining').length) {
|
||||
if (!storage.get('challenge-refused-' + data.id)) {
|
||||
var $overboard = $('div.lichess_overboard.joining');
|
||||
var declineListener = function($a, callback) {
|
||||
return $a.click(function() {
|
||||
$.post($(this).attr("href"));
|
||||
storage.set('challenge-refused-' + data.id, 1);
|
||||
$('#challenge_reminder').remove();
|
||||
if ($.isFunction(callback)) callback();
|
||||
return false;
|
||||
});
|
||||
};
|
||||
if ($overboard.length) {
|
||||
if (!$overboard.find('a.decline').length)
|
||||
$overboard.find('form').append(
|
||||
declineListener($(data.html).find('a.decline'), function() {
|
||||
location.href = "/";
|
||||
})
|
||||
);
|
||||
return;
|
||||
}
|
||||
$('#challenge_reminder').each(function() {
|
||||
clearTimeout($(this).data('timeout'));
|
||||
$(this).remove();
|
||||
});
|
||||
$('#notifications').append(data.html).find("a.decline").click(function() {
|
||||
$.post($(this).attr("href"));
|
||||
storage.set('challenge-refused-' + data.id, 1);
|
||||
$('#challenge_reminder').remove();
|
||||
return false;
|
||||
});
|
||||
$('#notifications').append($(data.html));
|
||||
declineListener($('#notifications a.decline'));
|
||||
$('#challenge_reminder').data('timeout', setTimeout(function() {
|
||||
$('#challenge_reminder').remove();
|
||||
}, 3000));
|
||||
|
@ -2582,9 +2597,9 @@ var storage = {
|
|||
clearShortcutSquares("A", "1234567");
|
||||
var $game = $("#GameBoard");
|
||||
$game.mousewheel(function(event) {
|
||||
if(event.deltaY == 1) {
|
||||
if (event.deltaY == 1) {
|
||||
$('#forwardButton').click();
|
||||
} else if(event.deltaY == -1) {
|
||||
} else if (event.deltaY == -1) {
|
||||
$('#backButton').click();
|
||||
}
|
||||
event.stopPropagation();
|
||||
|
|
|
@ -151,8 +151,6 @@ div.lichess_overboard a.close:hover {
|
|||
}
|
||||
div.lichess_overboard p.explanations {
|
||||
margin-top: 1em;
|
||||
border-top: 1px solid #ccc;
|
||||
padding-top:1em;
|
||||
font-size: 12px;
|
||||
line-height: 1.4em;
|
||||
text-align: left;
|
||||
|
|
|
@ -1851,6 +1851,10 @@ div.lichess_overboard.joining input.submit {
|
|||
margin-top: 1em;
|
||||
padding: 0.6em 1em;
|
||||
}
|
||||
div.lichess_overboard.joining a.decline {
|
||||
display: block;
|
||||
margin-top: 1em;
|
||||
}
|
||||
div.lichess_overboard.joining .mini_board {
|
||||
margin: 10px auto;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ body.dark input, body.dark textarea {
|
|||
background: #1a1a1a;
|
||||
color: #8a8a8a;
|
||||
}
|
||||
body.dark #top, body.dark #nb_connected_players, body.dark #reconnecting, body.dark #connecting, body.dark div.lichess_chat_top, body.dark div.lichess_chat .lichess_messages, body.dark div.undertable_top, body.dark div.undertable_inner, body.dark div.undertable td, body.dark div.lichess_table .lichess_button, body.dark div.lichess_chat form input, body.dark div.lichess_board_wrap, body.dark #translation_call, body.dark div.footer_wrap, body.dark div.game_config .optional_config, body.dark .ui-state-default, body.dark .ui-widget-content, body.dark div.lichess_goodies div.box, body.dark div.lichess_table, body.dark div.lichess_separator, body.dark div.undergame_box, body.dark div.game_more div.more_top, body.dark div.clock, body.dark .button, body.dark #GameText, body.dark #tournament_side, body.dark #GameBoard table.boardTable, body.dark div.shortcuts .title, body.dark div.content_box, body.dark div.content_box_top, body.dark div.content_box_top a, body.dark div.content_box_inter, body.dark div.content_box_inter a.active, body.dark #site_header div.side_menu a.active, body.dark div.game_row, body.dark form.search_user_form input, body.dark div.user_show div.boxed_data, body.dark #lichess_forum div.post, body.dark #lichess_forum textarea, body.dark #lichess_forum form.wide input, body.dark #lichess_message tr, body.dark #lichess_message div.thread_message, body.dark #lichess_message textarea, body.dark #lichess_message input, body.dark .content_box form input, body.dark div.progressbar, body.dark form.translation_form div.messages, body.dark form.translation_form input, body.dark div.locale_menu a, body.dark #adv_chart, body.dark #top .dropdown, body.dark div.lichess_overboard p.explanations, body.dark div.search_status, body.dark table.slist, body.dark table.slist thead th, body.dark #notifications > div, body.dark form.wide input[type="text"], body.dark form.wide textarea, body.dark #team .team-left, body.dark #team .team-right, body.dark #team h2, body.dark .leaderboard_title, body.dark #friend_box, body.dark #friend_box .title, body.dark div.user_show div.mod_zone, body.dark div.user_show div.user-infos, body.dark div.game_config input[type="text"], body.dark #powerTip, body.dark #powerTip > .title, body.dark #hooks_table th, body.dark #hooks_table td, body.dark #hooks_wrap > div.tabs > a, body.dark #hooks_chart > div.grid {
|
||||
body.dark #reconnecting, body.dark .mini_board, body.dark #nb_connected_players, body.dark div.lichess_chat_top, body.dark div.lichess_chat .lichess_messages, body.dark div.undertable_top, body.dark div.undertable_inner, body.dark div.undertable td, body.dark div.lichess_table .lichess_button, body.dark div.lichess_chat form input, body.dark div.lichess_board_wrap, body.dark #translation_call, body.dark div.footer_wrap, body.dark div.game_config .optional_config, body.dark .ui-state-default, body.dark .ui-widget-content, body.dark div.lichess_goodies div.box, body.dark div.lichess_table, body.dark div.lichess_separator, body.dark div.undergame_box, body.dark div.game_more div.more_top, body.dark div.clock, body.dark .button, body.dark #GameText, body.dark #tournament_side, body.dark #GameBoard table.boardTable, body.dark div.shortcuts .title, body.dark div.content_box, body.dark div.content_box_top, body.dark div.content_box_top a, body.dark div.content_box_inter, body.dark div.content_box_inter a.active, body.dark #site_header div.side_menu a.active, body.dark div.game_row, body.dark form.search_user_form input, body.dark div.user_show div.boxed_data, body.dark #lichess_forum div.post, body.dark #lichess_forum textarea, body.dark #lichess_forum form.wide input, body.dark #lichess_message tr, body.dark #lichess_message div.thread_message, body.dark #lichess_message textarea, body.dark #lichess_message input, body.dark .content_box form input, body.dark div.progressbar, body.dark form.translation_form div.messages, body.dark form.translation_form input, body.dark div.locale_menu a, body.dark #adv_chart, body.dark #top .dropdown, body.dark div.search_status, body.dark table.slist, body.dark table.slist thead th, body.dark #notifications > div, body.dark form.wide input[type="text"], body.dark form.wide textarea, body.dark #team .team-left, body.dark #team .team-right, body.dark #team h2, body.dark .leaderboard_title, body.dark #friend_box, body.dark #friend_box .title, body.dark div.user_show div.mod_zone, body.dark div.user_show div.user-infos, body.dark div.game_config input[type="text"], body.dark #powerTip, body.dark #powerTip > .title, body.dark #hooks_table th, body.dark #hooks_table td, body.dark #hooks_wrap > div.tabs > a, body.dark #hooks_chart > div.grid {
|
||||
border-color: #3d3d3d;
|
||||
}
|
||||
body.dark #timeline, body.dark #timeline > .entry {
|
||||
|
@ -93,9 +93,6 @@ body.dark #site_header div.side_menu a.active {
|
|||
background: #2b2b2b;
|
||||
box-shadow: -3px 0 5px #505050;
|
||||
}
|
||||
body.dark .mini_board {
|
||||
box-shadow: none;
|
||||
}
|
||||
body.dark div.game_row:nth-child(odd), body.dark #lichess_forum table.forum_table tr:nth-child(odd), body.dark #lichess_message tr:nth-child(even), body.dark div.user_show div.boxed_data, body.dark div.content_box_inter, body.dark #GameText tr:nth-child(even), body.dark table.slist tbody tr:nth-child(even), body.dark #team .forum li:nth-child(odd), body.dark table.translations tbody tr:nth-child(odd), body.dark form.translation_form div.message:nth-child(even), body.dark div.content_box table.datatable tr:nth-child(odd), body.dark div.game_config .optional_config, body.dark div.search_status, body.dark #friend_box, body.dark #powerTip {
|
||||
background: #343434;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue