Explorar el Código

slide survey added and working

tags/0.0.1
diaseu hace 4 años
padre
commit
dd88eb738c

+ 5
- 2
frontend/src/components/form.vue Ver fichero

36
                         v-model='answers[makeKebob(prompt.question)]')
36
                         v-model='answers[makeKebob(prompt.question)]')
37
                     label(:for='response') {{ response }}
37
                     label(:for='response') {{ response }}
38
             //- TODO: Slider from -3 to 0 to +3 (increments of 1)
38
             //- TODO: Slider from -3 to 0 to +3 (increments of 1)
39
-            .response-wrapper(v-if='prompt.type === "slider"')
39
+            .response-wrapper(v-else-if='prompt.type === "slide"')
40
                 label {{ prompt.type }}
40
                 label {{ prompt.type }}
41
                 input(
41
                 input(
42
                     type='range'
42
                     type='range'
43
                     min='-3'
43
                     min='-3'
44
                     max='3'
44
                     max='3'
45
                     v-model='answers[makeKebob(prompt.question)]')
45
                     v-model='answers[makeKebob(prompt.question)]')
46
+                span {{ answers[makeKebob(prompt.question)] }}
46
 
47
 
47
     footer.f-row.w-full
48
     footer.f-row.w-full
48
         button.p-1(:disabled='state.step == 1' @click='back') back
49
         button.p-1(:disabled='state.step == 1' @click='back') back
55
 <script setup>
56
 <script setup>
56
 import Joi from 'joi'
57
 import Joi from 'joi'
57
 import { validatorMapping, makeKebob } from '@/utils'
58
 import { validatorMapping, makeKebob } from '@/utils'
58
-import { defineProps, reactive } from 'vue'
59
+import { defineProps, reactive, ref } from 'vue'
60
+
61
+const slidevalue = ref('')
59
 
62
 
60
 const props = defineProps({
63
 const props = defineProps({
61
     form: {
64
     form: {

+ 10
- 2
frontend/src/services/survey.service.js Ver fichero

38
         [
38
         [
39
             {
39
             {
40
                 id: 4,
40
                 id: 4,
41
-                type: 'slider',
42
-                question: 'whats your favorite number',
41
+                type: 'slide',
42
+                question: 'choose a num',
43
                 responses: null,
43
                 responses: null,
44
             },
44
             },
45
         ],
45
         ],
46
+        [
47
+            {
48
+                id: 5,
49
+                type: 'checklist',
50
+                question: 'pick a status',
51
+                responses: ['cry', 'sad', 'mad', 'numb'],
52
+            },
53
+        ],
46
     ]
54
     ]
47
     const mysurvey = new Survey(myquestions)
55
     const mysurvey = new Survey(myquestions)
48
     return mysurvey
56
     return mysurvey

+ 2
- 0
frontend/src/utils/index.js Ver fichero

6
 const validatorMapping = {
6
 const validatorMapping = {
7
     'input-string': Joi.string(),
7
     'input-string': Joi.string(),
8
     'tag-cloud': Joi.string(),
8
     'tag-cloud': Joi.string(),
9
+    'checklist': Joi.string(),
10
+    'slide': Joi.string(),
9
 }
11
 }
10
 
12
 
11
 const makeKebob = input => {
13
 const makeKebob = input => {

+ 3
- 0
frontend/src/views/Survey.vue Ver fichero

57
             > h3
57
             > h3
58
                 text-transform: capitalize
58
                 text-transform: capitalize
59
                 padding: 1vh 0
59
                 padding: 1vh 0
60
+            > div > span
61
+                display: block
62
+                text-align: center
60
 </style>
63
 </style>

Loading…
Cancelar
Guardar