--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/src/sqwl/cms/Articles.scala Thu Dec 13 14:21:10 2018 +0100
@@ -0,0 +1,29 @@
+package sqwl.cms
+
+import java.nio.file.{Path, Paths}
+import scala.collection.mutable
+import scalatags.Text.all._
+
+object Articles {
+ case class Id(val v: String)
+ case class Article(
+ val id: Id,
+ val title: String,
+ val category: Option[iCategory],
+ val tags: Seq[iTag] = Seq(),
+ val htmlContent: String
+ ) extends iArticle {
+ override def assets: Path = Paths.get(s"example/content/${id.v}")
+ override def pathSegment: String = id.v
+ }
+ private val all = mutable.ArrayBuffer[iArticle]()
+
+ def values: Seq[iArticle] = all.toSeq
+
+ def article(title: String, cat: iCategory, tags: Seq[iTag] = Seq())(
+ body: Frag*)(implicit articleId: Id): SeqFrag[Frag] = {
+
+ all += Article(articleId, title, Option(cat), tags, body.render)
+ body
+ }
+}