Selaa lähdekoodia

checklist working

tags/0.0.1
diaseu 4 vuotta sitten
vanhempi
commit
8bbf407ea3

+ 7
- 2
frontend/src/components/form.vue Näytä tiedosto

23
                 ) {{ response }}
23
                 ) {{ response }}
24
             //- TODO: Checklist
24
             //- TODO: Checklist
25
             .response-wrapper(v-if='prompt.type === "checklist"')
25
             .response-wrapper(v-if='prompt.type === "checklist"')
26
-                .checklist(v-for='response in prompt.responses')
26
+                .checklist(
27
+                    v-for='(response, index) in prompt.responses'
28
+                    v-bind:key='response')
27
                     input(
29
                     input(
28
                         type='checkbox'
30
                         type='checkbox'
29
                         :id='response'
31
                         :id='response'
32
+                        :value='response'
30
                         :name='response'
33
                         :name='response'
34
+                        :true-value='response'
35
+                        false-value=''
31
                         v-model='answers[makeKebob(prompt.question)]')
36
                         v-model='answers[makeKebob(prompt.question)]')
32
-                    label {{ response}}
37
+                    label(:for='response') {{ response }}
33
             //- TODO: Slider from -3 to 0 to +3 (increments of 1)
38
             //- TODO: Slider from -3 to 0 to +3 (increments of 1)
34
             .response-wrapper(v-if='prompt.type === "slider"')
39
             .response-wrapper(v-if='prompt.type === "slider"')
35
                 label {{ prompt.type }}
40
                 label {{ prompt.type }}

+ 2
- 2
frontend/src/services/survey.service.js Näytä tiedosto

32
                 id: 3,
32
                 id: 3,
33
                 type: 'checklist',
33
                 type: 'checklist',
34
                 question: 'what is your current status',
34
                 question: 'what is your current status',
35
-                responses: ['employed', 'unemployed'],
35
+                responses: ['employed', 'unemployed', 'degenerate', 'alien'],
36
             },
36
             },
37
         ],
37
         ],
38
         [
38
         [
40
                 id: 4,
40
                 id: 4,
41
                 type: 'slider',
41
                 type: 'slider',
42
                 question: 'whats your favorite number',
42
                 question: 'whats your favorite number',
43
-                responses: ['1', '2', '3'],
43
+                responses: null,
44
             },
44
             },
45
         ],
45
         ],
46
     ]
46
     ]

+ 6
- 4
frontend/src/views/Survey.vue Näytä tiedosto

40
     header
40
     header
41
         color: #ccc
41
         color: #ccc
42
         font-style: italic
42
         font-style: italic
43
-    > *
43
+    header, footer, ul
44
         padding: 1vh
44
         padding: 1vh
45
     ul
45
     ul
46
         display: flex
46
         display: flex
47
-        color: blue
47
+        /* color: blue */
48
         width: 100%
48
         width: 100%
49
         li
49
         li
50
             flex-direction: column
50
             flex-direction: column
51
             border: 0px solid yellow
51
             border: 0px solid yellow
52
             width: 100%
52
             width: 100%
53
+            padding: 0
54
+            text-align: left
53
             label
55
             label
54
                 margin-right: 1vh
56
                 margin-right: 1vh
55
-            > *
57
+            > h3
56
                 text-transform: capitalize
58
                 text-transform: capitalize
57
-                padding: 1vh
59
+                padding: 1vh 0
58
 </style>
60
 </style>

Loading…
Peruuta
Tallenna