mirror of
https://github.com/Lissy93/dashy.git
synced 2024-12-27 10:56:20 +03:00
🛂 Remove edit from context menu, if no permissions (#455)
This commit is contained in:
parent
0b07abeb18
commit
0146e996cf
@ -29,7 +29,7 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<!-- Edit Options -->
|
<!-- Edit Options -->
|
||||||
<ul class="menu-section">
|
<ul class="menu-section" v-bind:class="{ disabled: !isEditAllowed }">
|
||||||
<li class="section-title">
|
<li class="section-title">
|
||||||
{{ $t('context-menus.item.options-section-title') }}
|
{{ $t('context-menus.item.options-section-title') }}
|
||||||
</li>
|
</li>
|
||||||
@ -85,6 +85,9 @@ export default {
|
|||||||
isEditMode() {
|
isEditMode() {
|
||||||
return this.$store.state.editMode;
|
return this.$store.state.editMode;
|
||||||
},
|
},
|
||||||
|
isEditAllowed() {
|
||||||
|
return this.$store.getters.permissions.allowViewConfig;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/* Called on item click, emits an event up to Item */
|
/* Called on item click, emits an event up to Item */
|
||||||
@ -93,13 +96,19 @@ export default {
|
|||||||
this.$emit('launchItem', target);
|
this.$emit('launchItem', target);
|
||||||
},
|
},
|
||||||
openSettings() {
|
openSettings() {
|
||||||
this.$emit('openItemSettings');
|
if (this.isEditAllowed) {
|
||||||
|
this.$emit('openItemSettings');
|
||||||
|
}
|
||||||
},
|
},
|
||||||
openMoveMenu() {
|
openMoveMenu() {
|
||||||
this.$emit('openMoveItemMenu');
|
if (this.isEditAllowed) {
|
||||||
|
this.$emit('openMoveItemMenu');
|
||||||
|
}
|
||||||
},
|
},
|
||||||
openDeleteItem() {
|
openDeleteItem() {
|
||||||
this.$emit('openDeleteItem');
|
if (this.isEditAllowed) {
|
||||||
|
this.$emit('openDeleteItem');
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -149,6 +158,13 @@ div.context-menu {
|
|||||||
path { fill: currentColor; }
|
path { fill: currentColor; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
&.disabled li:not(.section-title) {
|
||||||
|
cursor: not-allowed;
|
||||||
|
opacity: var(--dimming-factor);
|
||||||
|
&:hover {
|
||||||
|
background: var(--context-menu-background);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user