tweak message view (fixes lichess-org/talk#31)
This commit is contained in:
parent
619d7b0264
commit
4915f8bc56
|
@ -77,8 +77,7 @@ lichess.insight = LichessInsight(document.getElementById('insight'), ${safeJsonV
|
|||
def forbidden(u: User)(implicit ctx: Context) =
|
||||
views.html.site.message(
|
||||
title = s"${u.username}'s chess insights are protected",
|
||||
back = true,
|
||||
icon = "7".some
|
||||
back = routes.User.show(u.id).url.some
|
||||
)(
|
||||
p("Sorry, you cannot see ", userLink(u), "'s chess insights."),
|
||||
br,
|
||||
|
|
|
@ -6,22 +6,25 @@ import lila.app.templating.Environment._
|
|||
import lila.app.ui.ScalatagsTemplate._
|
||||
import lila.user.User
|
||||
|
||||
import controllers.routes
|
||||
|
||||
object message {
|
||||
|
||||
def apply(
|
||||
title: String,
|
||||
back: Boolean = true,
|
||||
back: Option[String] = None,
|
||||
icon: Option[String] = None,
|
||||
moreCss: Option[Frag] = None
|
||||
)(message: Modifier*)(implicit ctx: Context) =
|
||||
views.html.base.layout(title = title, moreCss = ~moreCss) {
|
||||
main(cls := "box box-pad")(
|
||||
h1(cls := List("text" -> icon.isDefined), dataIcon := icon)(title),
|
||||
p(message),
|
||||
br,
|
||||
back option embedJsUnsafe {
|
||||
"""if (document.referrer) document.write('<a class="button text" data-icon="I" href="' + document.referrer + '">Go Back</a>');"""
|
||||
}
|
||||
h1(dataIcon := icon ifTrue back.isEmpty, cls := List("text" -> (icon.isDefined && back.isEmpty)))(
|
||||
back map { url =>
|
||||
a(href := url, dataIcon := "I", cls := "text")
|
||||
},
|
||||
title
|
||||
),
|
||||
p(message)
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -40,13 +43,12 @@ object message {
|
|||
def privateStudy(ownerId: User.ID)(implicit ctx: Context) =
|
||||
apply(
|
||||
title = s"${usernameOrId(ownerId)}'s study",
|
||||
icon = "4".some
|
||||
back = routes.Study.allDefault(1).url.some
|
||||
)("Sorry! This study is private, you cannot access it.")
|
||||
|
||||
def streamingMod(implicit ctx: Context) = apply("Disabled while streaming") {
|
||||
frag(
|
||||
"This moderation feature is disabled while streaming,",
|
||||
br,
|
||||
"This moderation feature is disabled while streaming, ",
|
||||
"to avoid leaking sensible information."
|
||||
)
|
||||
}
|
||||
|
@ -54,13 +56,13 @@ object message {
|
|||
def challengeDenied(msg: String)(implicit ctx: Context) =
|
||||
apply(
|
||||
title = trans.challengeToPlay.txt(),
|
||||
icon = "j".some
|
||||
back = routes.Lobby.home.url.some
|
||||
)(msg)
|
||||
|
||||
def insightNoGames(u: User)(implicit ctx: Context) =
|
||||
apply(
|
||||
title = s"${u.username} has not played a rated game yet!",
|
||||
icon = "7".some
|
||||
back = routes.User.show(u.id).url.some
|
||||
)(
|
||||
frag(
|
||||
"Before using chess insights,",
|
||||
|
|
|
@ -12,7 +12,6 @@ object bits {
|
|||
views.html.site.message(
|
||||
title = "Become a lichess streamer",
|
||||
icon = Some(""),
|
||||
back = false,
|
||||
moreCss = cssTag("streamer.form").some
|
||||
)(
|
||||
postForm(cls := "streamer-new", action := routes.Streamer.create)(
|
||||
|
|
|
@ -11,8 +11,7 @@ object clone {
|
|||
def apply(s: lila.study.Study)(implicit ctx: Context) =
|
||||
views.html.site.message(
|
||||
title = s"Clone ${s.name}",
|
||||
icon = Some("4"),
|
||||
back = false
|
||||
icon = Some("4")
|
||||
) {
|
||||
postForm(action := routes.Study.cloneApply(s.id.value))(
|
||||
p("This will create a new private study with the same chapters."),
|
||||
|
|
|
@ -20,7 +20,7 @@ object create {
|
|||
views.html.site.message(
|
||||
title = trans.toStudy.txt(),
|
||||
icon = Some("4"),
|
||||
back = true,
|
||||
back = data.fenStr.map(routes.Editor.load(_).url),
|
||||
moreCss = cssTag("study.create").some
|
||||
) {
|
||||
div(cls := "study-create")(
|
||||
|
|
Loading…
Reference in a new issue