Merge pull request #9536 from kraktus/click-to-note-sb

Click to note in communication page in inquiry
andresrcom-add-students-to-teams
Thibault Duplessis 2021-08-06 19:01:12 +02:00 committed by GitHub
commit c92a4ef760
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 5 deletions

View File

@ -102,7 +102,7 @@ object communication {
else
ul(cls := "public_chats")(
publicLines.reverse.map { line =>
li(
li(cls := "line author")(
line.date.fold[Frag]("[OLD]")(momentFromNowOnce),
" ",
line.from.map {
@ -113,8 +113,8 @@ object communication {
case PublicSource.Study(id) => a(href := routes.Study.show(id))("Study #", id)
case PublicSource.Swiss(id) => views.html.swiss.bits.link(lila.swiss.Swiss.Id(id))
},
" ",
highlightBad(line.text)
nbsp,
span(cls := "message")(highlightBad(line.text))
)
}
),
@ -145,7 +145,7 @@ object communication {
)(
userIdLink(line.userIdMaybe, withOnline = false, withTitle = false),
nbsp,
highlightBad(line.text)
span(cls := "message")(highlightBad(line.text))
)
}
)
@ -164,7 +164,7 @@ object communication {
tr(cls := List("post" -> true, "author" -> author))(
td(momentFromNowOnce(msg.date)),
td(strong(if (author) u.username else convo.contact.name)),
td(highlightBad(msg.text))
td(cls := "message")(highlightBad(msg.text))
)
}
)

View File

@ -37,4 +37,13 @@ $(function () {
.replaceAll(/(?:https:\/\/)?lichess\.org\/([\w\/]+)/g, '<a href="/$1">lichess.org/$1</a>')
);
});
$('#communication').on('click', '.line.author, .post.author', function () {
// Need to take username from the communcation page so that when being in inquiry for user A and checking communication of user B
// the notes cannot be mistakenly attributed to user A.
const username = $('#communication').find('.title').text().split(' ')[0];
const message = $(this).find('.message').text();
const storedNote = noteStore.get();
noteStore.set((storedNote ? storedNote + ', ' : '') + `${username}: "${message}"`);
});
});

View File

@ -93,9 +93,14 @@
padding: 0 0.5em;
}
.public_chats .line,
.player_chats .line.author,
.threads .post.author {
opacity: 1;
cursor: pointer;
&:hover {
background: fade-out($c-accent, 0.8);
}
}
.thread {