| author | Tomas Zeman <tzeman@volny.cz> |
| Thu, 29 Nov 2018 12:20:20 +0100 | |
| changeset 4 | 1a1347e8c5be |
| child 5 | de7c56ce0654 |
| permissions | -rw-r--r-- |
|
4
1a1347e8c5be
Build modules: base, content, app; example content, minimal layout
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
1 |
package sqwl.cms |
|
1a1347e8c5be
Build modules: base, content, app; example content, minimal layout
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
2 |
|
|
1a1347e8c5be
Build modules: base, content, app; example content, minimal layout
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
3 |
import scalatags.Text.all._ |
|
1a1347e8c5be
Build modules: base, content, app; example content, minimal layout
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
4 |
import scalatags.Text.tags2 |
|
1a1347e8c5be
Build modules: base, content, app; example content, minimal layout
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
5 |
import scalatags.Text.TypedTag |
|
1a1347e8c5be
Build modules: base, content, app; example content, minimal layout
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
6 |
|
|
1a1347e8c5be
Build modules: base, content, app; example content, minimal layout
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
7 |
object Layout {
|
|
1a1347e8c5be
Build modules: base, content, app; example content, minimal layout
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
8 |
def apply(content: iContent, st: ViewState): TypedTag[String] = {
|
|
1a1347e8c5be
Build modules: base, content, app; example content, minimal layout
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
9 |
html( |
|
1a1347e8c5be
Build modules: base, content, app; example content, minimal layout
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
10 |
head( |
|
1a1347e8c5be
Build modules: base, content, app; example content, minimal layout
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
11 |
tags2.title(st match {
|
|
1a1347e8c5be
Build modules: base, content, app; example content, minimal layout
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
12 |
case ViewArticle(v) => v.title |
|
1a1347e8c5be
Build modules: base, content, app; example content, minimal layout
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
13 |
case ViewCategory(v) => v.name |
|
1a1347e8c5be
Build modules: base, content, app; example content, minimal layout
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
14 |
case ViewTag(v) => v.name |
|
1a1347e8c5be
Build modules: base, content, app; example content, minimal layout
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
15 |
case Dashboard => "SQWL" |
|
1a1347e8c5be
Build modules: base, content, app; example content, minimal layout
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
16 |
case News => "Novinky" |
|
1a1347e8c5be
Build modules: base, content, app; example content, minimal layout
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
17 |
}) |
|
1a1347e8c5be
Build modules: base, content, app; example content, minimal layout
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
18 |
|
|
1a1347e8c5be
Build modules: base, content, app; example content, minimal layout
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
19 |
), |
|
1a1347e8c5be
Build modules: base, content, app; example content, minimal layout
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
20 |
body( |
|
1a1347e8c5be
Build modules: base, content, app; example content, minimal layout
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
21 |
div("foo"),
|
|
1a1347e8c5be
Build modules: base, content, app; example content, minimal layout
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
22 |
st match {
|
|
1a1347e8c5be
Build modules: base, content, app; example content, minimal layout
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
23 |
case ViewArticle(article) => div( |
|
1a1347e8c5be
Build modules: base, content, app; example content, minimal layout
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
24 |
a(href:=article.pathSegment, article.title), |
|
1a1347e8c5be
Build modules: base, content, app; example content, minimal layout
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
25 |
raw(article.htmlContent) |
|
1a1347e8c5be
Build modules: base, content, app; example content, minimal layout
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
26 |
) |
|
1a1347e8c5be
Build modules: base, content, app; example content, minimal layout
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
27 |
case _ => "" |
|
1a1347e8c5be
Build modules: base, content, app; example content, minimal layout
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
28 |
}, |
|
1a1347e8c5be
Build modules: base, content, app; example content, minimal layout
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
29 |
div( |
|
1a1347e8c5be
Build modules: base, content, app; example content, minimal layout
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
30 |
content.categories map(c => div(a(href:=c.pathSegment, c.name))) |
|
1a1347e8c5be
Build modules: base, content, app; example content, minimal layout
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
31 |
) |
|
1a1347e8c5be
Build modules: base, content, app; example content, minimal layout
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
32 |
|
|
1a1347e8c5be
Build modules: base, content, app; example content, minimal layout
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
33 |
) |
|
1a1347e8c5be
Build modules: base, content, app; example content, minimal layout
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
34 |
) |
|
1a1347e8c5be
Build modules: base, content, app; example content, minimal layout
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
35 |
} |
|
1a1347e8c5be
Build modules: base, content, app; example content, minimal layout
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
36 |
|
|
1a1347e8c5be
Build modules: base, content, app; example content, minimal layout
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
37 |
} |