You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2019/06/25 15:31:13 UTC

[GitHub] [incubator-iotdb-website] samperson1997 commented on a change in pull request #20: Update documents url and method of loading nav sidebar content

samperson1997 commented on a change in pull request #20: Update documents url and method of loading nav sidebar content
URL: https://github.com/apache/incubator-iotdb-website/pull/20#discussion_r297252178
 
 

 ##########
 File path: src/views/Documents.vue
 ##########
 @@ -80,124 +79,105 @@
     watch: {
       '$route': 'fetchData',
       '$route.params.version': 'updateDocument',
+      '$route.params.chapter': 'updateDocument',
       '$route.params.section': 'updateDocument',
     },
     methods: {
       init(){
-        for(let key in Golbal.SUPPORT_VERSION){
+        for(let key in Global.SUPPORT_VERSION){
           this.versions.push({
-            text: Golbal.SUPPORT_VERSION[key]['text'],
-            url: '/Documents/'+ key + '/sec1'
+            text: Global.SUPPORT_VERSION[key]['text'],
+            url: '/Documents/'+ key + '/chap1/sec1'
           })
         }
         let version = this.getVersion();
-        if(version in Golbal.SUPPORT_VERSION){
-          if(version === Golbal.LATEST_STR){
-            this.version = Golbal.DEFAULT_VERSION;
+        if(version in Global.SUPPORT_VERSION){
+          if(version === Global.LATEST_STR){
+            this.version = Global.DEFAULT_VERSION;
           } else {
             this.version = version;
           }
-          this.updateSection();
         }
         this.text = this.getVersionString();
       },
       getVersionString() {
         let version = this.$route.params.version;
-        if (version in Golbal.SUPPORT_VERSION){
-          return Golbal.SUPPORT_VERSION[version]['text']
+        if (version in Global.SUPPORT_VERSION){
+          return Global.SUPPORT_VERSION[version]['text']
         }
         return "";
       },
-      changeChapterNavContent: function (event) {
-        let ver = this.getVersion();
-        let url = "/Documents/"+ver+"/sec"+event.currentTarget.className.replace(/[^0-9]/ig, "");
-        this.$router.push(url);
-      },
       changeSectionNavContent: function (event) {
-        let version = this.getVersionString();
-        var chapter = event.currentTarget.className;
-        var section = event.currentTarget.innerText;
-        console.log(chapter);
-        this.updateHeader(version, chapter.trim(), section);
-        this.$route.params.section = "sec" + chapter.replace(/[^0-9]/ig, "");
-        this.fetchData();
-
-        location.href = "#" + section.toLocaleLowerCase().replace(/ /g, '-');
+        let chapter = event.currentTarget.className;
+        let section = event.currentTarget.innerText;
+        this.$route.params.chapter = "chap" + chapter.replace(/[^0-9]/ig, "");
+        this.$route.params.section = "sec" + section.replace(/[^0-9]/ig, "");
+        let url = "/Documents/" + this.getVersion() + "/" + this.getChapter() + "/" + this.getSection();
+        this.$router.push(url);
+        history.go(0);
       },
       // get the version
       getVersion() {
         return this.$route.params.version;
       },
+      // get the chapter
+      getChapter() {
+        return this.$route.params.chapter;
+      },
       // get the section
       getSection() {
         return this.$route.params.section;
       },
       updateDocument(){
-        this.updateVersion();
-        this.updateSection();
-      },
-      updateVersion() {
         this.text = this.getVersionString();
-        this.generateCatalogue();
-      },
-      updateSection() {
-        let version = this.getVersion();
-        let chapter = Number(this.getSection().substr(3)) - 1;
-        if(chapter >= 0 && chapter <  Golbal.SUPPORT_VERSION[version]['chapters'].length){
-          this.chapter = Golbal.SUPPORT_VERSION[version]['chapters'][chapter].substr(0, Golbal.SUPPORT_VERSION[version]['chapters'][chapter].length - 3);
-        } else {
-          this.$router.push('/404');
-        }
-      },
-      updateHeader(chapter, section, content){
-        this.chapter = section;
-        this.content = content;
       },
       // use version and section to render markdown
       fetchData() {
         let version = this.getVersion();
-        let chapter = Number(this.getSection().substr(3)) - 1;
-        let url = null;
-        if (version in Golbal.SUPPORT_VERSION) {
-          url = Golbal.SUPPORT_VERSION[version]['doc-prefix'] + Golbal.SUPPORT_VERSION[version]['branch'] +
-            "/docs/Documentation/UserGuide" + Golbal.SUPPORT_VERSION[version]['version'] + "/" +
-            Golbal.SUPPORT_VERSION[version]['chapters'][chapter];
+        if (version in Global.SUPPORT_VERSION) {
+          let chapter = Number(this.getChapter().substr(4)) - 1;
+          let section = Number(this.getSection().substr(3));
+          let url = 'https://raw.githubusercontent.com/samperson1997/incubator-iotdb/' + Global.SUPPORT_VERSION[version]['branch'] +
 
 Review comment:
   I notice that...  After the PR of the other repository is merged, I’ll change it immediately

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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