class home
This commit is contained in:
parent
0ff2435307
commit
98d55472bf
|
@ -6,15 +6,25 @@ import lila.app._
|
|||
import views._
|
||||
|
||||
final class Clas(
|
||||
env: Env
|
||||
env: Env,
|
||||
prismicC: Prismic
|
||||
) extends LilaController(env) {
|
||||
|
||||
def index = Secure(_.Teacher) { implicit ctx => me =>
|
||||
def index = Open { implicit ctx =>
|
||||
ctx.me.ifTrue(isGranted(_.Teacher)).ifFalse(getBool("home")).map { me =>
|
||||
WithTeacher(me) { t =>
|
||||
env.clas.api.clas.of(t.teacher) map { classes =>
|
||||
Ok(views.html.clas.clas.index(classes))
|
||||
}
|
||||
}
|
||||
} | {
|
||||
pageHit
|
||||
prismicC getBookmark "class" map {
|
||||
_ ?? {
|
||||
case (doc, resolver) => Ok(views.html.clas.clas.home(doc, resolver))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def form = Secure(_.Teacher) { implicit ctx => _ =>
|
||||
|
|
|
@ -11,6 +11,28 @@ import controllers.routes
|
|||
|
||||
object clas {
|
||||
|
||||
def home(doc: io.prismic.Document, resolver: io.prismic.DocumentLinkResolver)(implicit ctx: Context) =
|
||||
views.html.base.layout(
|
||||
moreCss = frag(
|
||||
cssTag("page"),
|
||||
cssTag("clas")
|
||||
),
|
||||
title = ~doc.getText("doc.title")
|
||||
) {
|
||||
main(cls := "page-small box box-pad page clas-home")(
|
||||
h1(doc.getText("doc.title")),
|
||||
div(cls := "clas-home__doc")(
|
||||
raw(~doc.getHtml("doc.content", resolver))
|
||||
),
|
||||
div(cls := "clas-home__onboard")(
|
||||
button(cls := "button button-fat disabled", disabled)(
|
||||
"Apply for Lichess Teacher now"
|
||||
),
|
||||
p("Only on invitation for now! We will take applications soon.")
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
def index(classes: List[Clas])(implicit ctx: Context) =
|
||||
bits.layout("Lichess Classes", Right("classes"))(
|
||||
cls := "clas-index",
|
||||
|
|
|
@ -9,7 +9,7 @@ object page {
|
|||
def apply(doc: io.prismic.Document, resolver: io.prismic.DocumentLinkResolver)(implicit ctx: Context) =
|
||||
views.html.base.layout(
|
||||
moreCss = cssTag("page"),
|
||||
title = s"${~doc.getText("doc.title")}"
|
||||
title = ~doc.getText("doc.title")
|
||||
) {
|
||||
main(cls := "page-small box box-pad page")(
|
||||
h1(doc.getText("doc.title")),
|
||||
|
|
|
@ -222,3 +222,17 @@ $clas-color: rgb(127, 90, 240);
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
.clas-home {
|
||||
|
||||
&__doc {
|
||||
margin-bottom: 4em;
|
||||
}
|
||||
|
||||
&__onboard {
|
||||
text-align: center;
|
||||
.button {
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue