base/src/sqwl/cms/layout/Categories.scala
changeset 12 e7512f9dc903
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/base/src/sqwl/cms/layout/Categories.scala	Thu Dec 06 15:19:41 2018 +0100
@@ -0,0 +1,22 @@
+package sqwl.cms.layout
+
+import scalatags.Text.all._
+import scalatags.Text.{TypedTag, tags2}
+import sqwl.cms.{Dashboard, ViewState, config, iContent}
+
+object Categories extends config {
+
+  def apply(cnt: iContent, st: ViewState): Option[TypedTag[String]] =
+    st match {
+      case Dashboard => Some(tags2.section(
+        div(cls:="row",
+          cnt.categories.map(c =>
+            div(cls:="col-xs-6 col-sm-4 col-md-3",
+              div(cls:="tile-category",
+                a(href:=s"/${http.prefix}/${c.pathSegment}",
+                  cls:="tile-category-body", c.name)))))
+      ))
+      case _ => None
+    }
+
+}