diff client/src/components/Sidebar.vue @ 2329:514193fd0120

refac: improve routing structure. We now have /bottlenecks, /stretches, /review routes
author Thomas Junk <thomas.junk@intevation.de>
date Tue, 19 Feb 2019 14:57:48 +0100
parents 2e40909a975d
children eebe0a8ddc82
line wrap: on
line diff
--- a/client/src/components/Sidebar.vue	Tue Feb 19 13:55:02 2019 +0100
+++ b/client/src/components/Sidebar.vue	Tue Feb 19 14:57:48 2019 +0100
@@ -15,45 +15,33 @@
         ></font-awesome-icon>
         <span class="fix-trans-space" v-translate>Map</span>
       </router-link>
-      <a
-        :class="['secondary', { active: isActive('bottlenecks') }]"
-        @click="toggleContextBox('bottlenecks')"
-        href="#"
-      >
+      <router-link to="/bottlenecks">
         <font-awesome-icon
-          class="fa-fw  mr-2"
+          class="fa-fw mr-2"
           fixed-width
           icon="ship"
         ></font-awesome-icon>
         <span class="fix-trans-space" v-translate>Bottlenecks</span>
-      </a>
+      </router-link>
       <div v-if="isWaterwayAdmin">
-        <a
-          :class="['secondary', { active: isActive('staging') }]"
-          @click="toggleContextBox('staging')"
-          href="#"
-        >
+        <router-link to="/review">
           <font-awesome-icon
             class="fa-fw mr-2"
             fixed-width
             icon="clipboard-check"
           ></font-awesome-icon>
           <span class="fix-trans-space" v-translate>Staging area</span>
-        </a>
+        </router-link>
       </div>
       <div v-if="isSysAdmin">
-        <a
-          :class="['secondary', { active: isActive('stretches') }]"
-          @click="toggleContextBox('stretches')"
-          href="#"
-        >
+        <router-link to="/stretches">
           <font-awesome-icon
             class="fa-fw mr-2"
             fixed-width
             icon="road"
           ></font-awesome-icon>
           <span class="fix-trans-space" v-translate>Define stretches</span>
-        </a>
+        </router-link>
       </div>
       <div v-if="isWaterwayAdmin">
         <small class="text-muted pl-3"> <translate>Import</translate> </small>
@@ -175,20 +163,6 @@
 export default {
   name: "sidebar",
   props: ["routeName"],
-  watch: {
-    $route() {
-      const { review, importlog } = this.$route.query;
-      if (review) {
-        this.toggleContextBox("staging");
-        this.$store.commit("imports/setImportToReview", review);
-      } else {
-        this.$store.commit("imports/setImportToReview", -99);
-      }
-      if (importlog) {
-        this.$router.push("/importqueue/" + importlog);
-      }
-    }
-  },
   computed: {
     ...mapGetters("user", ["isSysAdmin", "isWaterwayAdmin"]),
     ...mapState("user", ["user"]),