blob: 08348b9f5a2251bc1ba7b3df0f35913bb890ce79 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
<template>
<sidebar-widget id="courseware-action-widget" :title="$gettext('Aktionen')" v-if="structuralElement">
<template #content>
<ul class="widget-list widget-links cw-action-widget">
<li v-if="canEdit" class="cw-action-widget-add">
<button @click="addElement">
{{ $gettext('Seite hinzufügen') }}
</button>
</li>
</ul>
</template>
</sidebar-widget>
</template>
<script>
import SidebarWidget from '../SidebarWidget.vue';
import { mapActions } from 'vuex';
export default {
name: 'courseware-action-widget',
props: ['structuralElement'],
components: {
SidebarWidget,
},
computed: {
canEdit() {
if (!this.structuralElement) {
return false;
}
return this.structuralElement.attributes['can-edit'];
},
},
methods: {
...mapActions({
showElementAddDialog: 'showElementAddDialog',
}),
addElement() {
this.showElementAddDialog(true);
},
},
};
</script>
|