Wiederholende Längenabfrage des Pfades in Variable umgewandelt
authorKai Moritz <kai@juplo.de>
Sat, 9 Jul 2016 15:31:34 +0000 (17:31 +0200)
committerKai Moritz <kai@juplo.de>
Wed, 28 Jun 2017 09:23:39 +0000 (11:23 +0200)
dist/templates/layout.html

index acb20bc..d7d592d 100644 (file)
             </h2>
             <ul layout:fragment="submenu"
                 th:with="
             </h2>
             <ul layout:fragment="submenu"
                 th:with="
+                  len=${crumbs.size()},
                   submenu=${pages[section.uri]['childs']},
                   parent=${crumbs[0].uri},
                   pos=1"
                 id="submenu"
                 class="s"
                   submenu=${pages[section.uri]['childs']},
                   parent=${crumbs[0].uri},
                   pos=1"
                 id="submenu"
                 class="s"
-                th:class="'s' + (${crumbs.size() == 1 or (crumbs.size() == 2 and page['childs'] == null)} ? ' selected' : '')"
+                th:class="'s' + (${len == 1 or (len == 2 and page['childs'] == null)} ? ' selected' : '')"
                 >
               <li th:fragment="submenu(submenu, parent, pos)"
                   th:each="entry : ${submenu}"
                   th:with="
                 >
               <li th:fragment="submenu(submenu, parent, pos)"
                   th:each="entry : ${submenu}"
                   th:with="
-                      child=${pos == crumbs.size()},
+                      child=${pos == len},
                       selected=${!child and crumbs.get(pos).uri == entry.key},
                       selected=${!child and crumbs.get(pos).uri == entry.key},
-                      sibling=${pos + 1 == crumbs.size() and (page['childs'] == null or uri == parent)},
+                      sibling=${pos + 1 == len and (page['childs'] == null or uri == parent)},
                       childs=${entry.key == parent ? null : pages[entry.key]['childs']}
                       "
                   class="s sub"
                       childs=${entry.key == parent ? null : pages[entry.key]['childs']}
                       "
                   class="s sub"
                     >fix-swf</a>
                 <ul th:if="${selected and childs != null}"
                     class="s active"
                     >fix-swf</a>
                 <ul th:if="${selected and childs != null}"
                     class="s active"
-                    th:class="'s' + (${selected} ? ' active' : '') + (${entry.key == uri or (crumbs.size() &gt; 1 and entry.key == crumbs.get(crumbs.size()-2).uri and page['childs'] == null)} ? ' selected' : '')"
+                    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' : '')"
                     >
                   <li th:replace="templates/layout :: submenu(submenu=${childs}, parent=${entry.key}, pos=${pos + 1})"
                       class="s"
                     >
                   <li th:replace="templates/layout :: submenu(submenu=${childs}, parent=${entry.key}, pos=${pos + 1})"
                       class="s"