aboutsummaryrefslogtreecommitdiff
path: root/resources/vue/components/courseware/blocks/CoursewareBlockInfo.vue
blob: a9948f8fdbfd739898583747b5e289ddd846aafa (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
<template>
    <section class="cw-block-info">
        <header>{{ $gettext('Informationen') }}</header>
        <div class="cw-block-features-content cw-block-info-content">
            <table class="cw-block-info-table">
                <tbody>
                    <tr>
                        <td>{{ $gettext('Blockbeschreibung') }}</td>
                        <td><slot name="info" /></td>
                    </tr>
                    <tr>
                        <td>{{ $gettext('Block wurde erstellt von') }}</td>
                        <td>{{ owner }}</td>
                    </tr>
                    <tr>
                        <td>{{ $gettext('Block wurde erstellt am') }}:</td>
                        <td><iso-date :date="block.attributes.mkdate" /></td>
                    </tr>
                    <tr>
                        <td>{{ $gettext('Zuletzt bearbeitet von') }}:</td>
                        <td>{{ editor }}</td>
                    </tr>
                    <tr>
                        <td>{{ $gettext('Zuletzt bearbeitet am') }}:</td>
                        <td><iso-date :date="block.attributes.chdate" /></td>
                    </tr>
                </tbody>
            </table>
            <button class="button" @click="$emit('close')">{{ $gettext('Schließen') }}</button>
        </div>
    </section>
</template>

<script>
import IsoDate from '../layouts/IsoDate.vue';
import { mapGetters } from 'vuex';

export default {
    name: 'courseware-block-info',
    components: { IsoDate },
    emits: ['close'],
    props: {
        block: Object,
    },
    computed: {
        ...mapGetters({
            relatedUsers: 'users/related',
        }),
        owner() {
            const owner = this.relatedUsers({
                parent: this.block,
                relationship: 'owner',
            });

            return owner?.attributes['formatted-name'] ?? '';
        },

        editor() {
            const editor = this.relatedUsers({
                parent: this.block,
                relationship: 'editor',
            });

            return editor?.attributes['formatted-name'] ?? '';
        },
    },
};
</script>