From: Kai Moritz
Date: Fri, 8 Jul 2016 16:31:26 +0000 (+0200)
Subject: Projekt-Seite erstellt: Velocity-Template - JSON über th:with weitergereicht
X-Git-Tag: notnagel~1
X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=9769118126789a1a4d0bc91d18f8c7179f44fd16;p=maven-thymeleaf-skin
Projekt-Seite erstellt: Velocity-Template - JSON über th:with weitergereicht
Da die definierten Variablen sonst erst zu spät zur Verfügung stehen, müssen
sie per th:with in das Layout-Template hereingereicht und dort mit
juplo:variables verarbeitet werden.
---
diff --git a/src/site/site.xml b/src/site/site.xml
index ce59948..c89b14c 100644
--- a/src/site/site.xml
+++ b/src/site/site.xml
@@ -12,7 +12,7 @@
/simple-mapper/
- {"uri":"/projects.html","name":"Projects"},{"uri":"/simple-mapper/index.html","name":"Simple Mapper 4 JSON"}
+ {"uri":"/projects.html","name":"Projects"},{"uri":"/simple-mapper/index.html","name":"Simple Mapper 4 JSON"}
diff --git a/src/site/template.vm b/src/site/template.vm
index a507db2..003c8d2 100644
--- a/src/site/template.vm
+++ b/src/site/template.vm
@@ -114,7 +114,10 @@
xmlns="http://www.w3.org/1999/xhtml"
xmlns:layout="http://www.thymeleaf.org"
layout:decorator="templates/layout"
- th:with="uri='$sitePath$alignedFileName'"
+ th:with="
+ uri='$sitePath$alignedFileName',
+ json='merge:{"pages":{#set($sep = "")#foreach($page in $pages)$sep"$sitePath$page.uri":{"name":"$page.name",#if(!$page.childs.isEmpty())"childs":{#set($csep = "")#foreach($child in $page.childs.entrySet())$csep"$sitePath$child.key":"$child.value"#set($csep = ",")#end},#end"crumbs":[#set($csep = "")#if($siteCrumbs)$siteCrumbs#set($csep = ",")#end#foreach($crumb in $page.crumbs)$csep{"uri":"$sitePath$crumb.uri","name":"$crumb.name"}#set($csep = ",")#end]#if($page.title),"title":"$page.title"#end#if($page.alt),"alt":"$page.alt"#end#if($page.img),"img":"$page.img"#end}#set($sep = ",")#end}#if($siteTitle),"site_title":"$siteTitle"#end#if($siteAlt),"site_alt":"$siteAlt"#end#if($siteImg),"site_img":"$siteImg"#end}'
+ "
>
juplo - $title
@@ -129,7 +132,7 @@
-
+
$bodyContent