base/src/sqwl/cms/Layout.scala
changeset 4 1a1347e8c5be
child 5 de7c56ce0654
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/base/src/sqwl/cms/Layout.scala	Thu Nov 29 12:20:20 2018 +0100
@@ -0,0 +1,37 @@
+package sqwl.cms
+
+import scalatags.Text.all._
+import scalatags.Text.tags2
+import scalatags.Text.TypedTag
+
+object Layout {
+  def apply(content: iContent, st: ViewState): TypedTag[String] = {
+    html(
+      head(
+        tags2.title(st match {
+          case ViewArticle(v) => v.title
+          case ViewCategory(v) => v.name
+          case ViewTag(v) => v.name
+          case Dashboard => "SQWL"
+          case News => "Novinky"
+        })
+
+      ),
+      body(
+        div("foo"),
+        st match {
+          case ViewArticle(article) => div(
+            a(href:=article.pathSegment, article.title),
+            raw(article.htmlContent)
+          )
+          case _ => ""
+        },
+        div(
+          content.categories map(c => div(a(href:=c.pathSegment, c.name)))
+        )
+
+      )
+    )
+  }
+
+}