blob: a69fe89f00ceb40fd428bb4207a7d7a82140bc7c (
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
|
<template>
<div class="theme-settings-app-wrapper">
<ThemeEditor
v-if="selectedTheme"
:theme="selectedTheme"
@back="clearSelection"
/>
<ThemeList
v-else
:themes="themes"
@select="selectTheme"
@activate="activateTheme"
@add="addTheme"
/>
</div>
</template>
<script setup>
import { computed, ref } from 'vue';
import { useStore } from 'vuex';
import ThemeList from '@/vue/components/theme/ThemeList.vue';
import ThemeEditor from '@/vue/components/theme/ThemeEditor.vue';
const store = useStore();
const themes = computed(() => store.getters['studip-themes/all']);
const selectedTheme = ref(null);
const selectTheme = (theme) => {
selectedTheme.value = theme;
};
const activateTheme = (theme) => {
store.dispatch('theme-settings-module/activateTheme', {theme: theme}).then(() => {
window.location.reload();
});
};
const addTheme = () => {
store.dispatch('theme-settings-module/addTheme').then((theme) => {
selectTheme(theme);
});
};
const clearSelection = () => {
selectedTheme.value = null;
};
store.dispatch('users/loadById', { id: store.getters['theme-settings-module/userId'] });
store.dispatch('studip-themes/loadAll', {options: {}});
</script>
|