--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/base/src/sqwl/cms/layout/ArticlesInCategory.scala Thu Dec 06 15:19:41 2018 +0100
@@ -0,0 +1,20 @@
+package sqwl.cms.layout
+
+import scalatags.Text.all._
+import scalatags.Text.{TypedTag, tags2}
+import sqwl.cms._
+
+object ArticlesInCategory extends config {
+ def apply(cnt: iContent, st: ViewState): Option[TypedTag[String]] =
+ st match {
+ case ViewCategory(c) =>
+ val l = cnt.articlesByCategory(c)
+ Some(tags2.section(
+ ul(l.map(art =>
+ li(a(href:=s"/${http.prefix}/${art.pathSegment}", art.title))
+ )),
+ if (l.isEmpty) "V této kategorii není ještě článek." else ""
+ ))
+ case _ => None
+ }
+}