aboutsummaryrefslogtreecommitdiff
path: root/resources/vue/components/courseware/toolbar/CoursewareContainerAdderItem.vue
blob: d18894b6ccc17fcf8bc1e8d5a90caee1a114c818 (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
<template>
    <div class="cw-containeradder-item-wrapper">
        <span class="cw-sortable-handle cw-sortable-handle-containeradder"></span>
        <button class="cw-containeradder-item" :class="['cw-containeradder-item-' + type]" @click.prevent="addNewContainer">
            <div class="cw-containeradder-item-content">
                <header class="cw-containeradder-item-title">
                    {{ title }}
                </header>
                <p class="cw-containeradder-item-description">
                    {{ description }}
                </p>
            </div>
        </button>
    </div>
</template>
<script>
import containerMixin from '@/vue/mixins/courseware/container';
import { mapActions } from 'vuex';

export default {
    name: 'courseware-container-adder-item',
    mixins: [containerMixin],
    props: {
        title: String,
        description: String,
        type: String,
        colspan: String,
        firstSection: String,
        secondSection: String,
        newPosition: Number,
    },
    methods: {
        ...mapActions({
            createContainer: 'createContainer',
            companionSuccess: 'companionSuccess',
        }),
        addNewContainer() {
            this.addContainer({
                type: this.type,
                colspan: this.colspan,
                sections: {
                    firstSection: this.firstSection, 
                    secondSection: this.secondSection
                },
                newPosition: null
            });
        },
    },
};
</script>