tweak notes
This commit is contained in:
parent
a68f0d652f
commit
ff15ea4f28
|
@ -137,7 +137,7 @@ object Round extends LilaController with TheftPrevention {
|
|||
implicit val req = ctx.body
|
||||
Form(single("text" -> text)).bindFromRequest.fold(
|
||||
err => fuccess(BadRequest),
|
||||
text => Env.round.noteApi.set(gameId, me.id, text take 10000))
|
||||
text => Env.round.noteApi.set(gameId, me.id, text.trim take 10000))
|
||||
}
|
||||
|
||||
private def side(pov: Pov, isPlayer: Boolean)(implicit ctx: Context) =
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
</div>
|
||||
@if(withNotes) {
|
||||
<div class="notes">
|
||||
<textarea placeholder="Type notes here."></textarea>
|
||||
<textarea placeholder="Type private notes here"></textarea>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
|
|
@ -11,10 +11,13 @@ final class NoteApi(coll: Coll) {
|
|||
_ flatMap (_.getAs[String]("t")) getOrElse ""
|
||||
}
|
||||
|
||||
def set(gameId: String, userId: String, text: String) = coll.update(
|
||||
BSONDocument("_id" -> makeId(gameId, userId)),
|
||||
BSONDocument("$set" -> BSONDocument("t" -> text)),
|
||||
upsert = true).void
|
||||
def set(gameId: String, userId: String, text: String) = {
|
||||
if (text.isEmpty) coll.remove(BSONDocument("_id" -> makeId(gameId, userId)))
|
||||
else coll.update(
|
||||
BSONDocument("_id" -> makeId(gameId, userId)),
|
||||
BSONDocument("$set" -> BSONDocument("t" -> text)),
|
||||
upsert = true)
|
||||
}.void
|
||||
|
||||
private def makeId(gameId: String, userId: String) = s"$gameId$userId"
|
||||
}
|
||||
|
|
|
@ -974,7 +974,7 @@ var storage = {
|
|||
|
||||
// Toggle Notes/Chat display
|
||||
$panels = self.element.find('div.chat_panels > div');
|
||||
$parent.on('click', 'a', function() {
|
||||
$parent.find('.chat_menu').on('click', 'a', function() {
|
||||
var panel = $(this).data('panel');
|
||||
$(this).siblings('.active').removeClass('active').end().addClass('active');
|
||||
$panels.removeClass('active').filter('.' + panel).addClass('active');
|
||||
|
|
Loading…
Reference in a new issue