--- a/example/src/sqwl/cms/Content.scala Tue Nov 24 13:15:49 2020 +0100
+++ b/example/src/sqwl/cms/Content.scala Tue Dec 29 16:46:47 2020 +0100
@@ -1,7 +1,7 @@
package sqwl.cms
-import java.nio.file.{Path, Paths}
+import java.nio.file.Path
import enumeratum.EnumEntry.Hyphencase
import enumeratum._
@@ -38,7 +38,7 @@
case object Tag6 extends Tag("Tag 6")
}
-object Content extends iContent {
+class Content(val root: Path) extends iContent {
InitializeContent()
def appTitle: String = "Content management system example"
@@ -46,12 +46,12 @@
def appTitleShort: String = "CMS"
def icon: (String, Path) =
- ("icon.png", Paths.get("example/content/public/images/icon.png"))
+ ("icon.png", root.resolve("public/images/icon.png"))
- def publicAssets: Path = Paths.get("example/content/public")
+ def publicAssets: Path = root.resolve("public")
def styleSheet: (String, Path) =
- ("site.css", Paths.get("example/content/public/css/site.css"))
+ ("site.css", root.resolve("public/css/site.css"))
def articlesByTag(t: iTag): Seq[iArticle] =
Articles.values filter(_.tags contains t) sortBy(_.rank)
@@ -70,4 +70,6 @@
Category.withNameOption(path)
def tagByPath(path: String): Option[iTag] = Tag.withNameOption(path)
+
+ def articleAssets(a: iArticle): Path = root.resolve(a.pathSegment)
}
\ No newline at end of file