base/src/sqwl/cms/layout/PrimaryView.scala
author Tomas Zeman <tzeman@volny.cz>
Thu, 13 Dec 2018 15:15:13 +0100
changeset 19 83fb90bdd15b
parent 13 216da61215db
child 33 fa0f19a74283
permissions -rw-r--r--
Rendering of tags and lists of articles

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
    }

}