improve report thanks page - closes #1468

pull/1502/head
Thibault Duplessis 2016-01-21 15:50:53 +07:00
parent 79d6f42e7b
commit 4d19353fd6
4 changed files with 34 additions and 12 deletions

View File

@ -43,15 +43,15 @@ object Report extends LilaController {
BadRequest(html.report.form(err, user, captcha))
}
},
data => api.create(data, me) map { thread =>
Redirect(routes.Report.thanks)
data => api.create(data, me) map { report =>
Redirect(routes.Report.thanks(data.user.username))
})
}
def thanks = Auth { implicit ctx =>
def thanks(reported: String) = Auth { implicit ctx =>
implicit me =>
fuccess {
html.report.thanks()
Env.relation.api.blocks(me.id, reported) map { blocked =>
html.report.thanks(reported, blocked)
}
}
}

View File

@ -45,7 +45,6 @@
@errMsg(form("text"))
</div>
@base.captcha(form("move"), form("gameId"), captcha)
@errMsg(form)
<div class="actions">
<input class="send button" type="submit" value="@trans.send()" />
<a class="cancel" href="@routes.Lobby.home()">@trans.cancel()</a>

View File

@ -1,16 +1,39 @@
@()(implicit ctx: Context)
@(userId: String, blocked: Boolean)(implicit ctx: Context)
@title = @{ "Thanks for the report" }
@site.layout(title = title, moreCss = cssTag("report.css")) {
@moreJs = {
@embedJs {
$('button.report-block').one('click', function() {
var $button = $(this);
$button.find('span').text('Blocking...');
$.ajax({
url:$button.data('action'),
method:'post',
success: function() {
$button.find('span').text('Blocked!');
}
});
});
}
}
@site.layout(title = title, moreCss = cssTag("report.css"), moreJs = moreJs) {
<div class="content_box small_box">
<h1 class="lichess_title">@title</h1>
<p>The moderators will review it very soon, and take appropriate action.</p>
<br /><br /><br />
@if(!blocked) {
In the mean time, you can block this user:
<button data-action="@routes.Relation.block(userId)" class="report-block icon button hint--top inline" type="submit" data-hint="@trans.block()">
<span class="text" data-icon="k">Block @usernameOrId(userId)</span>
</button>
<br /><br /><br />
}
<p>
<br />
<br />
<a href="@routes.Lobby.home">Return to lichess homepage</a>
<a href="@routes.Lobby.home">Return to lichess homepage</a>
</p>
</div>
}

View File

@ -335,7 +335,7 @@ GET /monitor/status controllers.Monitor.statusParam
# Report
GET /report controllers.Report.form
POST /report controllers.Report.create
GET /report/thanks controllers.Report.thanks
GET /report/thanks controllers.Report.thanks(reported: String)
GET /report/list controllers.Report.list
POST /report/:id/process controllers.Report.process(id: String)