complete private tournaments implementation

This commit is contained in:
Thibault Duplessis 2013-07-31 12:07:50 +02:00
parent 7cfd75af8a
commit e847931cf8
7 changed files with 23 additions and 13 deletions

View file

@ -108,12 +108,10 @@ object Tournament extends LilaController {
_.fold(tournamentNotFound(ctx).fuccess) { tour
env.forms.joinPassword.bindFromRequest.fold(
err renderJoinPassword(tour, err) map { BadRequest(_) },
password FuRedirect {
env.api.join(tour, me, password.some).fold(
err routes.Tournament.show(tour.id),
_ routes.Tournament.show(tour.id)
)
}
password env.api.join(tour, me, password.some) flatFold (
_ renderJoinPassword(tour, env.forms.joinPassword) map { BadRequest(_) },
_ fuccess(Redirect(routes.Tournament.show(tour.id)))
)
)
}
}

View file

@ -31,7 +31,7 @@
<span class="label">JOINED</span>
} else {
<form class="inline" action="@routes.Tournament.join(tour.id)" method="POST">
<input type="submit" class="submit button" value="Join" />
<button type="submit" class="submit button"><span class="s16 lock">@trans.join()</span></button>
</form>
}
}

View file

@ -7,10 +7,13 @@
@timeago(tour.createdAt)
@tour.password.map { password =>
<br />
@trans.isPrivate()
@if(ctx.userId == tour.createdBy.some) {
(@trans.password(): @tour.password)
}
<span class="s16 lock">
@if(ctx.userId == tour.createdBy.some) {
@trans.password(): @tour.password
} else {
@trans.isPrivate()
}
</span>
}
<br /><br />
<span class="s16 clock">@tour.clock.show</span>,

View file

@ -2,7 +2,7 @@
<h1>@tour.nameT
@if(tour.hasPassword) {
<span class="private">(@trans.isPrivate())</span>
<span class="private s16 lock">@trans.isPrivate()</span>
}
</h1>
@form
@ -30,7 +30,7 @@
</form>
} else {
<form class="inline" action="@routes.Tournament.join(tour.id)" method="POST">
<input type="submit" class="submit button strong" value="@trans.join()" />
<button type="submit" class="submit button strong"><span class="s16 lock">@trans.join()</span></button>
</form>
}
</th>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View file

@ -974,6 +974,9 @@ span.s16.clock {
.s16.tdown {
background-position: 0 -448px;
}
.s16.lock {
background-position: 0 -480px;
}
.user_link.white, .user_link.black, .user_link.online, .user_link.offline {
line-height: 16px;
display: block;

View file

@ -101,6 +101,12 @@
padding: 3px 5px;
}
.s16.lock {
display: inline-block;
height: 16px;
line-height: 16px;
}
#tournament_side {
float: right;
width: 246px;