You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by hx...@apache.org on 2019/10/27 07:12:16 UTC

[incubator-iotdb-website] branch master updated: [IOTDB-270] Fix dropdown box of User Guide documents in official website

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

hxd pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb-website.git


The following commit(s) were added to refs/heads/master by this push:
     new c318ba1  [IOTDB-270] Fix dropdown box of User Guide documents in official website
c318ba1 is described below

commit c318ba1cf2537d743a581cac6674035cbe7707ce
Author: samperson1997 <sz...@mails.tsinghua.edu.cn>
AuthorDate: Sat Oct 26 17:29:42 2019 +0800

    [IOTDB-270] Fix dropdown box of User Guide documents in official website
---
 src/router/index.js     |  8 ++++++++
 src/views/Documents.vue | 51 ++++++++++++++++++++++++++++++-------------------
 2 files changed, 39 insertions(+), 20 deletions(-)

diff --git a/src/router/index.js b/src/router/index.js
index 3f7dc93..99b7280 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -78,3 +78,11 @@ export default new Router({
     }
   },
 })
+
+/**
+ * Rewrite router push method
+ */
+const routerPush = Router.prototype.push;
+Router.prototype.push = function push(location) {
+  return routerPush.call(this, location).catch(error => error)
+};
diff --git a/src/views/Documents.vue b/src/views/Documents.vue
index 1f77823..422ac33 100644
--- a/src/views/Documents.vue
+++ b/src/views/Documents.vue
@@ -5,16 +5,12 @@
         <!--sidebar part-->
         <div class="col-xs-3 sidebar">
           <div class="version text-center">
-            <div class="dropdown center-block" style="width: 80%;">
-              <button id="version-current" class="btn dropdown-toggle" data-toggle="dropdown" style="width: 100%">
-                IoTDB {{text}}
-                <b class="caret right-block"></b>
-              </button>
-              <ul class="dropdown-menu">
-                <li v-for="entry in versions">
-                  <router-link :to="entry.url">{{entry.text}}</router-link>
-                </li>
-              </ul>
+            <div class="center-block" style="width: 80%;">
+              <select class="version-select" v-model="selectVersion">
+                <option v-for="entry in versionList" :value="entry.text">
+                  IoTDB {{entry.text}} Documents
+                </option>
+              </select>
             </div>
           </div>
           <div id="text-catalogue" class="content center-block" style="overflow: auto">
@@ -66,7 +62,8 @@
     name: "Documents",
     data() {
       return {
-        versions: [],
+        versionList: [],
+        selectVersion: {},
         document: "",
         result: [],
         version: "",
@@ -90,18 +87,28 @@
       '$route.params.version': 'updateDocument',
       '$route.params.chapter': 'updateDocument',
       '$route.params.section': 'updateDocument',
+      selectVersion: function (newVersion) {
+        let version = "progress";
+        if (newVersion.startsWith("V")) {
+          version = newVersion.substr(1);
+        }
+        let url = "/Documents/" + version + "/chap1/sec1";
+        this.$router.push(url);
+      }
     },
     methods: {
       init() {
         for (let key in Global.SUPPORT_VERSION) {
-          this.versions.push({
+          this.versionList.push({
             text: Global.SUPPORT_VERSION[key]['text'],
             url: '/Documents/' + key + '/chap1/sec1'
           })
         }
         let version = this.getVersion();
-        if (version in Global.SUPPORT_VERSION) {
-          this.version = version;
+        if (version === "progress") {
+          this.selectVersion = "In progress";
+        } else {
+          this.selectVersion = "V" + version;
         }
         this.text = this.getVersionString();
       },
@@ -265,16 +272,20 @@
     background: #222222;
     padding: 0 0;
     line-height: 8px;
-
   }
 
-  .dropdown {
-    margin-top: 30px;
-    margin-bottom: 30px;
+  .version-select {
+    border: none;
+    outline: none;
+    border-radius: 5px;
+    width: 100%;
+    height: 40px;
+    margin: 30px 0;
+    background: #fcac45;
   }
 
-  .dropdown > ul {
-    width: 100%;
+  select::-ms-expand {
+    display: none;
   }
 
   .list-group > li {