| author | Tomas Zeman <tomas@functionals.cz> |
| Tue, 24 Nov 2020 11:17:26 +0100 | |
| changeset 31 | 5c4364d6e726 |
| parent 12 | e7512f9dc903 |
| 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.{Dashboard, ViewState, config, iContent}
|
|
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
6 |
|
|
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
7 |
object Categories extends config {
|
|
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
8 |
|
|
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
9 |
def apply(cnt: iContent, st: ViewState): Option[TypedTag[String]] = |
|
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
10 |
st match {
|
|
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
11 |
case Dashboard => Some(tags2.section( |
|
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
12 |
div(cls:="row", |
|
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
13 |
cnt.categories.map(c => |
|
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
14 |
div(cls:="col-xs-6 col-sm-4 col-md-3", |
|
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
15 |
div(cls:="tile-category", |
|
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
16 |
a(href:=s"/${http.prefix}/${c.pathSegment}",
|
|
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
17 |
cls:="tile-category-body", c.name))))) |
|
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 |
case _ => None |
|
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
20 |
} |
|
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
21 |
|
|
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
22 |
} |