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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
<template>
<div class="likert_edit">
<div class="formpart" tabindex="0" ref="autofocus">
{{ $gettext('Einleitungstext' )}}
<StudipWysiwyg v-model="val_clone.description" />
</div>
<InputArray v-model="val_clone.statements"
:label="$gettext('Aussage')"
:label-plural="$gettext('Aussagen')"
:additional-colspan="val_clone.options.length"
>
<template #header-cells>
<th v-for="(option, index) in val_clone.options" class="option-cell" :key="index">
{{ option }}
</th>
</template>
<template #body-cells>
<td v-for="(option, index) in val_clone.options" class="option-cell" :key="index">
<input type="radio" disabled :title="option">
</td>
</template>
</InputArray>
<label>
<input type="checkbox" v-model.number="val_clone.mandatory" true-value="1" false-value="0">
{{ $gettext('Pflichtfrage') }}
</label>
<label>
<input type="checkbox" v-model.number="val_clone.randomize" true-value="1" false-value="0">
{{ $gettext('Antworten den Teilnehmenden zufällig präsentieren') }}
</label>
<div>
<div>{{ $gettext('Antwortmöglichkeiten konfigurieren') }}</div>
<InputArray v-model="val_clone.options" />
</div>
</div>
</template>
<script>
import { $gettext } from '../../../assets/javascripts/lib/gettext';
import InputArray from "./InputArray.vue";
import { QuestionnaireComponent } from '../../mixins/QuestionnaireComponent';
// This is necesssar since $gettext does not seem to work in data() or created()
const default_values = () => ({
description: '',
statements: ['', '', '', ''],
mandatory: 0,
randomize: 0,
options: [
$gettext('trifft zu'),
$gettext('trifft eher zu'),
$gettext('teils-teils'),
$gettext('trifft eher nicht zu'),
$gettext('trifft nicht zu'),
],
});
export default {
name: 'likert-edit',
components: { InputArray },
mixins: [ QuestionnaireComponent ],
created() {
this.setDefaultValues(default_values());
},
mounted() {
this.$refs.autofocus.focus();
}
}
</script>
|