blob: 9a179c3aec33aab9c64296f4a5c2c9fa63849994 (
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
43
44
45
46
47
48
49
50
51
52
|
<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>
<li class="cw-action-widget-export">
<button @click="exportElement">
{{ $gettext('Seite exportieren') }}
</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',
showElementExportChooserDialog: 'showElementExportChooserDialog',
showElementAddChooserDialog: 'showElementAddChooserDialog',
}),
addElement() {
this.showElementAddChooserDialog(true);
},
exportElement() {
this.showElementExportChooserDialog(true);
}
},
};
</script>
|