Fixed: items and spells should no longer be draggable when you don't have edit permission

This commit is contained in:
Stefan Zermatten
2021-02-12 09:41:24 +02:00
parent b116be1238
commit fed87f0a84
4 changed files with 15 additions and 1 deletions

View File

@@ -7,6 +7,7 @@
<draggable <draggable
v-model="dataItems" v-model="dataItems"
style="min-height: 24px;" style="min-height: 24px;"
:disabled="context.editPermission === false"
:group="`item-list`" :group="`item-list`"
ghost-class="ghost" ghost-class="ghost"
draggable=".item" draggable=".item"
@@ -37,6 +38,9 @@ export default {
draggable, draggable,
ItemListTile, ItemListTile,
}, },
inject: {
context: { default: {} }
},
props: { props: {
items: { items: {
type: Array, type: Array,

View File

@@ -21,6 +21,7 @@
icon icon
flat flat
color="primary" color="primary"
:disabled="context.editPermission === false"
:value="model.quantity" :value="model.quantity"
@change="changeQuantity" @change="changeQuantity"
> >
@@ -31,6 +32,7 @@
</v-list-tile-action> </v-list-tile-action>
<v-list-tile-action> <v-list-tile-action>
<v-icon <v-icon
:disabled="context.editPermission === false"
style="height: 100%; width: 40px; cursor: move;" style="height: 100%; width: 40px; cursor: move;"
class="handle" class="handle"
> >

View File

@@ -26,6 +26,7 @@
v-else v-else
:key="spell._id" :key="spell._id"
class="item" class="item"
:disabled="context.editPermission === false"
:data-id="`spell-list-tile-${spell._id}`" :data-id="`spell-list-tile-${spell._id}`"
:model="spell" :model="spell"
:preparing-spells="preparingSpells" :preparing-spells="preparingSpells"
@@ -47,6 +48,9 @@ export default {
draggable, draggable,
SpellListTile, SpellListTile,
}, },
inject: {
context: { default: {} }
},
props: { props: {
spells: { spells: {
type: Array, type: Array,

View File

@@ -22,12 +22,13 @@
<smart-checkbox <smart-checkbox
v-if="preparingSpells" v-if="preparingSpells"
:value="model.prepared || model.alwaysPrepared" :value="model.prepared || model.alwaysPrepared"
:disabled="model.alwaysPrepared" :disabled="model.alwaysPrepared || context.editPermission === false"
@click.native.stop="() => {}" @click.native.stop="() => {}"
@change="setPrepared" @change="setPrepared"
/> />
<v-icon <v-icon
v-else-if="!hideHandle" v-else-if="!hideHandle"
:disabled="context.editPermission === false"
style="height: 100%; width: 40px; cursor: move;" style="height: 100%; width: 40px; cursor: move;"
class="handle" class="handle"
> >
@@ -58,6 +59,9 @@ export default {
hideHandle: Boolean, hideHandle: Boolean,
showInfoButton: Boolean, showInfoButton: Boolean,
}, },
inject: {
context: { default: {} }
},
computed: { computed: {
hasClickListener(){ hasClickListener(){
return this.$listeners && !!this.$listeners.click; return this.$listeners && !!this.$listeners.click;