aboutsummaryrefslogtreecommitdiff
path: root/resources/vue/components/courseware/structural-element/CoursewareStructuralElementDialogInfo.vue
blob: 5fda85d1f4514326dae32dd810d623a19bb0eacc (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<template>
    <studip-dialog
        :title="$gettext('Informationen zur Seite')"
        :closeText="$gettext('Schließen')"
        @close="showElementInfoDialog(false)"
    >
        <template v-slot:dialogContent>
            <table class="cw-structural-element-info">
                <tbody>
                    <tr>
                        <td>{{ $gettext('Titel') }}:</td>
                        <td>{{ structuralElement.attributes.title }}</td>
                    </tr>
                    <tr>
                        <td>{{ $gettext('Beschreibung') }}:</td>
                        <td>{{ structuralElement.attributes.payload.description }}</td>
                    </tr>
                    <tr>
                        <td>{{ $gettext('Seite wurde erstellt von') }}:</td>
                        <td>{{ ownerName }}</td>
                    </tr>
                    <tr>
                        <td>{{ $gettext('Seite wurde erstellt am') }}:</td>
                        <td><iso-date :date="structuralElement.attributes.mkdate" /></td>
                    </tr>
                    <tr>
                        <td>{{ $gettext('Zuletzt bearbeitet von') }}:</td>
                        <td>{{ editorName }}</td>
                    </tr>
                    <tr>
                        <td>{{ $gettext('Zuletzt bearbeitet am') }}:</td>
                        <td><iso-date :date="structuralElement.attributes.chdate" /></td>
                    </tr>
                </tbody>
            </table>
        </template>
    </studip-dialog>
</template>
<script>
import IsoDate from '../layouts/IsoDate.vue';
import { mapActions, mapGetters } from 'vuex';
export default {
    name: 'courseware-structural-element-dialog-info',
    components: {
        IsoDate,
    },
    props: {
        structuralElement: Object,
        ownerName: String,
    },
    computed: {
        ...mapGetters({
            relatedUsers: 'users/related',
        }),
        editor() {
            const editor = this.relatedUsers({
                parent: this.structuralElement,
                relationship: 'editor',
            });

            return editor ?? null;
        },

        editorName() {
            return this.editor?.attributes['formatted-name'] ?? '?';
        },
    },
    methods: {
        ...mapActions({
            showElementInfoDialog: 'showElementInfoDialog',
        }),
    },
};
</script>