WIP: title/main/marginal explizit
[website] / dist / templates / layout.html
index 36b9535..1f946dc 100644 (file)
@@ -2,49 +2,61 @@
 <html
     xmlns="http://www.w3.org/1999/xhtml"
     xmlns:th="http://www.thymeleaf.org"
-    xmlns:layout="http://www.thymeleaf.org"
-    juplo:variables="templates/variables"
+    th:fragment="layout(uri,maincontent,marginalcontent)"
+    thymeproxy:variables="SET:sitemap.json"
     >
-  <head th:fragment="head" layout:fragment="head">
-    <title layout:title-pattern="$DECORATOR_TITLE - $CONTENT_TITLE" th:text="'juplo'">juplo - BASISTEMPLATE</title>
+  <head>
+    <title th:replace="${title}">juplo - BASISTEMPLATE</title>
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
     <meta name="viewport" content="width=device-width, initial-scale=1" />
-    <link rel="stylesheet/less" th:rel="stylesheet" type="text/css" href="../less/base.less" th:href="@{/css/base.min.css}"/>
-    <link rel="stylesheet/less" type="text/css" href="../less/screen.less" media="screen" th:remove="all"/>
-    <link rel="stylesheet/less" type="text/css" href="../less/print.less" media="print" th:remove="all"/>
-    <style type="text/css" th:inline="text">
-      @import '[[@{/css/screen.min.css}]]' screen;
-      @import '[[@{/css/print.min.css}]]' print;
-    </style>
+    <!-- Default / Responsive -->
+    <link rel="stylesheet" th:rel="stylesheet" media="all" title="Responsive" type="text/css" href="../css/base.css" th:href="@{/css/base.min.css}"/>
+    <link rel="stylesheet" th:rel="stylesheet" media="only screen" title="Responsive" type="text/css" href="../css/screen.css" th:href="@{/css/screen.min.css}"/>
+    <link rel="stylesheet" th:rel="stylesheet" media="print" title="Responsive" type="text/css" href="../css/print.css" th:href="@{/css/print.min.css}"/>
+    <!-- Legacy -->
+    <link rel="alternate stylesheet" title="Legacy" type="text/css" href="../css/base.css" th:href="@{/css/base.min.css}"/>
+    <!-- Tablet -->
+    <link rel="alternate stylesheet" title="Tablet" type="text/css" href="../css/base.css" th:href="@{/css/base.min.css}"/>
+    <link rel="alternate stylesheet" title="Tablet" type="text/css" href="../css/tablet.css" th:href="@{/css/tablet.min.css}"/>
+    <!-- Phone -->
+    <link rel="alternate stylesheet" title="Phone" type="text/css" href="../css/base.css" th:href="@{/css/base.min.css}"/>
+    <link rel="alternate stylesheet" title="Phone" type="text/css" href="../css/phone.css" th:href="@{/css/phone.min.css}"/>
+    <!-- Tiny -->
+    <link rel="alternate stylesheet" title="Tiny" type="text/css" href="../css/base.css" th:href="@{/css/base.min.css}"/>
+    <link rel="alternate stylesheet" title="Tiny" type="text/css" href="../css/tiny.css" th:href="@{/css/tiny.min.css}"/>
+    <!-- Print -->
+    <link rel="alternate stylesheet" title="Print" type="text/css" href="../css/base.css" th:href="@{/css/base.min.css}"/>
+    <link rel="alternate stylesheet" title="Print" type="text/css" href="../css/print.css" th:href="@{/css/print.min.css}"/>
     <script src="../js/prettify.js" th:src="@{/js/prettify.js}"></script>
     <!--[if lt IE 9]>
       <script src="../js/html5shiv.js" th:src="@{/js/html5shiv.js}"></script>
     <![endif]-->
     <!--[if IE 8]>
-      <link rel="stylesheet/less" th:rel="stylesheet" type="text/css" href="../less/ie8.less" th:href="@{/css/ie8.min.css}"/>
+      <link rel="stylesheet" th:rel="stylesheet" type="text/css" href="../css/ie8.css" th:href="@{/css/ie8.min.css}"/>
     <![endif]-->
-    <script src="../js/less-1.7.0.min.js" th:remove="all"></script>
+    <link rel="caononical" href="layout.html" th:replace="~{:: #canonical}?:~{}"/>
   </head>
   <body
-      juplo:variables="${json}"
-      th:with="page=${pages.get(uri)},crumbs=${page['crumbs']}"
+      th:fragment="body(uri)"
+      thymeproxy:variables="${json}"
+      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>
+      <header id="header"><!-- TODO: Vereinfachung -> für uri == index.html a gegen strong ausstauschen -->
+        <h1 id="logo" th:include="~{::#logo}"><a href="../index.html" th:href="@{/}" title="Home" class="l" ><img class="l" src="/img/logo.svg" alt="juplo"/></a></h1>
         <span id="slogan"><strong>Java</strong> bits from nerds for nerds</span>
         <hr class="h" />
       </header>
       <div id="breadcrumb">
         <strong class="b title">You are here:</strong>
-        <ol class="b" layout:fragment="breadcrumb">
+        <ol class="b" th:include="~{::#crumbs}?:_">
           <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>
+            <a class="b" href="../projects.html" th:href="@{${crumb}}" th:text="${_titles.get(crumb)}">Projects</a>
           </li>
           <!--/*-->
           <li class="b"><strong class="b" th:text="${title}">Fix SWF</strong></li>
@@ -54,8 +66,8 @@
         <hr class="b" />
       </div>
       <main class="content cf">
-        <article id="content" class="main" layout:fragment="maincontent" th:class="'main'">
-          <header><h1 th:text="${title}">juplo - BASISTEMPLATE</h1></header>
+        <article id="content" class="main" th:include="${maincontent}">
+          <header><h1 th:include="${title}">juplo - BASISTEMPLATE</h1></header>
           <div th:fragment="maincontent">
             <p>
               <strong>Lorem ipsum</strong> dolor
         </article>
         <div class="marginal">
           <nav id="nav"
-              layout:fragment="navigation"
+              th:include="~{::#navigation}?:_"
               th:with="section=${crumbs != null ? crumbs[0] : null}"
               >
             <hr class="n"/>
             <h1 class="nav">Navigation</h1>
             <h2 class="nav menu">Section-Menu</h2>
             <ul id="menu" class="cf">
-              <li class="m blog" th:each="entry : ${sections}" th:class="'m ' + ${entry.key}">
-                <a href="../blog.html" th:href="@{${entry.value}}" class="m" th:class="${entry.value == section.uri} ? 'm selected' : 'm'" th:text="${pages.get(entry.value).name}">Blog</a>
+              <li class="m blog" th:each="entry : ${_sections}" th:class="'m ' + ${entry.key}">
+                <a href="../blog/" th:href="@{${entry.value}}" class="m" th:class="${entry.value == section} ? 'm selected' : 'm'" th:text="${_titles.get(entry.value)}">Blog</a>
               </li>
               <!--/*-->
-              <li class="m projects"><a href="../projects" class="m selected">Projects</a></li>
+              <li class="m projects"><a href="../projects.html" 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="@{${section.uri}}" th:text="${section.name}">Projects</a>
+              <a class="s selected" href="../projects.html" th:href="@{${section}}" th:text="${_titles.get(section)}">Projects</a>
             </h2>
-            <ul layout:fragment="submenu"
+            <ul th:include="${submenu}?:_"
                 th:with="
                   len=${crumbs.size()},
-                  submenu=${pages[section.uri]['childs']},
-                  parent=${crumbs[0].uri},
+                  submenu=${_childs.get(section)},
+                  parent=${crumbs[0]},
                   pos=1"
                 id="submenu"
                 class="s"
-                th:class="'s' + (${len == 1 or (len == 2 and page['childs'] == null)} ? ' selected' : '')"
+                th:class="'s' + (${len == 1 or (len == 2 and _childs.get(uri) == null)} ? ' selected' : '')"
                 >
               <li th:fragment="submenu(submenu, parent, pos)"
                   th:each="entry : ${submenu}"
                   th:with="
                       child=${pos == len},
-                      selected=${!child and crumbs.get(pos).uri == entry.key},
-                      sibling=${pos + 1 == len and (page['childs'] == null or uri == parent)},
-                      childs=${entry.key == parent ? null : pages[entry.key]['childs']}
+                      selected=${!child and crumbs.get(pos) == entry},
+                      sibling=${pos + 1 == len and (_childs.get(uri) == null or uri == parent)},
+                      childs=${entry == parent ? null : _childs.get(entry)}
                       "
                   class="s sub"
                   th:class="'s' + (${childs} ? ' sub' : '') + (${selected or sibling or child} ? '' : ' off')"
                   >
-                <a  href="../potemkin/fix-swf.html"
-                    th:href="@{${entry.key}}"
+                <a  href="../potemkin/fix-swf/overview.html"
+                    th:if="${entry != parent}"
+                    th:href="@{${entry}}"
                     class="s selected"
                     th:class="${selected} ? 's selected' : 's'"
-                    th:text="${entry.value}"
+                    th:text="${_titles.get(entry)}"
                     >fix-swf</a>
                 <ul th:if="${selected and childs != null}"
                     class="s active"
-                    th:class="'s' + (${selected} ? ' active' : '') + (${entry.key == uri or (len &gt; 1 and entry.key == crumbs.get(len-2).uri and page['childs'] == null)} ? ' selected' : '')"
+                    th:class="'s' + (${selected &amp;&amp; pos == crumbs.size()-1} ? ' active' : '') + (${entry == uri or (len &gt; 1 and entry == crumbs.get(len-2) and _childs.get(uri) == null)} ? ' selected' : '')"
                     >
-                  <li th:replace="templates/layout :: submenu(submenu=${childs}, parent=${entry.key}, pos=${pos + 1})"
+                  <li th:replace="this :: submenu(submenu=${childs}, parent=${entry}, pos=${pos + 1})"
                       class="s"
                       >
                     <strong class="s">Overview</strong>
             </ul>
             <hr class="n"/>
           </nav>
-          <aside class="m" layout:fragment="marginalcontent" th:remove="tag">
+          <aside class="m" th:insert="${marginalcontent}?:~{}">
           <!--/* the following  is only visible during natural templating -->
             <h1>Other nasty but marginal stuff</h1>
             <p>
       </main>
       <footer id="footer">
         <hr class="f" />
-        <ul id="footerlinks" layout:fragment="footer">
+        <ul id="footerlinks" th:include="~{::#links}?:_">
           <li class="f" id="copyright">© <strong>mo</strong> 2013</li>
           <li class="f"><a class="f" href="../impressum.html" th:href="@{/impressum.html}">Impressum</a></li>
-          <li class="f about"><a class="f" href="../about.html" th:href="@{/about.html}">About</a></li>
+          <li class="f"><a class="f" href="../datenschutz.html" th:href="@{/datenschutz.html}">Datenschutz</a></li>
         </ul>
       </footer>
     </div>