changeset 1670:c344849538c0

refac: removed console.log statements and made code more consistent
author Thomas Junk <thomas.junk@intevation.de>
date Mon, 24 Dec 2018 13:30:57 +0100
parents 16fb9667ddf8
children 89b38d7e7b6a
files client/src/components/Pdftool.vue client/src/components/Search.vue
diffstat 2 files changed, 13 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/Pdftool.vue	Mon Dec 24 13:12:11 2018 +0100
+++ b/client/src/components/Pdftool.vue	Mon Dec 24 13:30:57 2018 +0100
@@ -97,31 +97,22 @@
     ...mapState("bottlenecks", ["selectedSurvey"])
   },
   methods: {
+    isLandscape() {
+      return this.form.format !== "portrait";
+    },
     download() {
-      console.log(
-        "will generate pdf with",
-        this.form.paperSize,
-        this.form.format
-      );
-
-      let width, height;
-      // generate PDF and open it
-      if (this.form.format !== "portrait") {
-        // landscape, default
-        width = paperSizes[this.form.paperSize][0];
-        height = paperSizes[this.form.paperSize][1];
-      } else {
-        // switch width and height
-        width = paperSizes[this.form.paperSize][1];
-        height = paperSizes[this.form.paperSize][0];
-      }
-      console.log(width, height);
+      /* eslint-disable no-unused-vars */
+      const width = this.isLandscape()
+        ? paperSizes[this.form.paperSize][0]
+        : paperSizes[this.form.paperSize][1];
+      const height = this.isLandscape()
+        ? paperSizes[this.form.paperSize][1]
+        : paperSizes[this.form.paperSize][0];
 
       // TODO: replace this src with an API reponse after actually generating PDFs
-      let src =
-        this.form.format === "landscape"
-          ? "/img/PrintTemplate-Var2-Landscape.pdf"
-          : "/img/PrintTemplate-Var2-Portrait.pdf";
+      let src = !this.isLandscape()
+        ? "/img/PrintTemplate-Var2-Landscape.pdf"
+        : "/img/PrintTemplate-Var2-Portrait.pdf";
 
       let a = document.createElement("a");
       a.href = src;
--- a/client/src/components/Search.vue	Mon Dec 24 13:12:11 2018 +0100
+++ b/client/src/components/Search.vue	Mon Dec 24 13:30:57 2018 +0100
@@ -248,7 +248,6 @@
         }
       )
         .then(response => {
-          // console.log("got:", response.data);
           this.searchResults = response.data;
         })
         .catch(error => {
@@ -263,7 +262,6 @@
       this.searchQueryIsDirty = false;
     },
     moveToSearchResult(resultEntry) {
-      // DEBUG console.log("Moving to", resultEntry);
       if (resultEntry.geom.type == "Point") {
         let zoom = 11;
         if (resultEntry.type === "bottleneck") zoom = 17;