package sqwl.cms
import BuildInfo.versions
import scalatags.Text.all
import scalatags.Text.all._
import scalatags.Text.tags2
import scalatags.Text.TypedTag
import sqwl.cms.layout.Navbar
object Layout extends config {
lazy val bootstrapCss = s"/${http.prefix}/assets/bootstrap/${versions.bootstrap}/css/bootstrap.min.css"
lazy val bootstrapJs = s"/${http.prefix}/assets/bootstrap/${versions.bootstrap}/js/bootstrap.min.js"
lazy val fontAwesomeCss = s"/${http.prefix}/assets/font-awesome/${versions.fontAwesome}/css/all.min.css"
lazy val jquery = s"/${http.prefix}/assets/jquery/${versions.jquery}/jquery.min.js"
def apply(content: iContent, st: ViewState): TypedTag[String] = {
val siteCss = s"/${http.prefix}/public/${content.styleSheet._1}"
html(
head(
tags2.style("""
|.nav, .pagination, .carousel, .panel-title a, .panel a { cursor: pointer; }""".stripMargin),
meta(charset:="utf-8"),
meta(name:="viewport", all.content:="width=device-width, initial-scale=1"),
link(rel:="stylesheet", href:=bootstrapCss),
link(rel:="stylesheet", href:=fontAwesomeCss),
link(rel:="stylesheet", href:=siteCss),
link(rel:="icon", href:="favicon.ico"),
tags2.title(st match {
case ViewArticle(v) => v.title
case ViewCategory(v) => v.name
case ViewTag(v) => v.name
case Dashboard => "SQWL"
case News => "Novinky"
})
),
body(paddingTop:=120,
Navbar(content, st),
div(role:="main", cls:="container",
st match {
case ViewArticle(article) => div(
a(href:=article.pathSegment, article.title),
raw(article.htmlContent)
)
case _ => ""
}
),
footer(id:="footer", p(raw(" "))),
script(src:=jquery),
script(src:=bootstrapJs)
)
)
}
}