aboutsummaryrefslogtreecommitdiff
path: root/resources/vue/components/courseware/unit/CoursewareUnitItemDialogPermissionScope.vue
blob: deed35f29537b00d908d3da56e44ae4d24caf5a0 (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
<template>
    <studip-dialog
        :title="$gettext('Rechte und Sichtbarkeit')"
        :confirm-text="$gettext('Wechseln')"
        confirm-class="accept"
        :close-text="$gettext('Abbrechen')"
        close-class="cancel"
        :question="$gettext('Sie haben bereits die Rechte und Sichtbarkeit für einzelne Seiten eingestellt. Möchten Sie die Rechte für das gesamte Lernmaterial anpassen? Achtung: Die bereits an den einzelnen Seiten festgelegten Rechte werden überschrieben.')"
        height="260"
        @close="$emit('close')"
        @confirm="switchPermissionScope"
    >
    </studip-dialog>
</template>
<script>
import { mapActions } from 'vuex';

export default {
    name: 'courseware-unit-item-dialog-permission-scope',
    emits: ['close', 'switch'],
    props: {
        unit: {
            type: Object,
            required: true,
        },
    },
    methods: {
        ...mapActions({
            updateUnit: 'courseware-units/update',
            loadUnit: 'courseware-units/loadById',
        }),
        async switchPermissionScope() {
            const unit = {
                id: this.unit.id,
                type: 'courseware-units',
                attributes: {
                    'permission-scope': 'unit',
                },
            };
            await this.updateUnit(unit);
            this.$emit('switch');
        },
    }
};
</script>