blob: d92efa21d0b12708cb12f22780491e3cd925f56a (
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
|
<script setup>
import {computed} from 'vue';
import StudipIcon from '@/vue/components/StudipIcon.vue';
import {useForumConfig} from '@/vue/store/pinia/forum/ForumConfig';
const forumConfig = useForumConfig();
const props = defineProps({
category_id: {
type: String,
},
label: {
type: String,
default: ''
}
});
const topicCreateURL = computed(() => {
if (props.category_id) {
return STUDIP.URLHelper.getURL(`dispatch.php/course/forum/topics/edit?category_id=${props.category_id}`);
}
return STUDIP.URLHelper.getURL('dispatch.php/course/forum/topics/edit');
});
const addTopic = () => {
STUDIP.Dialog.fromURL(
topicCreateURL.value,
{
width: '700'
}
);
}
</script>
<template>
<button
type="button"
class="button button--icon-only"
v-if="forumConfig.isModerator"
@click="addTopic"
:title="$gettext('Neues Thema anlegen')"
:aria-label="$gettext('Neues Thema anlegen')"
:class="label ? 'button--icon-label' : 'button--icon-only'"
>
<StudipIcon shape="add" :size="20" aria-hidden="true" />
<span v-if="label" class="label">{{ label }}</span>
</button>
</template>
|