WIP Buttons only when not editing

This commit is contained in:
portree_kid 2020-05-25 21:13:13 +02:00
parent 37e97e84e2
commit 9a3f473949
4 changed files with 17 additions and 5 deletions

View File

@ -12,7 +12,7 @@
trigger="hover"
content="Center to airport"
>
<el-button @click="goto" class="button" slot="reference">
<el-button @click="goto" class="button" slot="reference" :disabled="editing">
<i class="fas fa-bullseye"></i>
</el-button>
</el-popover>
@ -23,7 +23,7 @@
trigger="hover"
content="Remove this Work in progress file"
>
<el-button @click="remove" tooltip="Remove wip file" class="button" slot="reference">
<el-button @click="remove" tooltip="Remove wip file" class="button" slot="reference" :disabled="editing">
<i class="fas fa-trash-alt"></i>
</el-button>
</el-popover>
@ -34,7 +34,7 @@
trigger="hover"
content="Upload work in progress"
>
<el-button @click="upload" tooltip="Upload to groundweb" class="button" slot="reference">
<el-button @click="upload" tooltip="Upload to groundweb" class="button" slot="reference" :disabled="editing">
<i class="fas fa-upload"></i>
</el-button>
</el-popover>
@ -50,8 +50,9 @@
export default {
name: 'airport',
props: {airport: Object},
props: {airport: Object, editing: Boolean},
mounted () {
this.$forceUpdate();
},
data () {
return {

View File

@ -154,6 +154,8 @@
enableEdit () {
this.editable = true
this.editing = true
this.$store.commit('SET_EDIT', true)
this.featureLookup = [];
this.groundnetLayerGroup.eachLayer(l => {
l.enableEdit()
@ -170,6 +172,7 @@
disableEdit () {
this.editable = false
this.editing = false
this.$store.commit('SET_EDIT', false)
this.groundnetLayerGroup.eachLayer(l => {
l.disableEdit()
})

View File

@ -22,7 +22,7 @@
</el-row>
<el-row v-for="w in wip" :key="w.icao">
<Airport :airport="w"></Airport>
<Airport :airport="w" :editing="editing"></Airport>
</el-row>
</div>
</section>
@ -43,6 +43,11 @@
methods: {
},
computed: {
editing: {
get: function () {
return this.$store.state.Editable.editing
}
},
wip: function () {
return this.$store.state.Settings.wip
}

View File

@ -13,6 +13,9 @@ const SET_EDIT_ARC = 'SET_EDIT_ARC'
const SET_EDIT_RUNWAY = 'SET_EDIT_RUNWAY'
const mutations = {
SET_EDIT (state, editing) {
state.editing = editing
},
SET_EDIT_AIRPORT (state, airport) {
Vue.set(state.data, 'airport', airport)
state.index = airport.icao