You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cd...@apache.org on 2020/01/16 17:56:42 UTC

[plc4x-build-tools] branch develop updated: - Made the side menu only show the menu of the section selected in the top-menu - Made the side menu disappear if there is no sub-menu - Finshed the layout adjustment when going to small screen sizes

This is an automated email from the ASF dual-hosted git repository.

cdutz pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x-build-tools.git


The following commit(s) were added to refs/heads/develop by this push:
     new b3e8f51  - Made the side menu only show the menu of the section selected in the top-menu - Made the side menu disappear if there is no sub-menu - Finshed the layout adjustment when going to small screen sizes
b3e8f51 is described below

commit b3e8f519f69c6690840acce52a02be918c57155a
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Thu Jan 16 18:56:35 2020 +0100

    - Made the side menu only show the menu of the section selected in the top-menu
    - Made the side menu disappear if there is no sub-menu
    - Finshed the layout adjustment when going to small screen sizes
---
 .../src/site/asciidoc/apache/index.adoc            |  20 +++
 .../src/site/asciidoc/developers/index.adoc        |  20 +++
 .../src/site/asciidoc/users/index.adoc             |  20 +++
 .../src/it/plc4x-website/src/site/site.xml         |   4 -
 .../main/resources/META-INF/maven/site-macros.vm   |  49 ++++++
 .../src/main/resources/META-INF/maven/site.vm      | 194 +++++++++------------
 6 files changed, 196 insertions(+), 111 deletions(-)

diff --git a/plc4x-site-skin/src/it/plc4x-website/src/site/asciidoc/apache/index.adoc b/plc4x-site-skin/src/it/plc4x-website/src/site/asciidoc/apache/index.adoc
new file mode 100644
index 0000000..802707d
--- /dev/null
+++ b/plc4x-site-skin/src/it/plc4x-website/src/site/asciidoc/apache/index.adoc
@@ -0,0 +1,20 @@
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+:imagesdir: ../images/
+:icons: font
+
+== Apache
diff --git a/plc4x-site-skin/src/it/plc4x-website/src/site/asciidoc/developers/index.adoc b/plc4x-site-skin/src/it/plc4x-website/src/site/asciidoc/developers/index.adoc
new file mode 100644
index 0000000..a53b86c
--- /dev/null
+++ b/plc4x-site-skin/src/it/plc4x-website/src/site/asciidoc/developers/index.adoc
@@ -0,0 +1,20 @@
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+:imagesdir: ../images/
+:icons: font
+
+== Developers
diff --git a/plc4x-site-skin/src/it/plc4x-website/src/site/asciidoc/users/index.adoc b/plc4x-site-skin/src/it/plc4x-website/src/site/asciidoc/users/index.adoc
new file mode 100644
index 0000000..6d518fc
--- /dev/null
+++ b/plc4x-site-skin/src/it/plc4x-website/src/site/asciidoc/users/index.adoc
@@ -0,0 +1,20 @@
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+:imagesdir: ../images/
+:icons: font
+
+== Users
diff --git a/plc4x-site-skin/src/it/plc4x-website/src/site/site.xml b/plc4x-site-skin/src/it/plc4x-website/src/site/site.xml
index f429fa2..32a1461 100644
--- a/plc4x-site-skin/src/it/plc4x-website/src/site/site.xml
+++ b/plc4x-site-skin/src/it/plc4x-website/src/site/site.xml
@@ -46,9 +46,6 @@
   </bannerRight>
 
   <body>
-    <menu name="Deciders">
-      <item name="Section Home" href="deciders/index.html"/>
-    </menu>
     <menu name="Users">
       <item name="Section Home" href="users/index.html"/>
       <item name="Download" href="users/download.html"/>
@@ -71,7 +68,6 @@
       <item name="Continuous Integration" href="developers/ci.html"/>
       <item name="Contributing" href="developers/contributing.html"/>
       <item name="Decision Making" href="developers/decisions.html"/>
-      <!--item name="JQassistant" href="developers/jqassistant.html"/-->
       <item name="Maturity" href="developers/maturity.html"/>
       <item name="Preparing your Computer" href="developers/preparing.html"/>
       <item name="Releasing" href="developers/release.html"/>
diff --git a/plc4x-site-skin/src/main/resources/META-INF/maven/site-macros.vm b/plc4x-site-skin/src/main/resources/META-INF/maven/site-macros.vm
index d82653e..b96e96d 100644
--- a/plc4x-site-skin/src/main/resources/META-INF/maven/site-macros.vm
+++ b/plc4x-site-skin/src/main/resources/META-INF/maven/site-macros.vm
@@ -220,6 +220,55 @@
   </li>
 #end
 ##
+#macro ( filteredMainMenu $menus )
+    ## Calculate the currently selected section of the website.
+    ## Cut off all leading "../" segments, so we'll have the url start with the main section name.
+    #set ( $sectionName = $alignedFileName.replaceAll( '\.\./', '') )
+    ## If the remaining par doesn't contain a "/" we're in the root section, which we call "home".
+    #if ( !$sectionName.contains('/'))
+        #set ( $sectionName = "home" )
+    #else
+        #set ( $sectionName = $sectionName.substring(0, $sectionName.indexOf('/')) )
+    #end
+
+    ## Iterate over all menus defined in the site.xml
+    #foreach( $menu in $menus )
+        ## Iterate over all menu items in the current menu.
+        #foreach( $item in $menu.items )
+            ## Calculate the relative address of this item.
+            #set ( $currentItemHref = $PathTool.calculateLink( $item.href, $relativePath ) )
+            #set ( $currentItemHref = $currentItemHref.replaceAll( '\\', '/' ) )
+
+            ## Extract the item's section.
+            #set ( $currentItemSectionName = $currentItemHref.replaceAll( '\.\./', '') )
+            #if ( !$currentItemSectionName.contains('/'))
+                #set ( $currentItemSectionName = "home" )
+            #else
+                #set ( $currentItemSectionName = $currentItemSectionName.substring(0, $currentItemSectionName.indexOf('/')) )
+            #end
+
+            ## If the items section matches that of the current page, output the link.
+            #if ($currentItemSectionName == $sectionName)
+                #if ( !$showMenu )
+                    ## We only want to output the menu if there is any content,
+                    ## so check if it has been initialized. If not, do it.
+                    <nav class="col-sm-push col-md-2 sidebar">
+                    <div class="sidebar-sticky">
+                    <div id="navcolumn">
+                    #set ( $showMenu = true )
+                #end
+                #menuItem( $item )
+            #end
+        #end
+    #end
+    ## If the menu is output, we need to close it.
+    #if ( $showMenu )
+        </div>
+        </div>
+        </nav>
+    #end
+#end
+##
 #macro ( mainMenu $menus )
 #**##foreach( $menu in $menus )
 #*  *##if ( $menu.name )
diff --git a/plc4x-site-skin/src/main/resources/META-INF/maven/site.vm b/plc4x-site-skin/src/main/resources/META-INF/maven/site.vm
index dd65d01..1e15804 100644
--- a/plc4x-site-skin/src/main/resources/META-INF/maven/site.vm
+++ b/plc4x-site-skin/src/main/resources/META-INF/maven/site.vm
@@ -1,113 +1,93 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-#parse( "site-macros.vm" )
-<!-- Generated by Apache Maven Doxia Site Renderer#if( $doxiaSiteRendererVersion ) $doxiaSiteRendererVersion#end##
-#if( $docRenderingContext.generator || $docRenderingContext.doxiaSource ) from##
-#if( $docRenderingContext.generator ) $docRenderingContext.generator#end##
-#if( $docRenderingContext.doxiaSource ) $docRenderingContext.doxiaSourcePath#end##
-#end
- at $dateFormat.format( $currentDate ) -->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+    #parse( "site-macros.vm" )
 <html xmlns="http://www.w3.org/1999/xhtml"#if ( $locale ) xml:lang="$locale.language" lang="$locale.language"#end>
-   <head>
-      <meta http-equiv="Content-Type" content="text/html; charset=${outputEncoding}" />
-      <title>$title</title>
-       <script src="$relativePath/js/jquery.slim.min.js" type="javascript"></script>
-       <!--script src="$relativePath/js/popper.min.js" type="javascript"></script-->
-       <script src="$relativePath/js/bootstrap.bundle.min.js" type="javascript"></script>
-       <link rel="stylesheet" href="$relativePath/css/all.min.css" type="text/css" />
-       <link rel="stylesheet" href="$relativePath/css/bootstrap.min.css" type="text/css" />
-       <link rel="stylesheet" href="$relativePath/css/amaven-base.css" type="text/css" />
-       <link rel="stylesheet" href="$relativePath/css/maven-theme.css" type="text/css" />
-       <link rel="stylesheet" href="$relativePath/css/site.css" type="text/css" />
-       <link rel="stylesheet" href="$relativePath/css/print.css" type="text/css" media="print" />
-#foreach( $author in $authors )
-      <meta name="author" content="$author" />
-#end
-#if ( $documentDate )
-    <meta name="date" content="$documentDate" />
-#end
-#if ( $locale )
-    <meta http-equiv="Content-Language" content="$locale.language" />
-#end
-#if( $decoration.body.head )
-#**#$render.eval( $decoration.body.head )
-#end
+<head>
+    #set( $showMenu = false )
+    <meta http-equiv="Content-Type" content="text/html; charset=${outputEncoding}"/>
+    <title>$title</title>
+    <script src="$relativePath/js/jquery.slim.min.js" type="javascript"></script>
+    <!--script src="$relativePath/js/popper.min.js" type="javascript"></script-->
+    <script src="$relativePath/js/bootstrap.bundle.min.js" type="javascript"></script>
+    <link rel="stylesheet" href="$relativePath/css/all.min.css" type="text/css"/>
+    <link rel="stylesheet" href="$relativePath/css/bootstrap.min.css" type="text/css"/>
+    <link rel="stylesheet" href="$relativePath/css/amaven-base.css" type="text/css"/>
+    <link rel="stylesheet" href="$relativePath/css/maven-theme.css" type="text/css"/>
+    <link rel="stylesheet" href="$relativePath/css/site.css" type="text/css"/>
+    <link rel="stylesheet" href="$relativePath/css/print.css" type="text/css" media="print"/>
+    #foreach( $author in $authors )
+        <meta name="author" content="$author"/>
+    #end
+    #if ( $documentDate )
+        <meta name="date" content="$documentDate"/>
+    #end
+    #if ( $locale )
+        <meta http-equiv="Content-Language" content="$locale.language"/>
+    #end
+    #if( $decoration.body.head )
+        $render.eval( $decoration.body.head )
+    #end
     $headContent
-  </head>
-  <body class="composite">
-  <nav class="navbar navbar-light navbar-expand-md bg-faded justify-content-center">
-      <!--a href="/" class="navbar-brand d-flex w-50 mr-auto">Navbar 3</a-->
-      #banner( $decoration.bannerLeft "bannerLeft" "navbar-brand")
-      <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsingNavbar3">
-          <span class="navbar-toggler-icon"></span>
-      </button>
-      <div class="navbar-collapse collapse w-100" id="collapsingNavbar3">
-          <ul class="navbar-nav w-100 justify-content-center">
-              <li class="nav-item active">
-                  <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
-              </li>
-              <li class="nav-item">
-                  <a class="nav-link" href="#">Deciders</a>
-              </li>
-              <li class="nav-item">
-                  <a class="nav-link" href="#">Users</a>
-              </li>
-              <li class="nav-item">
-                  <a class="nav-link" href="#">Developers</a>
-              </li>
-              <li class="nav-item">
-                  <a class="nav-link" href="#">Apache</a>
-              </li>
-          </ul>
-          <ul class="nav navbar-nav ml-auto w-100 justify-content-end">
-              <li class="nav-item">
-                  #banner( $decoration.bannerRight "bannerRight")
-              </li>
-          </ul>
-      </div>
-  </nav>
-    <div id="breadcrumbs">
-        #*  *##publishDate( "left" $decoration.publishDate $decoration.version )
-        <div class="xright">#links( $decoration.body.links )
-#*  *##publishDate( "right" $decoration.publishDate $decoration.version )
-        </div>
-        <div class="clear">
-            <hr/>
-        </div>
+</head>
+<body class="composite">
+<nav class="navbar navbar-light navbar-expand-md bg-faded justify-content-center border-bottom">
+    <!--a href="/" class="navbar-brand d-flex w-50 mr-auto">Navbar 3</a-->
+    #banner( $decoration.bannerLeft "bannerLeft" "navbar-brand")
+    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsingNavbar3">
+        <span class="navbar-toggler-icon"></span>
+    </button>
+    <div class="navbar-collapse collapse w-100" id="collapsingNavbar3">
+        <ul class="navbar-nav w-100 justify-content-center">
+            <li class="nav-item active">
+                <a class="nav-link" href="$relativePath/index.html">Home <span class="sr-only">(current)</span></a>
+            </li>
+            ## Output only navigation options for the highest level menus
+            ## The convention is that if a name is "Hurz", that there is a directory called "hurz"
+            ## in the site and this contains an index.html
+            #foreach( $menu in $decoration.body.menus )
+            <li class="nav-item">
+                <a class="nav-link" href="$relativePath/$menu.name.toLowerCase()/index.html">$menu.name</a>
+            </li>
+            #end
+        </ul>
+        <ul class="nav navbar-nav ml-auto justify-content-end">
+            <li class="nav-item">
+                #banner( $decoration.bannerRight "bannerRight")
+            </li>
+        </ul>
     </div>
-    <div id="leftColumn">
-      <div id="navcolumn">
-#*   *##publishDate( "navigation-top" $decoration.publishDate $decoration.version )
-#*   *##mainMenu( $decoration.body.menus )
-#*   *##poweredByLogo( $decoration.poweredBy )
-#*   *##publishDate( "navigation-bottom" $decoration.publishDate $decoration.version )
-      </div>
-    </div>
-    <div id="bodyColumn">
-      <div id="contentBox">
-#*   *#$bodyContent
-      </div>
-    </div>
-    <div class="clear">
-      <hr/>
-    </div>
-    <div id="footer">
-      <div class="xright">
-#*  *##if( $decoration.body.footer )
-        $render.eval( $decoration.body.footer )
-#*  *##else
-        Copyright &#169;#copyright()All rights reserved.#publishDate( "bottom" $decoration.publishDate $decoration.version )
-#*  *##end
-      </div>
-      <div class="clear">
-        <hr/>
-      </div>
+</nav>
+<div class="container-fluid">
+    <div class="row">
+        #filteredMainMenu( $decoration.body.menus )
+        ## If the menu is shown, set the body width to only a part of the foll width,
+        ## if it is not shown, display it with 100$ width.
+        #if ($showMenu)
+            #set ( $mainStyles = "col-sm-pull col-md-9 col-lg-10")
+        #else
+            #set ( $mainStyles = "")
+        #end
+        <main role="main" class="ml-sm-auto px-4 $mainStyles">
+            $bodyContent
+        </main>
+        <footer class="pt-4 my-md-5 pt-md-5 w-100 border-top">
+            <div class="xright">
+                #if( $decoration.body.footer )
+                    $render.eval( $decoration.body.footer )
+                #else
+                    Copyright &#169;#copyright()All rights reserved.#publishDate(
+                    "bottom" $decoration.publishDate $decoration.version )
+                #end
+            </div>
+        </footer>
     </div>
+</div>
 
-    <!-- Bootstrap core JavaScript
-    ================================================== -->
-    <!-- Placed at the end of the document so the pages load faster -->
-    <script src="$relativePath/js/jquery.slim.min.js"></script>
-    <script src="$relativePath/js/popper.min.js"></script>
-    <script src="$relativePath/js/bootstrap.min.js"></script>
-  </body>
+<!-- Bootstrap core JavaScript
+================================================== -->
+<!-- Placed at the end of the document so the pages load faster -->
+<script src="$relativePath/js/jquery.slim.min.js"></script>
+<script src="$relativePath/js/popper.min.js"></script>
+<script src="$relativePath/js/bootstrap.min.js"></script>
+</body>
 </html>