aboutsummaryrefslogtreecommitdiff
path: root/resources/vue/components/questionnaires/QuestionnaireInfoEdit.vue
blob: 828d24e7c392d62b945cc9c630a9ece226ae0fc3 (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
<template>
    <div class="vote_edit">
        <label>
            {{ $gettext('Link eines Videos oder einer anderen Informationsseite (optional)') }}
            <input type="url" v-model="val_clone.url" v-autofocus ref="infoUrl"
                   @input="checkValidity()">
        </label>

        <div class="formpart">
            {{ $gettext('Hinweistext (optional)') }}
            <StudipWysiwyg v-model="val_clone.description" />
        </div>
    </div>
</template>

<script>
import { QuestionnaireComponent } from '../../mixins/QuestionnaireComponent';
import StudipWysiwyg from "../StudipWysiwyg.vue";

export default {
    name: 'questionnaire-info-edit',
    extends: QuestionnaireComponent,
    components: {StudipWysiwyg},
    created() {
        this.setDefaultValues({
            url: '',
            description: ''
        });
    },
    mounted() {
        this.checkValidity();
    },
    methods: {
        checkValidity() {
            this.$refs.infoUrl.setCustomValidity('');

            if (!this.$refs.infoUrl.checkValidity()) {
                this.$refs.infoUrl.setCustomValidity(
                    this.$gettext('Der eingegebene Link ist nicht korrekt und wird nicht angezeigt werden.')
                );
                this.$refs.infoUrl.reportValidity();
            }
        }
    }
}
</script>