directly render scalatags frag
parent
bbb032acc5
commit
6078402611
|
@ -36,11 +36,6 @@ private[controllers] trait LilaController
|
|||
|
||||
protected implicit def LilaHtmlToResult(content: Html): Result = Ok(content)
|
||||
|
||||
protected implicit def contentTypeOfFrag(implicit codec: Codec): ContentTypeOf[Frag] =
|
||||
ContentTypeOf[Frag](Some(ContentTypes.HTML))
|
||||
protected implicit def writeableOfFrag(implicit codec: Codec): Writeable[Frag] =
|
||||
Writeable(frag => codec.encode(frag.render))
|
||||
|
||||
protected implicit def LilaScalatagsToHtml(tags: scalatags.Text.TypedTag[String]): Html = Html(tags.render)
|
||||
|
||||
protected implicit def LilaFragToResult(content: Frag): Result = Ok(content)
|
||||
|
|
|
@ -1,3 +1,14 @@
|
|||
package lila
|
||||
|
||||
package object app extends PackageObject with socket.WithSocket
|
||||
import play.api.http._
|
||||
import play.api.mvc.Codec
|
||||
import scalatags.Text.Frag
|
||||
|
||||
package object app extends PackageObject with socket.WithSocket {
|
||||
|
||||
implicit def contentTypeOfFrag(implicit codec: Codec): ContentTypeOf[Frag] =
|
||||
ContentTypeOf[Frag](Some(ContentTypes.HTML))
|
||||
|
||||
implicit def writeableOfFrag(implicit codec: Codec): Writeable[Frag] =
|
||||
Writeable(frag => codec.encode(frag.render))
|
||||
}
|
||||
|
|
|
@ -9,20 +9,18 @@ import controllers.routes
|
|||
|
||||
object errorPage {
|
||||
|
||||
def apply(ex: Throwable)(implicit ctx: Context) = {
|
||||
layout(
|
||||
title = "Internal server error",
|
||||
responsive = true
|
||||
) {
|
||||
main(cls := "page-small box box-pad")(
|
||||
h1("Something went wrong on this page"),
|
||||
p(
|
||||
"If the problem persists, please ",
|
||||
a(href := s"${routes.Main.contact}#help-error-page")("report the bug"),
|
||||
"."
|
||||
),
|
||||
code(ex.getMessage)
|
||||
)
|
||||
}
|
||||
}.toHtml
|
||||
def apply(ex: Throwable)(implicit ctx: Context) = layout(
|
||||
title = "Internal server error",
|
||||
responsive = true
|
||||
) {
|
||||
main(cls := "page-small box box-pad")(
|
||||
h1("Something went wrong on this page"),
|
||||
p(
|
||||
"If the problem persists, please ",
|
||||
a(href := s"${routes.Main.contact}#help-error-page")("report the bug"),
|
||||
"."
|
||||
),
|
||||
code(ex.getMessage)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue