changeset 1417:bd9253eec499

select bottleneck when clicked in bottleneck list Now the links in the bottleneck list behave same as clicking a bottleneck on the map. Two methods were renamed to better reflect what they do.
author Markus Kottlaender <markus@intevation.de>
date Thu, 29 Nov 2018 11:16:36 +0100
parents 3af7ad9717e2
children 547bbe64d188
files client/src/components/map/contextbox/Bottlenecks.vue
diffstat 1 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/map/contextbox/Bottlenecks.vue	Thu Nov 29 11:08:02 2018 +0100
+++ b/client/src/components/map/contextbox/Bottlenecks.vue	Thu Nov 29 11:16:36 2018 +0100
@@ -33,7 +33,7 @@
         <div class="col-5 py-2 text-left">
           <a
             href="#"
-            @click="moveToBottleneck(bottleneck)"
+            @click="selectBottleneck(bottleneck)"
           >{{ bottleneck.properties.name }}</a>
         </div>
         <div class="col-2 py-2">
@@ -46,7 +46,7 @@
           <button
             type="button"
             class="btn btn-sm btn-info rounded-0 h-100"
-            @click="toggleBottleneck(bottleneck.properties.name)"
+            @click="loadSurveys(bottleneck.properties.name)"
             v-if="bottleneck.properties.current"
           >
             <font-awesome-icon icon="spinner" fixed-width spin v-if="loading === bottleneck.properties.name"></font-awesome-icon>
@@ -159,14 +159,14 @@
         });
     },
     selectSurvey(survey, bottleneck) {
+      this.selectBottleneck(bottleneck);
+      this.$store.commit("bottlenecks/selectedSurvey", survey);
+    },
+    selectBottleneck(bottleneck) {
       this.$store.dispatch(
         "bottlenecks/setSelectedBottleneck",
         bottleneck.properties.name
       );
-      this.$store.commit("bottlenecks/selectedSurvey", survey);
-      this.moveToBottleneck(bottleneck);
-    },
-    moveToBottleneck(bottleneck) {
       this.$store.commit("map/moveMap", {
         coordinates: bottleneck.geometry.coordinates,
         zoom: 17,
@@ -177,7 +177,7 @@
       this.sortColumn = column;
       this.sortDirection = this.sortDirection === "ASC" ? "DESC" : "ASC";
     },
-    toggleBottleneck(name) {
+    loadSurveys(name) {
       this.openBottleneckSurveys = null;
       if (name === this.openBottleneck) {
         this.openBottleneck = null;