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

<script>
import IsoDate from './IsoDate.vue';

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

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

        editor() {
            const editor = this.$store.getters['users/related']({
                parent: this.block,
                relationship: 'editor',
            });

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