base/src/sqwl/cms/layout/Categories.scala
changeset 12 e7512f9dc903
equal deleted inserted replaced
11:4d8cf198bed2 12:e7512f9dc903
       
     1 package sqwl.cms.layout
       
     2 
       
     3 import scalatags.Text.all._
       
     4 import scalatags.Text.{TypedTag, tags2}
       
     5 import sqwl.cms.{Dashboard, ViewState, config, iContent}
       
     6 
       
     7 object Categories extends config {
       
     8 
       
     9   def apply(cnt: iContent, st: ViewState): Option[TypedTag[String]] =
       
    10     st match {
       
    11       case Dashboard => Some(tags2.section(
       
    12         div(cls:="row",
       
    13           cnt.categories.map(c =>
       
    14             div(cls:="col-xs-6 col-sm-4 col-md-3",
       
    15               div(cls:="tile-category",
       
    16                 a(href:=s"/${http.prefix}/${c.pathSegment}",
       
    17                   cls:="tile-category-body", c.name)))))
       
    18       ))
       
    19       case _ => None
       
    20     }
       
    21 
       
    22 }