equal
deleted
inserted
replaced
|
1 package sqwl.cms |
|
2 |
|
3 import java.nio.file.{Path, Paths} |
|
4 import scala.collection.mutable |
|
5 import scalatags.Text.all._ |
|
6 |
|
7 object Articles { |
|
8 case class Id(val v: String) |
|
9 case class Article( |
|
10 val id: Id, |
|
11 val title: String, |
|
12 val category: Option[iCategory], |
|
13 val tags: Seq[iTag] = Seq(), |
|
14 val htmlContent: String |
|
15 ) extends iArticle { |
|
16 override def assets: Path = Paths.get(s"example/content/${id.v}") |
|
17 override def pathSegment: String = id.v |
|
18 } |
|
19 private val all = mutable.ArrayBuffer[iArticle]() |
|
20 |
|
21 def values: Seq[iArticle] = all.toSeq |
|
22 |
|
23 def article(title: String, cat: iCategory, tags: Seq[iTag] = Seq())( |
|
24 body: Frag*)(implicit articleId: Id): SeqFrag[Frag] = { |
|
25 |
|
26 all += Article(articleId, title, Option(cat), tags, body.render) |
|
27 body |
|
28 } |
|
29 } |