Variable "menu" in "sections" umbenannt und Section-Handling vereinfacht
[website] / dist / thymeleaf / templates / layout.html
index 128bbf6..2ff0255 100644 (file)
@@ -3,6 +3,7 @@
     xmlns="http://www.w3.org/1999/xhtml"
     xmlns:th="http://www.thymeleaf.org"
     xmlns:layout="http://www.thymeleaf.org"
+    juplo:variables="templates/variables"
     >
   <head th:fragment="head" layout:fragment="head">
     <title layout:title-pattern="$DECORATOR_TITLE - $CONTENT_TITLE" th:text="'juplo'">juplo - BASISTEMPLATE</title>
       <link rel="stylesheet" type="text/css" href="../../css/ie8.min.css" th:href="@{/css/ie8.min.css}"/>
     <![endif]-->
   </head>
-  <body id="top" class="menu" th:class="${contentclass}?:'menu'" onload="prettyPrint()">
+  <body
+      th:with="crumbs=${crumbs.get(uri)}"
+      id="top"
+      class="menu"
+      th:class="${contentclass}?:'menu'"
+      onload="prettyPrint()"
+      >
     <div id="page" class="cf">
       <header id="header">
         <h1 id="logo" layout:fragment="header"><a href="../index.html" th:href="@{/}" title="Home" class="l">juplo</a></h1>
       <div id="breadcrumb">
         <strong class="b title">You are here:</strong>
         <ol class="b" layout:fragment="breadcrumb">
+          <li class="b"><a class="b" href="../../index.html" th:href="@{/index.html}">Home</a></li>
+          <li class="b" th:each="crumb: ${crumbs}">
+            <a class="b" href="../../projects.html" th:href="@{${crumb.uri}}" th:text="${crumb.name}">Projects</a>
+          </li>
           <!--/*-->
-          <li class="b"><a class="b" href="#">Home</a></li>
-          <li class="b"><a class="b" href="#">Projects</a></li>
-          <li class="b"><a class="b" href="#">Fix SWF</a></li>
+          <li class="b"><strong class="b" th:text="${title}"">Fix SWF</strong></li>
           <!--*/-->
-          <li class="b"><strong class="b">BREADCRUMB</strong></li>
         </ol>
         <a class="hide" href="#nav" title="Show navigation menu">Jump to navigation</a>
         <hr class="b" />
           </div>
         </article>
         <div class="marginal">
-          <nav id="nav" layout:fragment="navigation">
+          <nav id="nav"
+              layout:fragment="navigation"
+              th:with="section=${crumbs != null ? crumbs[0] : null}"
+              >
             <hr class="n"/>
             <a class="hide" href="#top" title="Show Content">Jump back to the top of the page</a>
             <h1 class="nav">Navigation</h1>
             <h2 class="nav menu">Section-Menu</h2>
             <ul id="menu" class="cf">
-              <li class="m blog"><a href="../blog.html" th:href="@{/blog.html}" class="m">Blog</a></li>
-              <li class="m projects"><a href="../projects" th:href="@{/projects.html}" class="m selected">Projects</a></li>
-              <li class="m about"><a href="../about.html" th:href="@{/about.html}" class="m">About</a></li>
+              <li class="m blog" th:each="entry : ${sections}" th:class="'m ' + ${entry.key}">
+                <a href="../blog.html" th:href="@{${entry.value.uri}}" class="m" th:class="${entry.value.uri == section.uri} ? 'm selected' : 'm'" th:text="${entry.value.name}">Blog</a>
+              </li>
+              <!--/*-->
+              <li class="m projects"><a href="../projects" class="m selected">Projects</a></li>
+              <li class="m about"><a href="../about.html" class="m">About</a></li>
+              <!--*/-->
             </ul>
             <h2 class="nav submenu">
               <span class="s">Submenu for section</span>
-              <a class="s selected" href="../projects.html" th:href="@{/projects.html}">Projects</a>
+              <a class="s selected" href="../projects.html" th:href="@{${section.uri}}" th:text="${section.name}">Projects</a>
             </h2>
-            <ul id="submenu" class="s" layout:fragment="submenu">
-              <li class="s sub off"><a href="#" class="s">hibernate4-maven-plugin</a></li>
-              <li class="s sub">
-                <a href="../projects/fix-swf.html" th:href="@{/projects/fix-swf.html}" class="s selected">fix-swf</a>
-                <ul class="s active">
-                  <li class="s"><strong class="s">Overview</strong></li>
-                  <li class="s"><a href="../projects/fix-swf/getting-started.html" th:href="@{/projects/fix-swf/getting-started.html}" class="s">Getting Started</a></li>
+            <ul layout:fragment="submenu"
+                th:with="parent=${(crumbs.size() == 2 and submenu.get(uri)['childs'] == null) ? crumbs[0].uri : null}, pos=1"
+                id="submenu"
+                class="s"
+                >
+              <li th:fragment="submenu(submenu, parent, pos)"
+                  th:each="entry : ${submenu}"
+                  th:with="
+                      child=${pos == crumbs.size()},
+                      selected=${!child and crumbs.get(pos).uri == entry.key},
+                      last=${crumbs.get(pos-1).uri == parent and crumbs.size() &gt; pos},
+                      childs=${entry.value['childs']}
+                      "
+                  class="s sub"
+                  th:class="'s' + (${childs} ? ' sub' : '') + (${selected or last or child} ? '' : ' off')"
+                  >
+                <a  href="../projects/fix-swf.html"
+                    th:href="@{${entry.key}}"
+                    class="s selected"
+                    th:class="${selected} ? 's selected' : 's'"
+                    th:text="${entry.value.name}"
+                    >fix-swf</a>
+                <ul th:if="${selected and childs != null}"
+                    class="s active"
+                    th:class="${selected} ? 's active' : 's'"
+                    >
+                  <li th:replace="templates/layout :: submenu(submenu=${childs}, parent=${entry.key}, pos=${pos + 1})"
+                      class="s"
+                      >
+                    <strong class="s">Overview</strong>
+                  </li>
+                  <!--/*-->
+                  <li class="s"><a href="../projects/fix-swf/getting-started.html" class="s">Getting Started</a></li>
                   <li class="s"><a href="#" class="s">FAQ</a></li>
                   <li class="s"><a href="#" class="s">Documentation</a></li>
+                  <!--*/-->
                 </ul>
               </li>
+              <!--/*-->
+              <li class="s sub off"><a href="#" class="s">hibernate4-maven-plugin</a></li>
               <li class="s off"><a href="#" class="s">jquery.openx</a></li>
               <li class="s sub off"><a href="../projects/html-experimente.html" th:href="@{/projects/html-experimente.html}" class="s">HTML-Experimente</a></li>
               <li class="s sub off"><a href="#" class="s">accelerator</a></li>
               <li class="s off"><a href="../projects/typo.html" th:href="@{/projects/typo.html}" class="s">Typography</a></li>
+              <!--*/-->
             </ul>
             <hr class="n"/>
           </nav>