base/src/sqwl/cms/datamodel.scala
author Tomas Zeman <tomas@functionals.cz>
Tue, 29 Dec 2020 16:46:47 +0100
changeset 33 fa0f19a74283
parent 27 8529ce302f7c
permissions -rw-r--r--
CMS API update

/*
 * Copyright 2018-2020 Tomas Zeman <tomas@functionals.cz>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package sqwl.cms

import java.nio.file.Path

import scalatags.Text.all._

trait Named {
  def name: String
}

trait Navigable {
  def pathSegment: String
}

trait iCategory extends Named with Navigable

trait iTag extends Named with Navigable

trait iArticle extends Navigable {
  def title: String
  def htmlContent: SeqFrag[Frag]
  def category: Option[iCategory]
  def tags: Seq[iTag]
  def rank: Int
}

trait iContent {
  def appTitle: String
  def appTitleShort: String
  def icon: (String, Path)
  def publicAssets: Path
  def styleSheet: (String, Path)
  def articlesByTag(t: iTag): Seq[iArticle]
  def articlesByCategory(c: iCategory): Seq[iArticle]
  def tags: Seq[iTag]
  def categories: Seq[iCategory]
  def articleByPath(path: String): Option[iArticle]
  def categoryByPath(path: String): Option[iCategory]
  def tagByPath(path: String): Option[iTag]
  def articleAssets(a: iArticle): Path
}