diff client/src/identify/Identify.vue @ 1123:d9e6a1f6f394 store-refactoring

moved all collapse flags for UI elements to store UI elements can now be expanded/collapsed via the application store
author Markus Kottlaender <markus@intevation.de>
date Tue, 06 Nov 2018 13:00:17 +0100
parents 595654ad3f66
children 2fda33d55d81
line wrap: on
line diff
--- a/client/src/identify/Identify.vue	Tue Nov 06 11:21:29 2018 +0100
+++ b/client/src/identify/Identify.vue	Tue Nov 06 13:00:17 2018 +0100
@@ -1,12 +1,12 @@
 <template>
     <div class="identifymenu">
-        <div @click="collapse" class="d-flex flex-column ui-element minimizer">
+        <div @click="$store.commit('application/showIdentify', !showIdentify)" class="d-flex flex-column ui-element minimizer">
             <div :class="infoStyle">
                 <i class="fa fa-info"></i>
             </div>
         </div>
         <div :class="identifyStyle">
-            <div v-if="!collapsed" class="card-body">
+            <div v-if="showIdentify" class="card-body">
                 <div class="headline">
                     <h4 class="card-title">Identified</h4>
                 </div>
@@ -97,18 +97,13 @@
  *   Thomas Junk <thomas.junk@intevation.de>
  *   Bernhard E. Reiter <bernhard.reiter@intevation.de>
  */
-import { mapState } from "vuex";
-import { mapGetters } from "vuex";
+import { mapState, mapGetters } from "vuex";
 
 export default {
   name: "identify",
-  data() {
-    return {
-      collapsed: true
-    };
-  },
   computed: {
     ...mapGetters("application", ["versionStr"]),
+    ...mapState("application", ["showIdentify"]),
     ...mapState("map", ["identifiedFeatures", "currentMeasurement"]),
     identifyStyle() {
       return {
@@ -116,8 +111,8 @@
         card: true,
         identify: true,
         shadow: true,
-        identifyexpanded: !this.collapsed,
-        identifycollapsed: this.collapsed
+        identifyexpanded: this.showIdentify,
+        identifycollapsed: !this.showIdentify
       };
     },
     infoStyle() {
@@ -129,9 +124,6 @@
     }
   },
   methods: {
-    collapse() {
-      this.collapsed = !this.collapsed;
-    },
     prepareProperties(feature) {
       // return dict object with propertyname:plainvalue prepared for display
       var properties = feature.getProperties();