Revert "Remove JS link on Challenge Notif"

This reverts commit b18b8478be.
This commit is contained in:
Thibault Duplessis 2014-11-25 23:20:50 +01:00
parent 7b99f658d3
commit 1ee636d922
4 changed files with 32 additions and 65 deletions

View file

@ -203,32 +203,6 @@ trait UserHelper { self: I18nHelper with StringHelper =>
Html(s"""<a$dataIcon $klass $href>$space$titleS$content</a>""")
}
def userSpan(
user: User,
cssClass: Option[String] = None,
withOnline: Boolean = true,
withPowerTip: Boolean = true,
withTitle: Boolean = true,
withBestRating: Boolean = false,
withPerfRating: Option[PerfType] = None,
text: Option[String] = None) = Html {
val klass = userClass(user.id, cssClass, withOnline, withPowerTip)
val content = text | user.username
val titleS = if (withTitle) titleTag(user.title) else ""
val space = if (withOnline) "&nbsp;" else ""
val dataIcon = if (withOnline) """ data-icon="r"""" else ""
val rating = withPerfRating map (_.key) flatMap user.perfs.ratingOf map { rating =>
s"&nbsp;($rating)"
} getOrElse {
withBestRating ?? {
user.perfs.bestPerf ?? {
case (pt, perf) => s"&nbsp;${showPerfRating(pt, perf, "hint--bottom")}"
}
}
}
s"""<span$dataIcon $klass>$space$titleS$content$rating</span>"""
}
private def userHref(username: String, params: String = "") =
s"""href="${routes.User.show(username)}$params""""

View file

@ -1,28 +1,26 @@
@(g: Game, user: User)
<div id="challenge_reminder_@g.id" data-href="@routes.Round.watcher(g.id, "white")" class="notification challenge_reminder">
<div class="actions">
<a class="action decline" href="@routes.Setup.decline(g.id)" data-icon="L"></a>
<div class="inner">
<div class="actions">
<a class="action decline" href="@routes.Setup.decline(g.id)" data-icon="L"></a>
</div>
<div class="game_infos" data-icon="@g.perfType match {
case _ if g.fromPosition => {*}
case Some(p) => {@p.iconChar}
case _ => {8}
}">
<div class="header">
@userLink(user, withOnline = false, withPerfRating = g.perfType, cssClass = "disabled".some)<br />
<span class="setup">
@g.clock.map(_.show).getOrElse {∞} •
@if(g.variant.exotic) {
@(if (g.variant == chess.Variant.KingOfTheHill) g.variant.shortName else g.variant.name)
} else {
@g.perfType.map(_.name)
} • @g.rated.fold(trans.rated.en(), trans.casual.en())
</span>
</div>
</div>
</div>
<a href="@routes.Round.watcher(g.id, "white")">
<span class="inner">
<span class="game_infos" data-icon="@g.perfType match {
case _ if g.fromPosition => {*}
case Some(p) => {@p.iconChar}
case _ => {8}
}">
<span class="header">
@userSpan(user, withOnline = false, withPerfRating = g.perfType, withPowerTip = false)
<span class="setup">
@g.clock.map(_.show).getOrElse {∞} •
@if(g.variant.exotic) {
@(if (g.variant == chess.Variant.KingOfTheHill) g.variant.shortName else g.variant.name)
} else {
@g.perfType.map(_.name)
} • @g.rated.fold(trans.rated.en(), trans.casual.en())
</span>
</span>
</span>
</span>
</a>
</div>

View file

@ -175,6 +175,10 @@ var storage = {
nbChallengesAdd();
$('#challenge_notifications').append(data.html);
$notif = $('#' + htmlId);
$notif.add($notif.find("a.disabled")).on('click', function() {
location.href = $notif.data('href');
return false;
});
declineListener($notif.find('a.decline'));
$('body').trigger('lichess.content_loaded');
if (!storage.get('challenge-' + data.id)) {

View file

@ -1007,18 +1007,14 @@ body.offline #nb_connected_players {
text-align: center;
}
#challenge_notifications div.notification {
cursor: pointer;
border-top: 1px solid #c0c0c0;
padding: 6px 8px 7px 8px;
position: relative;
}
#challenge_notifications div.notification:hover {
background-color: #f0f0f0;
}
#challenge_notifications span.inner {
display: block;
width: calc(100% - 15px);
height: 100%;
padding: 6px 8px 7px 8px;
}
#challenge_notifications,
#notifications {
position: absolute;
@ -1044,10 +1040,12 @@ body.offline #nb_connected_players {
line-height: inherit;
height: auto;
}
#challenge_notifications > div a.close,
#notifications > div a.close {
text-decoration: none;
float: right;
}
#challenge_notifications > div a.close:hover,
#notifications > div a.close:hover {
font-weight: bold;
}
@ -1056,27 +1054,20 @@ body.offline #nb_connected_players {
}
#challenge_notifications .setup {
text-transform: uppercase;
display: block;
margin-left: 37px;
margin-bottom: -18px;
}
#challenge_notifications .actions,
#notifications .actions {
position: relative;
float: right;
z-index: 4;
text-decoration: none;
}
#challenge_notifications a {
text-decoration: none;
}
#challenge_notifications a,
#notifications a {
font-weight: bold;
text-decoration: none;
}
#challenge_notifications .actions a {
font-weight: bold;
margin-right: 5px;
}
#challenge_notifications .actions a,
#notifications .actions a {
margin-left: 10px;
}