| author | Tomas Zeman <tzeman@volny.cz> |
| Thu, 06 Dec 2018 16:18:26 +0100 | |
| changeset 13 | 216da61215db |
| parent 12 | e7512f9dc903 |
| child 19 | 83fb90bdd15b |
| permissions | -rw-r--r-- |
|
12
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
1 |
package sqwl.cms.layout |
|
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
2 |
|
|
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
3 |
import scalatags.Text.all._ |
|
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
4 |
import scalatags.Text.{TypedTag, tags2}
|
|
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
5 |
import sqwl.cms._ |
|
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
6 |
|
| 13 | 7 |
object PrimaryView extends config with UrlScheme {
|
|
12
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
8 |
def apply(cnt: iContent, st: ViewState): Option[TypedTag[String]] = |
|
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
9 |
st match {
|
|
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
10 |
case ViewArticle(art) => Some(tags2.section( |
|
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
11 |
h1(a(href:=s"/${http.prefix}/${art.pathSegment}", art.title)),
|
| 13 | 12 |
div(cls:="row", art.tags.map(t => |
13 |
a(href:=s"/${http.prefix}/$TAG/${t.pathSegment}", cls:="tag", s"(${t.name})"))),
|
|
|
12
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
14 |
raw(art.htmlContent) |
|
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
15 |
)) |
|
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
16 |
case _ => None |
|
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
17 |
} |
|
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
18 |
|
|
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
19 |
} |