Mercurial > gemma
view 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 source
<template> <div class="identifymenu"> <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="showIdentify" class="card-body"> <div class="headline"> <h4 class="card-title">Identified</h4> </div> <hr> <div class="d-flex flex-column features"> <small v-if="currentMeasurement"> {{ currentMeasurement.quantity }} ({{ currentMeasurement.unitSymbol }}): {{ currentMeasurement.value }} </small> <div v-for="feature of identifiedFeatures" :key="feature.getId()"> <div v-if="feature.getId()"> {{ feature.getId().replace(/[.][^.]*$/,"") /* cut away everything from the last . to the end */}}: <small v-for="(value, key) in prepareProperties(feature)" :key="key"> <div v-if="value">{{key}}:{{value}}</div> </small> </div> </div> </div> <div class="versioninfo"> <hr /> gemma <a href="https://hg.intevation.de/gemma/file/tip">source-code</a> {{ versionStr }} <br /> Some data © <a href="https://www.openstreetmap.org/copyright">OpenSteetMap</a> contributors </div> </div> </div> </div> </template> <style lang="scss"> .features { max-height: $identify-height; overflow-y: auto; margin-bottom: $x-large-offset + $large-offset; } .versioninfo { font-size: 60%; position: absolute; bottom: $large-offset; } .identifymenu { position: relative; margin-right: $offset; } .identify { background-color: white; margin-left: $small-offset; opacity: $slight-transparent; text-align: left; } .identifycollapsed { min-height: $icon-height; width: $icon-width; transition: $transition-fast; } .identifyexpanded { width: $identify-width; } .minimizer { position: absolute; z-index: 2; right: 0; margin-top: $x-small-offset; border-radius: $border-radius; height: $icon-width; width: $icon-height; } </style> <script> /* This is Free Software under GNU Affero General Public License v >= 3.0 * without warranty, see README.md and license for details. * * SPDX-License-Identifier: AGPL-3.0-or-later * License-Filename: LICENSES/AGPL-3.0.txt * * Copyright (C) 2018 by via donau * – Österreichische Wasserstraßen-Gesellschaft mbH * Software engineering by Intevation GmbH * * Author(s): * Thomas Junk <thomas.junk@intevation.de> * Bernhard E. Reiter <bernhard.reiter@intevation.de> */ import { mapState, mapGetters } from "vuex"; export default { name: "identify", computed: { ...mapGetters("application", ["versionStr"]), ...mapState("application", ["showIdentify"]), ...mapState("map", ["identifiedFeatures", "currentMeasurement"]), identifyStyle() { return { "ui-element": true, card: true, identify: true, shadow: true, identifyexpanded: this.showIdentify, identifycollapsed: !this.showIdentify }; }, infoStyle() { return { info: true, "text-info": this.identifiedFeatures && this.identifiedFeatures.length > 0 }; } }, methods: { prepareProperties(feature) { // return dict object with propertyname:plainvalue prepared for display var properties = feature.getProperties(); delete properties[feature.getGeometryName()]; return properties; } } }; </script>