| author | Tomas Zeman <tomas@functionals.cz> |
| Tue, 29 Dec 2020 16:46:47 +0100 | |
| changeset 33 | fa0f19a74283 |
| parent 19 | 83fb90bdd15b |
| permissions | -rw-r--r-- |
| 33 | 1 |
/* |
2 |
* Copyright 2018-2020 Tomas Zeman <tomas@functionals.cz> |
|
3 |
* |
|
4 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
5 |
* you may not use this file except in compliance with the License. |
|
6 |
* You may obtain a copy of the License at |
|
7 |
* |
|
8 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
9 |
* |
|
10 |
* Unless required by applicable law or agreed to in writing, software |
|
11 |
* distributed under the License is distributed on an "AS IS" BASIS, |
|
12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
13 |
* See the License for the specific language governing permissions and |
|
14 |
* limitations under the License. |
|
15 |
*/ |
|
|
12
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
16 |
package sqwl.cms.layout |
|
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 |
import scalatags.Text.all._ |
|
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
19 |
import scalatags.Text.{TypedTag, tags2}
|
|
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
20 |
import sqwl.cms._ |
|
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
21 |
|
| 13 | 22 |
object PrimaryView extends config with UrlScheme {
|
|
12
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
23 |
def apply(cnt: iContent, st: ViewState): Option[TypedTag[String]] = |
|
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
24 |
st match {
|
|
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
25 |
case ViewArticle(art) => Some(tags2.section( |
|
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
26 |
h1(a(href:=s"/${http.prefix}/${art.pathSegment}", art.title)),
|
|
19
83fb90bdd15b
Rendering of tags and lists of articles
Tomas Zeman <tzeman@volny.cz>
parents:
13
diff
changeset
|
27 |
div(cls:="row", div(cls:="col-md-12", art.tags.map(t => |
|
83fb90bdd15b
Rendering of tags and lists of articles
Tomas Zeman <tzeman@volny.cz>
parents:
13
diff
changeset
|
28 |
a(href:=s"/${http.prefix}/$TAG/${t.pathSegment}", cls:="tag",
|
|
83fb90bdd15b
Rendering of tags and lists of articles
Tomas Zeman <tzeman@volny.cz>
parents:
13
diff
changeset
|
29 |
t.name)))), |
| 33 | 30 |
art.htmlContent |
|
12
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
31 |
)) |
|
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
32 |
case _ => None |
|
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
33 |
} |
|
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
34 |
|
|
e7512f9dc903
Layout: categories, articles, primary view
Tomas Zeman <tzeman@volny.cz>
parents:
diff
changeset
|
35 |
} |