comparison client/src/components/Identify.vue @ 1558:0ded4c56978e

refac: component filestructure. remove admin/map hierarchy
author Thomas Junk <thomas.junk@intevation.de>
date Wed, 12 Dec 2018 09:22:20 +0100
parents client/src/components/map/Identify.vue@c9f5f2c62d06
children c3cc21dee75d
comparison
equal deleted inserted replaced
1557:62171cd9a42b 1558:0ded4c56978e
1 <template>
2 <div
3 :class="[
4 'box ui-element rounded bg-white text-nowrap',
5 { expanded: showIdentify }
6 ]"
7 >
8 <div style="width: 20rem">
9 <h6 class="mb-0 py-2 px-3 border-bottom d-flex align-items-center">
10 <font-awesome-icon icon="info" class="mr-2"></font-awesome-icon>
11 <translate>Identified</translate>
12 <font-awesome-icon
13 icon="times"
14 class="ml-auto text-muted"
15 @click="$store.commit('application/showIdentify', false)"
16 ></font-awesome-icon>
17 </h6>
18 <div class="d-flex flex-column features p-3 flex-grow-1 text-left">
19 <div v-if="currentMeasurement">
20 <b>
21 {{ currentMeasurement.quantity }} ({{
22 currentMeasurement.unitSymbol
23 }}):
24 </b>
25 <br />
26 <small>{{ currentMeasurement.value }}</small>
27 </div>
28 <div v-for="(feature, i) of identifiedFeatures" :key="feature.getId()">
29 <div v-if="feature.getId()" :class="{ 'mt-2': i }">
30 <strong>
31 {{
32 feature.getId().replace(/[.][^.]*$/, "")
33 /* cut away everything from the last . to the end */
34 }}:
35 </strong>
36 <small
37 v-for="(value, key) in prepareProperties(feature)"
38 :key="key"
39 >
40 <div v-if="value">{{ key }}:{{ value }}</div>
41 </small>
42 </div>
43 </div>
44 <div
45 v-if="!currentMeasurement && !identifiedFeatures.length"
46 class="text-muted small text-center my-auto"
47 >
48 <translate>No features identified.</translate>
49 </div>
50 </div>
51 <div class="versioninfo border-top p-3 text-left">
52 <span v-translate="{ license: 'AGPL-3.0-or-later' }">
53 This app uses <i>gemma</i>, which is Free Software under <br />
54 %{ license } without warranty, see docs for details.
55 </span>
56 <br />
57 <a href="https://hg.intevation.de/gemma/file/tip">
58 <translate>source-code</translate>
59 </a>
60 {{ versionStr }} <br />© via donau. &#x24D4; Intevation. <br />
61 <span v-translate="{ name: 'OpenSteetMap' }"
62 >Some data ©
63 <a href="https://www.openstreetmap.org/copyright">%{ name }</a>
64 contributors.
65 </span>
66 <p v-translate="{ geoLicense: 'CC-BY-4.0' }">
67 Uses
68 <a href="https://download.geonames.org/export/dump/readme.txt"
69 >GeoNames</a
70 >
71 under %{ geoLicense }.
72 </p>
73 </div>
74 </div>
75 </div>
76 </template>
77
78 <style lang="scss" scoped>
79 .features {
80 max-height: 19rem;
81 overflow-y: auto;
82 }
83
84 .versioninfo {
85 font-size: 60%;
86 white-space: normal;
87 }
88 </style>
89
90 <script>
91 /* This is Free Software under GNU Affero General Public License v >= 3.0
92 * without warranty, see README.md and license for details.
93 *
94 * SPDX-License-Identifier: AGPL-3.0-or-later
95 * License-Filename: LICENSES/AGPL-3.0.txt
96 *
97 * Copyright (C) 2018 by via donau
98 * – Österreichische Wasserstraßen-Gesellschaft mbH
99 * Software engineering by Intevation GmbH
100 *
101 * Author(s):
102 * Thomas Junk <thomas.junk@intevation.de>
103 * Bernhard E. Reiter <bernhard.reiter@intevation.de>
104 * Markus Kottländer <markus.kottlaender@intevation.de>
105 */
106 import { mapState, mapGetters } from "vuex";
107
108 export default {
109 name: "identify",
110 computed: {
111 ...mapGetters("application", ["versionStr"]),
112 ...mapState("application", ["showIdentify"]),
113 ...mapState("map", ["identifiedFeatures", "currentMeasurement"])
114 },
115 methods: {
116 prepareProperties(feature) {
117 // return dict object with propertyname:plainvalue prepared for display
118 var properties = feature.getProperties();
119 delete properties[feature.getGeometryName()];
120 return properties;
121 }
122 }
123 };
124 </script>