base/src/sqwl/cms/layout/PrimaryView.scala
author Tomas Zeman <tomas@functionals.cz>
Tue, 24 Nov 2020 11:17:26 +0100
changeset 31 5c4364d6e726
parent 19 83fb90bdd15b
child 33 fa0f19a74283
permissions -rw-r--r--
SQWL#2003 Studie -> Projekt

package sqwl.cms.layout

import scalatags.Text.all._
import scalatags.Text.{TypedTag, tags2}
import sqwl.cms._

object PrimaryView extends config with UrlScheme {
  def apply(cnt: iContent, st: ViewState): Option[TypedTag[String]] =
    st match {
      case ViewArticle(art) => Some(tags2.section(
        h1(a(href:=s"/${http.prefix}/${art.pathSegment}", art.title)),
        div(cls:="row", div(cls:="col-md-12", art.tags.map(t =>
          a(href:=s"/${http.prefix}/$TAG/${t.pathSegment}", cls:="tag",
            t.name)))),
        raw(art.htmlContent)
      ))
      case _ => None
    }

}