You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ad...@apache.org on 2016/11/05 04:47:50 UTC

[29/50] incubator-mynewt-site git commit: fix documentation view for small devices.

fix documentation view for small devices.

remove the show/hide doc menu button - it does not work over page loads.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/commit/70b86076
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/tree/70b86076
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/diff/70b86076

Branch: refs/heads/master
Commit: 70b86076df5ca8254dc15f4d221381058a949afb
Parents: d20c70a
Author: Gavin Jefferies <ga...@runtime.io>
Authored: Wed Oct 19 12:00:22 2016 -0700
Committer: Gavin Jefferies <ga...@runtime.io>
Committed: Wed Oct 19 12:00:22 2016 -0700

----------------------------------------------------------------------
 custom-theme/base.html      | 12 +++--------
 custom-theme/css/custom.css | 46 +---------------------------------------
 custom-theme/js/base.js     | 38 ++++++++++++++++++++-------------
 custom-theme/js/custom.js   | 18 ----------------
 4 files changed, 27 insertions(+), 87 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/70b86076/custom-theme/base.html
----------------------------------------------------------------------
diff --git a/custom-theme/base.html b/custom-theme/base.html
index 48c6c38..37a5bf2 100644
--- a/custom-theme/base.html
+++ b/custom-theme/base.html
@@ -72,17 +72,11 @@
                 {% include "events.html" %}
             {% else %}
                 <div class="row">
-                    <div class="col-md-3 v2-sidebar">{% include "toc.html" %}</div>
-
-                    <div class="show-sidebar-container">
-                        <button class="show-sidebar">Docs Menu</button>
-                    </div>
+                    <div class="col-md-3 v2-sidebar sidebar-container">{% include "toc.html" %}</div>
 
                     <div class="col-md-9" role="main">
-                        <div class="row doc-header">
-                            <div class="col-sm-12">
-                                {% include 'breadcrumbs.html' %}
-                            </div>
+                        <div class="doc-header">
+                            {% include 'breadcrumbs.html' %}
                         </div>
                         {% block content %}
                             {{ content }}

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/70b86076/custom-theme/css/custom.css
----------------------------------------------------------------------
diff --git a/custom-theme/css/custom.css b/custom-theme/css/custom.css
index 86ecac6..63e04f9 100644
--- a/custom-theme/css/custom.css
+++ b/custom-theme/css/custom.css
@@ -77,15 +77,6 @@ body {
 
 @media (max-width: 992px) {
 
-    .sidebar-container {
-        display: none;
-    }
-
-    .show-sidebar-container {
-        display: block;
-        margin: 30px auto 20px;
-    }
-
     .logo-container {
         display: block;
         position: absolute;
@@ -108,24 +99,9 @@ body {
         padding: 1%;
     }
 
-    .show-sidebar-container {
-        display: none;
-    }
-
-    .documentation-viewer,
-    .sidebar-container {
+    .documentation-viewer {
         display: block !important;
     }
-
-    .sidebar-container {
-        position: fixed;
-    }
-}
-
-.sidebar-container {
-    padding-left: 0;
-    padding-right: 0;
-    background: #F6F7F9;
 }
 
 .documentation-viewer {
@@ -435,21 +411,6 @@ ul.wy-breadcrumbs {
 
 }
 
-.show-sidebar {
-    width: 100%;
-
-    border: 0;
-    box-shadow: 0px 2px 0px 0px #f6f7f9;
-
-    background-color: #f6f7f9;
-    color: #fff;
-}
-
-.show-sidebar.active {
-    box-shadow: 0px 2px 0px 0px #f6f7f9;
-    background-color: #f6f7f9;
-}
-
 .event-callout {
     color: #fff;
 }
@@ -485,11 +446,6 @@ ul.wy-breadcrumbs {
     margin: 40px 0;
 }
 
-.sidebar-container .nav>li>a:hover,
-.sidebar-container .nav>li>a:focus {
-    background-color: #f6f7f9;
-}
-
 code {
     font-family: "Courier New";
 }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/70b86076/custom-theme/js/base.js
----------------------------------------------------------------------
diff --git a/custom-theme/js/base.js b/custom-theme/js/base.js
index 3a46f88..bdba5c2 100644
--- a/custom-theme/js/base.js
+++ b/custom-theme/js/base.js
@@ -10,27 +10,35 @@ $("li.disabled a").click(function() {
     event.preventDefault();
 });
 
-function fixDocSidebar() {
-    var sidebarHeight = $("#docSidebar").height();
-    console.log('sidebar at ' + sidebarHeight);
+function manageDocSidebar() {
+    if (window.matchMedia("(max-width: 992px)").matches) {
+        // menu above content
+        $("#docSidebar").css("height", 'initial');
+        $("#docSidebar").css("overflow-y", "initial");
+    }
+    else {
+        // side by side - menu + content
+        var sidebarHeight = $("#docSidebar").height();
+        console.log('sidebar at ' + sidebarHeight);
 
-    var visibleHeight = $( window ).height() - $('#navbar').height();
-    console.log('visible at ' + visibleHeight);
+        var visibleHeight = $( window ).height() - $('#navbar').height();
+        console.log('visible at ' + visibleHeight);
 
-    // Fix the sidebar height to the visible window
-    $("#docSidebar").css("height", visibleHeight);
+        // Fix the sidebar height to the visible window
+        $("#docSidebar").css("height", visibleHeight);
 
-    // If the sidebar content is larger than visible height give it scrollability.
-    if (sidebarHeight <= visibleHeight) {
-        $("#docSidebar").css("overflow-y", "hidden");
-    }
-    else {
-        $("#docSidebar").css("overflow-y", "scroll");
+        // If the sidebar content is larger than visible height give it scrollability.
+        if (sidebarHeight <= visibleHeight) {
+            $("#docSidebar").css("overflow-y", "hidden");
+        }
+        else {
+            $("#docSidebar").css("overflow-y", "scroll");
+        }
     }
 }
 
 $( document ).ready(function() {
     $("#docSidebar").css("overflow-x", "hidden");
-    fixDocSidebar();
-    $( window ).on('resize', fixDocSidebar);
+    manageDocSidebar();
+    $( window ).on('resize', manageDocSidebar);
 });

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-site/blob/70b86076/custom-theme/js/custom.js
----------------------------------------------------------------------
diff --git a/custom-theme/js/custom.js b/custom-theme/js/custom.js
index 371bb41..e69de29 100644
--- a/custom-theme/js/custom.js
+++ b/custom-theme/js/custom.js
@@ -1,18 +0,0 @@
-$('.show-sidebar').click(function() {
-
-    $('.sidebar-container').toggle();
-    $(this).toggleClass('active');
-
-    if ($('.sidebar-container').is(':visible')) {
-        $(this).text('Close Docs Menu');
-    } else {
-        $(this).text('Docs Menu');
-    }
-});
-
-// console.log("highlights: " + $(".highlight").length)
-//
-// $(".highlight").each(function(index, highlight) {
-//     console.log(highlight);
-//     console.log(highlight.innerText);
-// })