aboutsummaryrefslogtreecommitdiff
path: root/resources/vue/composables/courseware/useBlockCategoryManager.js
blob: 09cbb4ccd88e75c3e99be331c899ffcb33b89e12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { ref } from 'vue';
import { $gettext } from '../../../assets/javascripts/lib/gettext';

const categories = ref([
    { title: $gettext('Texte'), type: 'text' },
    { title: $gettext('Multimedia'), type: 'multimedia' },
    { title: $gettext('Interaktion'), type: 'interaction' },
    { title: $gettext('Gestaltung'), type: 'layout' },
    { title: $gettext('Externe Inhalte'), type: 'external' },
    { title: $gettext('Biografie'), type: 'biography' },
]);

export const useBlockCategoryManager = () => {
    const addCategory = (title, type) => {
        categories.value = [...categories.value.filter((category) => category.type !== type), { title, type }];
    };

    return { categories, addCategory };
};