|
| 1 | +<template> |
| 2 | + <div> |
| 3 | + <StudipDialog |
| 4 | + :title="$gettext('Standardsichtbarkeit Videos in dieser Veranstaltung')" |
| 5 | + :confirmText="$gettext('Akzeptieren')" |
| 6 | + :closeText="$gettext('Schließen')" |
| 7 | + :closeClass="'cancel'" |
| 8 | + height="260" |
| 9 | + width="530" |
| 10 | + @close="$emit('cancel')" |
| 11 | + @confirm="setCourseEpisodesVisibility" |
| 12 | + > |
| 13 | + <template v-slot:dialogContent> |
| 14 | + <form class="default" @submit="setCourseEpisodesVisibility"> |
| 15 | + <label> |
| 16 | + <input type="radio" name="visibility" value="default" |
| 17 | + :checked="currentVisibilityOption == 'default'" |
| 18 | + v-model="visibilityOption" |
| 19 | + > |
| 20 | + {{ $gettext('Systemstandard') + ' (' + $gettext(standardVisibilityText) + ')' }} |
| 21 | + </label> |
| 22 | + |
| 23 | + <label> |
| 24 | + <input type="radio" name="visibility" value="visible" |
| 25 | + :checked="currentVisibilityOption == 'visible'" |
| 26 | + v-model="visibilityOption" |
| 27 | + > |
| 28 | + {{ $gettext('Videos standardmäßig sichtbar für Studierende') }} |
| 29 | + </label> |
| 30 | + |
| 31 | + <label> |
| 32 | + <input type="radio" name="visibility" value="hidden" |
| 33 | + :checked="currentVisibilityOption == 'hidden'" |
| 34 | + v-model="visibilityOption" |
| 35 | + > |
| 36 | + {{ $gettext('Videos standardmäßig unsichtbar für Studierende') }} |
| 37 | + </label> |
| 38 | + </form> |
| 39 | + </template> |
| 40 | + </StudipDialog> |
| 41 | + </div> |
| 42 | +</template> |
| 43 | + |
| 44 | +<script> |
| 45 | +import { ref, computed, onBeforeMount } from 'vue' |
| 46 | +import { useStore } from "vuex"; |
| 47 | +import { useGettext } from 'vue3-gettext'; |
| 48 | +
|
| 49 | +import StudipDialog from "@/components/Studip/StudipDialog.vue"; |
| 50 | +
|
| 51 | +export default { |
| 52 | + name: "EpisodesDefaultVisibilityDialog", |
| 53 | + components: { |
| 54 | + StudipDialog, |
| 55 | + }, |
| 56 | + emits: ['done', 'cancel'], |
| 57 | +
|
| 58 | + setup(props, { emit }) { |
| 59 | + const { $gettext } = useGettext(); |
| 60 | + const store = useStore(); |
| 61 | +
|
| 62 | + const visibilityOption = ref(); |
| 63 | + const cid = computed(() => store.getters.cid); |
| 64 | + const standardVisibilityText = computed(() => { |
| 65 | + return store.getters.simple_config_list?.settings?.OPENCAST_HIDE_EPISODES ? |
| 66 | + $gettext('Videos standardmäßig unsichtbar für Studierende') : $gettext('Videos standardmäßig sichtbar für Studierende'); |
| 67 | + }); |
| 68 | + const currentVisibilityOption = computed(() => { |
| 69 | + return store.getters.course_config?.course_default_episodes_visibility ?? 'default'; |
| 70 | + }); |
| 71 | +
|
| 72 | + const setCourseEpisodesVisibility = () => { |
| 73 | + store.dispatch('setCourseEpisodesVisibility', { |
| 74 | + cid: store.getters.cid, |
| 75 | + visibility_option: visibilityOption.value |
| 76 | + }).then((data) => { |
| 77 | + store.dispatch('loadCourseConfig', store.getters.cid); |
| 78 | + store.dispatch('loadCourseConfig', store.getters.cid); |
| 79 | + emit('done'); |
| 80 | + }); |
| 81 | + } |
| 82 | +
|
| 83 | + onBeforeMount(() => { |
| 84 | + // Make sure that the visibilityOption gets its inital value from computed variable! |
| 85 | + visibilityOption.value = currentVisibilityOption.value; |
| 86 | + }) |
| 87 | +
|
| 88 | + return { |
| 89 | + setCourseEpisodesVisibility, |
| 90 | + currentVisibilityOption, |
| 91 | + visibilityOption, |
| 92 | + cid, |
| 93 | + standardVisibilityText, |
| 94 | + } |
| 95 | + } |
| 96 | +} |
| 97 | +</script> |
0 commit comments