You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/08/23 00:19:08 UTC

[GitHub] nswamy closed pull request #11196: [MXNET-529] [WIP] Adding the version selector to the API pages

nswamy closed pull request #11196: [MXNET-529] [WIP] Adding the version selector to the API pages
URL: https://github.com/apache/incubator-mxnet/pull/11196
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/docs/_static/js/versions_drop_down.js b/docs/_static/js/versions_drop_down.js
new file mode 100644
index 00000000000..5f7c44b4611
--- /dev/null
+++ b/docs/_static/js/versions_drop_down.js
@@ -0,0 +1,16 @@
+$(document).ready(function () {
+      function loadVersionURL() {
+          let el = $(this);
+          console.log("loadVersionURL");
+          let versionString = '';
+          if ($(this).text().includes("master")) {
+              versionString = $(this).text();
+          } else {
+              //Remove the character v at the beginning
+              versionString = $(this).text().substr(1);
+          }
+          window.location.pathname = '/versions/' + versionString + window.location.pathname ;
+      }
+      $('.opt-group').on('click', '.versions', loadVersionURL);
+});
+
diff --git a/docs/_static/mxnet-theme/layout.html b/docs/_static/mxnet-theme/layout.html
index 3028342abd5..d19ce147ac4 100644
--- a/docs/_static/mxnet-theme/layout.html
+++ b/docs/_static/mxnet-theme/layout.html
@@ -157,6 +157,9 @@
     <script type="text/javascript">
         $('body').css('background', 'white');
     </script>
+    {%- if 'api/' in pagename %}
+    <script type="text/javascript" src='/_static/js/versions_drop_down.js'></script>
+    {%- endif %}
     <div class="container">
       <div class="row">
         <div class="sphinxsidebar leftsidebar" role="navigation" aria-label="main navigation">
@@ -166,6 +169,22 @@
         </div>
         <div class="content">
           <div class="page-tracker"></div>
+          {%- block apidocs %}
+              {%- if 'api/' in pagename %}
+                    <div class="dropdown">
+                    <button class="btn current-version btn-primary dropdown-toggle" type="button" data-toggle="dropdown">v1.2.0
+                    <span class="caret"></span></button>
+                    <ul class="dropdown-menu opt-group">
+                      <li class="opt active versions"><a href="#">v1.2.0</a></li>
+                      <li class="opt versions"><a href="#">v1.1.0</a></li>
+                      <li class="opt versions"><a href="#">v1.0.0</a></li>
+                      <li class="opt versions"><a href="#">v0.12.1</a></li>
+                      <li class="opt versions"><a href="#">v0.11.0</a></li>
+                      <li class="opt versions"><a href="#">master</a></li>
+                    </ul>
+                    </div>
+              {%- endif %} <!-- API in -->
+          {%- endblock %}
           {% block body %} {% endblock %}
         </div>
       </div>


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services