Mercurial > gemma
changeset 966:6114c512508b
refac: extracted indentify from layers
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Wed, 17 Oct 2018 15:47:38 +0200 |
parents | ac2e51d5bc40 |
children | 2025074ad835 |
files | client/src/application/Topbar.vue client/src/identify/Identify.vue client/src/layers/Identify.vue |
diffstat | 3 files changed, 127 insertions(+), 127 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/application/Topbar.vue Wed Oct 17 15:33:59 2018 +0200 +++ b/client/src/application/Topbar.vue Wed Oct 17 15:47:38 2018 +0200 @@ -105,7 +105,7 @@ import { displayError } from "../application/lib/errors.js"; import { HTTP } from "../application/lib/http"; -import Identify from "../layers/Identify"; +import Identify from "../identify/Identify"; import Layers from "../layers/Layers"; const setFocus = () => document.querySelector("#search").focus();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/src/identify/Identify.vue Wed Oct 17 15:47:38 2018 +0200 @@ -0,0 +1,126 @@ +<template> + <div class="identifymenu"> + <div @click="collapse" 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 class="headline"> + <h4 class="card-title">Identified</h4> + </div> + <hr> + <div class="d-flex flex-column features"> + <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> {{ version }} + <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> +import { mapState } from "vuex"; +import { version } from "../../package.json"; + +export default { + name: "identify", + data() { + return { + collapsed: true + }; + }, + computed: { + ...mapState("mapstore", ["identifiedFeatures"]), + identifyStyle() { + return { + "ui-element": true, + card: true, + identify: true, + shadow: true, + identifyexpanded: !this.collapsed, + identifycollapsed: this.collapsed + }; + }, + infoStyle() { + return { + info: true, + "text-info": + this.identifiedFeatures && this.identifiedFeatures.length > 0 + }; + }, + version() { + return version; // version number from package.json + } + }, + methods: { + collapse() { + this.collapsed = !this.collapsed; + }, + prepareProperties(feature) { + // return dict object with propertyname:plainvalue prepared for display + var properties = feature.getProperties(); + delete properties[feature.getGeometryName()]; + return properties; + } + } +}; +</script>
--- a/client/src/layers/Identify.vue Wed Oct 17 15:33:59 2018 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,126 +0,0 @@ -<template> - <div class="identifymenu"> - <div @click="collapse" 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 class="headline"> - <h4 class="card-title">Identified</h4> - </div> - <hr> - <div class="d-flex flex-column features"> - <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> {{ version }} - <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> -import { mapState } from "vuex"; -import { version } from "../../package.json" - -export default { - name: "identify", - data() { - return { - collapsed: true - }; - }, - computed: { - ...mapState("mapstore", ["identifiedFeatures"]), - identifyStyle() { - return { - "ui-element": true, - card: true, - identify: true, - shadow: true, - identifyexpanded: !this.collapsed, - identifycollapsed: this.collapsed - }; - }, - infoStyle() { - return { - info: true, - "text-info": - this.identifiedFeatures && this.identifiedFeatures.length > 0 - }; - }, - version() { - return version; // version number from package.json - }, - }, - methods: { - collapse() { - this.collapsed = !this.collapsed; - }, - prepareProperties(feature) { - // return dict object with propertyname:plainvalue prepared for display - var properties = feature.getProperties(); - delete properties[feature.getGeometryName()]; - return properties; - } - } -}; -</script>