Merge pull request #5299 from ornicar/mod-public-chat-refresh

Fix auto-reloading of mod/public-chat
pull/5272/head
Thibault Duplessis 2019-07-10 08:26:11 -04:00 committed by GitHub
commit 17a9ab90c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 23 deletions

View File

@ -20,29 +20,13 @@ object publicChat {
) {
main(cls := "page-menu")(
views.html.mod.menu("public-chat"),
div(id := "communication", cls := "page-menu__content public_chat box box-pad")(
h2("Tournament Chats"),
div(cls := "player_chats")(
tourChats.map {
case (tournament, chat) => div(cls := "game")(
a(cls := "title", href := routes.Tournament.show(tournament.id))(tournament.name),
div(cls := "chat")(
chat.lines.filter(_.isVisible).map { line =>
div(cls := "line")(
userIdLink(line.author.toLowerCase.some, withOnline = false, withTitle = false), " ",
richText(line.text)
)
}
)
)
}
),
div(
h2("Simul Chats"),
div(id := "comm-wrap")(
div(id := "communication", cls := "page-menu__content public_chat box box-pad")(
h2("Tournament Chats"),
div(cls := "player_chats")(
simulChats.map {
case (simul, chat) => div(cls := "game")(
a(cls := "title", href := routes.Simul.show(simul.id))(simul.name),
tourChats.map {
case (tournament, chat) => div(cls := "game")(
a(cls := "title", href := routes.Tournament.show(tournament.id))(tournament.name),
div(cls := "chat")(
chat.lines.filter(_.isVisible).map { line =>
div(cls := "line")(
@ -53,6 +37,24 @@ object publicChat {
)
)
}
),
div(
h2("Simul Chats"),
div(cls := "player_chats")(
simulChats.map {
case (simul, chat) => div(cls := "game")(
a(cls := "title", href := routes.Simul.show(simul.id))(simul.name),
div(cls := "chat")(
chat.lines.filter(_.isVisible).map { line =>
div(cls := "line")(
userIdLink(line.author.toLowerCase.some, withOnline = false, withTitle = false), " ",
richText(line.text)
)
}
)
)
}
)
)
)
)

View File

@ -38,7 +38,7 @@ $(function() {
if (!autoRefreshEnabled || document.visibilityState === 'hidden' || autoRefreshOnHold) return;
// Reload only the chat grid portions of the page
$("#lichess").load("/mod/public-chat #communication", onPageReload);
$("#comm-wrap").load("/mod/public-chat #communication", onPageReload);
}, 4000);
});