base/src/sqwl/cms/Layout.scala
changeset 4 1a1347e8c5be
child 5 de7c56ce0654
equal deleted inserted replaced
3:48479e4b89d4 4:1a1347e8c5be
       
     1 package sqwl.cms
       
     2 
       
     3 import scalatags.Text.all._
       
     4 import scalatags.Text.tags2
       
     5 import scalatags.Text.TypedTag
       
     6 
       
     7 object Layout {
       
     8   def apply(content: iContent, st: ViewState): TypedTag[String] = {
       
     9     html(
       
    10       head(
       
    11         tags2.title(st match {
       
    12           case ViewArticle(v) => v.title
       
    13           case ViewCategory(v) => v.name
       
    14           case ViewTag(v) => v.name
       
    15           case Dashboard => "SQWL"
       
    16           case News => "Novinky"
       
    17         })
       
    18 
       
    19       ),
       
    20       body(
       
    21         div("foo"),
       
    22         st match {
       
    23           case ViewArticle(article) => div(
       
    24             a(href:=article.pathSegment, article.title),
       
    25             raw(article.htmlContent)
       
    26           )
       
    27           case _ => ""
       
    28         },
       
    29         div(
       
    30           content.categories map(c => div(a(href:=c.pathSegment, c.name)))
       
    31         )
       
    32 
       
    33       )
       
    34     )
       
    35   }
       
    36 
       
    37 }