@windward/games 0.0.8 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/components/content/blocks/dragDrop/BucketGame.vue +41 -87
  2. package/components/content/blocks/dragDrop/SortingGame.vue +43 -29
  3. package/components/content/blocks/flashcards/FlashcardSlides.vue +3 -1
  4. package/components/content/blocks/matchingGame/MatchingGame.vue +94 -51
  5. package/components/content/blocks/quizshowGame/AnswerPanel.vue +93 -96
  6. package/components/content/blocks/quizshowGame/QuizShow.vue +54 -31
  7. package/components/content/blocks/slideshow/SlideShow.vue +3 -1
  8. package/components/content/blocks/wordJumble/Jumble.vue +4 -2
  9. package/components/content/blocks/wordJumble/WordJumble.vue +11 -2
  10. package/components/settings/BucketGameSettingsManager.vue +175 -349
  11. package/components/settings/FlashCardSlidesManager.vue +335 -414
  12. package/components/settings/MatchingGameManager.vue +357 -618
  13. package/components/settings/QuizShowSettingsManager.vue +228 -201
  14. package/components/settings/SlideShowManager.vue +89 -127
  15. package/components/settings/SortingGameSettingsManager.vue +32 -144
  16. package/components/settings/WordJumbleSettingsManager.vue +48 -142
  17. package/i18n/en-US/components/content/blocks/bucket_game.ts +1 -0
  18. package/i18n/en-US/components/content/blocks/flashcard.ts +2 -0
  19. package/i18n/en-US/components/content/blocks/quizshow_game.ts +1 -1
  20. package/i18n/en-US/components/settings/matching_game.ts +1 -1
  21. package/i18n/en-US/components/settings/quizshow_game.ts +8 -2
  22. package/i18n/en-US/components/settings/slideshow.ts +2 -0
  23. package/i18n/es-ES/components/content/blocks/bucket_game.ts +40 -0
  24. package/i18n/es-ES/components/content/blocks/crossword.ts +25 -0
  25. package/i18n/es-ES/components/content/blocks/flashcard.ts +7 -0
  26. package/i18n/es-ES/components/content/blocks/index.ts +23 -0
  27. package/i18n/es-ES/components/content/blocks/matching_game.ts +26 -0
  28. package/i18n/es-ES/components/content/blocks/multiple_choice.ts +9 -0
  29. package/i18n/es-ES/components/content/blocks/quizshow_game.ts +35 -0
  30. package/i18n/es-ES/components/content/blocks/seven_strikes.ts +6 -0
  31. package/i18n/es-ES/components/content/blocks/slideshow.ts +13 -0
  32. package/i18n/es-ES/components/content/blocks/sorting_game.ts +5 -0
  33. package/i18n/es-ES/components/content/blocks/word_jumble.ts +9 -0
  34. package/i18n/es-ES/components/content/crud_table.ts +6 -0
  35. package/i18n/es-ES/components/content/index.ts +7 -0
  36. package/i18n/es-ES/components/index.ts +9 -0
  37. package/i18n/es-ES/components/navigation/index.ts +5 -0
  38. package/i18n/es-ES/components/settings/bucket_game.ts +38 -0
  39. package/i18n/es-ES/components/settings/crossword.ts +7 -0
  40. package/i18n/es-ES/components/settings/flashcard.ts +28 -0
  41. package/i18n/es-ES/components/settings/index.ts +23 -0
  42. package/i18n/es-ES/components/settings/matching_game.ts +15 -0
  43. package/i18n/es-ES/components/settings/multiple_choice.ts +17 -0
  44. package/i18n/es-ES/components/settings/quizshow_game.ts +20 -0
  45. package/i18n/es-ES/components/settings/seven_strikes.ts +8 -0
  46. package/i18n/es-ES/components/settings/slideshow.ts +13 -0
  47. package/i18n/es-ES/components/settings/sorting_game.ts +5 -0
  48. package/i18n/es-ES/components/settings/word_jumble.ts +11 -0
  49. package/i18n/es-ES/index.ts +15 -0
  50. package/i18n/es-ES/modules/index.ts +5 -0
  51. package/i18n/es-ES/pages/index.ts +5 -0
  52. package/i18n/es-ES/shared/content_blocks.ts +18 -0
  53. package/i18n/es-ES/shared/index.ts +7 -0
  54. package/i18n/es-ES/shared/settings.ts +14 -0
  55. package/i18n/sv-SE/components/content/blocks/bucket_game.ts +40 -0
  56. package/i18n/sv-SE/components/content/blocks/crossword.ts +20 -0
  57. package/i18n/sv-SE/components/content/blocks/flashcard.ts +7 -0
  58. package/i18n/sv-SE/components/content/blocks/index.ts +23 -0
  59. package/i18n/sv-SE/components/content/blocks/matching_game.ts +25 -0
  60. package/i18n/sv-SE/components/content/blocks/multiple_choice.ts +9 -0
  61. package/i18n/sv-SE/components/content/blocks/quizshow_game.ts +35 -0
  62. package/i18n/sv-SE/components/content/blocks/seven_strikes.ts +6 -0
  63. package/i18n/sv-SE/components/content/blocks/slideshow.ts +13 -0
  64. package/i18n/sv-SE/components/content/blocks/sorting_game.ts +5 -0
  65. package/i18n/sv-SE/components/content/blocks/word_jumble.ts +9 -0
  66. package/i18n/sv-SE/components/content/crud_table.ts +6 -0
  67. package/i18n/sv-SE/components/content/index.ts +7 -0
  68. package/i18n/sv-SE/components/index.ts +9 -0
  69. package/i18n/sv-SE/components/navigation/index.ts +5 -0
  70. package/i18n/sv-SE/components/settings/bucket_game.ts +38 -0
  71. package/i18n/sv-SE/components/settings/crossword.ts +7 -0
  72. package/i18n/sv-SE/components/settings/flashcard.ts +28 -0
  73. package/i18n/sv-SE/components/settings/index.ts +23 -0
  74. package/i18n/sv-SE/components/settings/matching_game.ts +15 -0
  75. package/i18n/sv-SE/components/settings/multiple_choice.ts +16 -0
  76. package/i18n/sv-SE/components/settings/quizshow_game.ts +20 -0
  77. package/i18n/sv-SE/components/settings/seven_strikes.ts +8 -0
  78. package/i18n/sv-SE/components/settings/slideshow.ts +13 -0
  79. package/i18n/sv-SE/components/settings/sorting_game.ts +5 -0
  80. package/i18n/sv-SE/components/settings/word_jumble.ts +11 -0
  81. package/i18n/sv-SE/index.ts +15 -0
  82. package/i18n/sv-SE/modules/index.ts +5 -0
  83. package/i18n/sv-SE/pages/index.ts +5 -0
  84. package/i18n/sv-SE/shared/content_blocks.ts +18 -0
  85. package/i18n/sv-SE/shared/index.ts +7 -0
  86. package/i18n/sv-SE/shared/settings.ts +14 -0
  87. package/package.json +1 -1
  88. package/i18n/en-US.ts +0 -5
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="background">
2
+ <div>
3
3
  <div>
4
4
  <h3
5
5
  :aria-label="
@@ -40,8 +40,16 @@
40
40
  class="success mr-5"
41
41
  @click="onContinueGame"
42
42
  >{{ $t('shared.forms.continue') }}
43
- </v-btn></v-col
44
- >
43
+ </v-btn>
44
+ <v-container
45
+ v-if="status === 'errorOutline'"
46
+ class="d-flex justify-end"
47
+ @click="onExitFeedback"
48
+ ><v-icon class="icon--error"
49
+ >mdi-close-circle</v-icon
50
+ >
51
+ </v-container>
52
+ </v-col>
45
53
  </v-row>
46
54
  <br />
47
55
  </v-container>
@@ -49,8 +57,8 @@
49
57
  <v-container>
50
58
  <v-row>
51
59
  <draggable
52
- class="d-flex justify-space-between flex-wrap col-md-12"
53
60
  v-bind="dragOptions"
61
+ class="d-flex justify-space-between flex-wrap col-md-12"
54
62
  :list="block.metadata.config.answerObjects"
55
63
  :disabled="!allowDrag"
56
64
  :group="{
@@ -69,7 +77,7 @@
69
77
  tile
70
78
  color="primary"
71
79
  >
72
- <v-icon>mdi-gesture-tap-hold</v-icon>
80
+ <v-icon>mdi-drag-vertical</v-icon>
73
81
  <span>
74
82
  {{ answer.display }}
75
83
  </span>
@@ -77,8 +85,8 @@
77
85
  </draggable>
78
86
  </v-row>
79
87
  <v-row
80
- class="d-flex flex-wrap flex-row justify-center flex-fill"
81
88
  v-if="render"
89
+ class="d-flex flex-wrap flex-row justify-center flex-fill"
82
90
  >
83
91
  <v-row align="center" class="col-md-12">
84
92
  <v-card
@@ -154,17 +162,17 @@
154
162
  </v-row>
155
163
  </v-row>
156
164
  <v-row
157
- class="d-flex flex-wrap flex-row justify-center flex-fill"
158
165
  v-if="
159
166
  !render && block.metadata.config.prompts.length > 0
160
167
  "
168
+ class="d-flex flex-wrap flex-row justify-center flex-fill"
161
169
  >
162
170
  <v-row align="center" class="col-md-12">
163
171
  <v-card
164
172
  v-if="
165
173
  !block.metadata.config.prompts[
166
174
  startingIndex
167
- ]['toggle']
175
+ ][startingIndex].toggle
168
176
  "
169
177
  class="pa-2 flex-fill bucket"
170
178
  min-height="5em"
@@ -174,13 +182,8 @@
174
182
  >
175
183
  <v-card-text class="text-center">
176
184
  <draggable
177
- class="dragArea list-group"
178
- :key="
179
- block.metadata.config.prompts[
180
- startingIndex
181
- ]['prompt']
182
- "
183
185
  v-bind="dragOptions"
186
+ class="dragArea list-group"
184
187
  disabled
185
188
  group="people"
186
189
  tabindex="0"
@@ -192,7 +195,7 @@
192
195
  {{
193
196
  block.metadata.config.prompts[
194
197
  startingIndex
195
- ]['prompt']
198
+ ][startingIndex].prompt
196
199
  }}
197
200
  </div>
198
201
  </draggable>
@@ -204,7 +207,10 @@
204
207
  v-if="
205
208
  block.metadata.config.prompts[
206
209
  startingIndex
207
- ]['file']
210
+ ][startingIndex].toggle &&
211
+ block.metadata.config.prompts[
212
+ startingIndex
213
+ ][startingIndex].file
208
214
  "
209
215
  class="pa-2 flex-fill bucket"
210
216
  min-height="5em"
@@ -213,13 +219,13 @@
213
219
  >
214
220
  <v-card-text>
215
221
  <draggable
222
+ v-bind="dragOptions"
216
223
  class="dragArea list-group"
217
224
  :key="
218
225
  block.metadata.config.prompts[
219
226
  startingIndex
220
227
  ]['prompt']
221
228
  "
222
- v-bind="dragOptions"
223
229
  disabled
224
230
  group="people"
225
231
  tabindex="0"
@@ -228,33 +234,36 @@
228
234
  :id="
229
235
  block.metadata.config.prompts[
230
236
  startingIndex
231
- ]['file']['asset']['public_url']
237
+ ][startingIndex].file.asset
238
+ .public_url
232
239
  "
233
240
  >
234
241
  <v-img
235
242
  v-if="
236
243
  block.metadata.config
237
244
  .prompts[startingIndex][
238
- 'file'
239
- ]
245
+ startingIndex
246
+ ]['file']
240
247
  "
241
248
  :aria-describedby="
242
249
  block.metadata.config
243
250
  .prompts[startingIndex][
244
- 'ariaDescribedBy'
245
- ]
251
+ startingIndex
252
+ ]['ariaDescribedBy']
246
253
  "
247
254
  :alt="
248
255
  block.metadata.config
249
256
  .prompts[startingIndex][
250
- 'altText'
251
- ]
257
+ startingIndex
258
+ ]['altText']
252
259
  "
253
260
  :src="
254
261
  block.metadata.config
255
262
  .prompts[startingIndex][
256
- 'file'
257
- ]['asset']['public_url']
263
+ startingIndex
264
+ ]['file']['asset'][
265
+ 'public_url'
266
+ ]
258
267
  "
259
268
  ></v-img>
260
269
  </div>
@@ -294,9 +303,9 @@
294
303
  )
295
304
  }}
296
305
  <v-progress-linear
306
+ v-model="completedPercent"
297
307
  color="primary"
298
308
  outlined
299
- v-model="completedPercent"
300
309
  rounded
301
310
  height="15"
302
311
  ></v-progress-linear>
@@ -342,16 +351,22 @@ export default {
342
351
  this.block.metadata.config = {}
343
352
  }
344
353
  if (_.isEmpty(this.block.metadata.config.title)) {
345
- this.block.metadata.config.title = ''
354
+ this.block.metadata.config.title = this.$t(
355
+ 'plugin.games.components.settings.matching_game.form.title'
356
+ )
346
357
  }
347
358
  if (_.isEmpty(this.block.metadata.config.instructions)) {
348
359
  this.block.metadata.config.instructions = ''
349
360
  }
350
361
  if (_.isEmpty(this.block.metadata.config.feedback_correct)) {
351
- this.block.metadata.config.feedback_correct = ''
362
+ this.block.metadata.config.feedback_correct = this.$t(
363
+ 'plugin.games.components.settings.bucket_game.form.feedback.correct_default'
364
+ )
352
365
  }
353
366
  if (_.isEmpty(this.block.metadata.config.feedback_incorrect)) {
354
- this.block.metadata.config.feedback_incorrect = ''
367
+ this.block.metadata.config.feedback_incorrect = this.$t(
368
+ 'plugin.games.components.settings.bucket_game.form.feedback.incorrect_default'
369
+ )
355
370
  }
356
371
  if (_.isEmpty(this.block.metadata.config.prompts)) {
357
372
  this.block.metadata.config.prompts = []
@@ -370,10 +385,10 @@ export default {
370
385
  return _.flatten(this.solvedQuestions).length
371
386
  },
372
387
  completedPercent() {
373
- if (this.block.metadata.config.prompts.length > 0) {
388
+ if (this.flattenedPrompts.length > 0) {
374
389
  return (
375
390
  (this.solvedQuestions.length /
376
- this.block.metadata.config.prompts.length) *
391
+ this.flattenedPrompts.length) *
377
392
  100
378
393
  )
379
394
  }
@@ -388,7 +403,6 @@ export default {
388
403
  feedback: this.$t(
389
404
  'plugin.games.components.content.blocks.matching_game.default_feedback'
390
405
  ),
391
- toggle: false,
392
406
  gameCompleted: false,
393
407
  shufflePrompts: [],
394
408
  solvedQuestions: [],
@@ -404,9 +418,10 @@ export default {
404
418
  name: '',
405
419
  },
406
420
  prompt: '',
421
+ toggle: false,
407
422
  },
408
- editedPrompt: {},
409
423
  startingIndex: 0,
424
+ flattenedPrompts: '',
410
425
  }
411
426
  },
412
427
  watch: {
@@ -415,8 +430,13 @@ export default {
415
430
  this.onReset()
416
431
  }
417
432
  },
433
+ value(newValue) {
434
+ this.flattenedPrompts = _.flatten(newValue.metadata.config.prompts)
435
+ },
418
436
  },
419
437
  mounted() {
438
+ // flatten nested prompts
439
+ this.flattenedPrompts = _.flatten(this.block.metadata.config.prompts)
420
440
  this.setMainPrompt()
421
441
  },
422
442
  methods: {
@@ -437,10 +457,9 @@ export default {
437
457
  return array
438
458
  },
439
459
  setMainPrompt() {
440
- if (this.block.metadata.config.prompts.length !== 0) {
441
- this.shufflePrompts = _.cloneDeep(
442
- this.block.metadata.config.prompts
443
- )
460
+ const holder = this.block.metadata.config.prompts.flat(1)
461
+ if (holder !== 0 && !_.isEmpty(holder)) {
462
+ this.shufflePrompts = _.cloneDeep(holder)
444
463
  this.shufflePrompts = this.shuffle(this.shufflePrompts)
445
464
  this.mainPrompt = this.shufflePrompts.shift()
446
465
  }
@@ -452,25 +471,40 @@ export default {
452
471
  }
453
472
  let draggedElement = ''
454
473
  let target = ''
455
- if (this.mainPrompt.toggle === false) {
474
+ if (
475
+ this.mainPrompt.toggle === false ||
476
+ !_.isBoolean(this.mainPrompt.toggle)
477
+ ) {
456
478
  draggedElement =
457
479
  this.block.metadata.config.answerObjects[evt.oldIndex]
458
- target = this.block.metadata.config.prompts.find((element) => {
459
- return (
460
- element.prompt == evt.to.firstChild.textContent.trim()
461
- )
480
+ this.block.metadata.config.prompts.forEach((outerElement) => {
481
+ const getMain = outerElement.find((element) => {
482
+ return (
483
+ element.prompt ==
484
+ evt.to.firstChild.textContent.trim()
485
+ )
486
+ })
487
+ if (getMain) {
488
+ target = getMain
489
+ }
462
490
  })
463
491
  } else {
464
492
  draggedElement =
465
493
  this.block.metadata.config.answerObjects[evt.oldIndex]
466
- target = this.block.metadata.config.prompts.find((element) => {
467
- return (
468
- element.file?.asset.public_url ==
469
- evt.to.firstElementChild.id
470
- )
494
+ this.block.metadata.config.prompts.forEach((outerElement) => {
495
+ const mainElement = outerElement.find((element) => {
496
+ return (
497
+ element.file?.asset.public_url ==
498
+ evt.to.firstElementChild.id
499
+ )
500
+ })
501
+ if (mainElement) {
502
+ target = mainElement
503
+ }
471
504
  })
472
505
  }
473
- if (_.isUndefined(target)) {
506
+ if (_.isUndefined(target) || _.isEmpty(target)) {
507
+ console.log('dragged to nowhere')
474
508
  } else if (draggedElement.id !== target.answer.id) {
475
509
  this.feedback = this.block.metadata.config.feedback_incorrect
476
510
  this.status = 'errorOutline'
@@ -480,8 +514,7 @@ export default {
480
514
  this.status = 'successOutline'
481
515
  this.allowDrag = false
482
516
  if (
483
- this.solvedQuestions.length ===
484
- this.block.metadata.config.prompts.length
517
+ this.solvedQuestions.length === this.flattenedPrompts.length
485
518
  ) {
486
519
  this.feedback = this.$t(
487
520
  'plugin.games.components.content.blocks.matching_game.congratulations_feedback'
@@ -491,6 +524,13 @@ export default {
491
524
  }
492
525
  }
493
526
  },
527
+ onExitFeedback() {
528
+ this.status = 'default'
529
+ this.allowDrag = true
530
+ this.feedback = this.$t(
531
+ 'plugin.games.components.content.blocks.matching_game.default_feedback'
532
+ )
533
+ },
494
534
  onContinueGame() {
495
535
  if (!this.render) {
496
536
  this.startingIndex = this.startingIndex + 1
@@ -538,6 +578,9 @@ export default {
538
578
  .answerCard {
539
579
  min-width: 23%;
540
580
  }
581
+ .icon--error {
582
+ color: var(--v-error-base);
583
+ }
541
584
  @media (max-width: 1270px) {
542
585
  .answerCard {
543
586
  min-width: 30%;
@@ -22,55 +22,63 @@
22
22
  </div>
23
23
  </v-row>
24
24
  <br />
25
+ <v-row v-if="editMode">
26
+ <v-icon>mdi-help</v-icon>
27
+ <div>
28
+ {{
29
+ $t(
30
+ 'plugin.games.components.content.blocks.quizshow_game.form.question'
31
+ )
32
+ }}
33
+ </div></v-row
34
+ >
25
35
  <v-row
26
36
  align="center"
27
37
  justify="center"
28
38
  class="pa-4 mb-4 font-weight-bold text-capitalize"
29
39
  >
30
- <v-textarea
40
+ <TextEditor
31
41
  v-if="editMode"
32
42
  v-model="question.text"
33
- :counter="255"
34
- maxlength="255"
35
- :label="
36
- $t(
37
- 'plugin.games.components.content.blocks.quizshow_game.form.question'
38
- )
39
- "
40
- @input=""
41
- ></v-textarea>
42
- <v-card flat v-if="!editMode" v-html="question.text"></v-card>
43
+ class="col-md-12"
44
+ menubar="edit insert format"
45
+ toolbar="undo redo | italic underline strikethrough removeformat | mathButton "
46
+ :height="250"
47
+ lazy-load
48
+ auto-grow
49
+ ></TextEditor>
50
+ <TextViewer v-if="!editMode" v-model="question.text"></TextViewer>
43
51
  </v-row>
44
52
  <v-row
45
53
  align="center"
46
54
  justify="center"
47
55
  class="pa-4 mb-4 font-weight-bold text-capitalize"
48
56
  >
49
- <v-text-field
57
+ <v-textarea
50
58
  v-if="editMode"
51
59
  v-model="question.feedback"
52
60
  :counter="255"
53
- maxlength="255"
54
61
  :label="
55
62
  $t(
56
- 'plugin.games.components.content.blocks.quizshow_game.feedback.feedback'
63
+ 'plugin.games.components.content.blocks.quizshow_game.feedback.answer'
57
64
  )
58
65
  "
59
- ></v-text-field>
66
+ rows="2"
67
+ prepend-inner-icon="mdi-comment"
68
+ ></v-textarea>
60
69
  </v-row>
61
70
 
62
71
  <div class="d-flex flex-column">
63
72
  <v-row
64
73
  v-for="(choice, choice_index) in question.choices"
65
74
  :key="choice_index"
75
+ :class="!editMode ? 'pb-4' : ''"
66
76
  >
67
- <v-card
68
- v-ripple
69
- v-if="!editMode"
70
- @click="getUserInput(choice_index)"
71
- class="ma-1 pa-5 justify-start flex-fill"
72
- :class="generateButtonColor(choice_index)"
73
- :outlined="generateButtonOutline(choice_index)"
77
+ <v-col
78
+ cols="12"
79
+ md="2"
80
+ class="d-flex justify-end"
81
+ align-self="center"
74
82
  >
75
83
  <v-icon
76
84
  color="success"
@@ -81,8 +89,8 @@
81
89
  choice_index === userInput
82
90
  "
83
91
  >
84
- mdi-check-circle-outline</v-icon
85
- >
92
+ mdi-check-circle
93
+ </v-icon>
86
94
  <v-icon
87
95
  color="error"
88
96
  v-if="
@@ -92,42 +100,52 @@
92
100
  choice_index === userInput
93
101
  "
94
102
  >
95
- mdi-close-circle-outline</v-icon
103
+ mdi-close-circle
104
+ </v-icon>
105
+ <v-radio-group v-if="editMode" v-model="question.answer">
106
+ <v-radio
107
+ :ref="'checkbox' + choice_index"
108
+ :value="choice_index"
109
+ @click="onSetAnswer(choice_index)"
110
+ ></v-radio>
111
+ </v-radio-group>
112
+ </v-col>
113
+ <v-col cols="12" md="8" class="pa-0">
114
+ <v-card
115
+ v-ripple
116
+ v-if="!editMode"
117
+ @click="getUserInput(choice_index)"
118
+ class="pa-2 answer_display"
119
+ :class="generateButtonColor(choice_index)"
120
+ outlined
96
121
  >
97
- <span v-html="mathToHtml(choice.text)"></span>
98
- <v-icon
99
- class="info-icon"
100
- v-if="generateButtonColor(choice_index) === 'success'"
101
- @click="onFeedback"
102
- >mdi-information</v-icon
122
+ <span v-html="mathToHtml(choice.text)"></span>
123
+ <v-icon
124
+ class="info-icon"
125
+ v-if="
126
+ generateButtonColor(choice_index) === 'success'
127
+ "
128
+ @click="onFeedback"
129
+ >mdi-information
130
+ </v-icon>
131
+ </v-card>
132
+ <v-text-field
133
+ class="pa-0"
134
+ v-if="editMode"
135
+ v-model="question.choices[choice_index].text"
136
+ :label="
137
+ $t(
138
+ 'plugin.games.components.content.blocks.quizshow_game.form.choice'
139
+ )
140
+ "
141
+ outlined
142
+ @input=""
143
+ append-icon="mdi-delete-outline"
144
+ color="primary"
145
+ @click:append="deleteItem(choice)"
103
146
  >
104
- </v-card>
105
- <v-text-field
106
- v-if="editMode"
107
- v-model="question.choices[choice_index].text"
108
- :counter="255"
109
- maxlength="255"
110
- :label="
111
- $t(
112
- 'plugin.games.components.content.blocks.quizshow_game.form.choice'
113
- )
114
- "
115
- outlined
116
- @input=""
117
- ></v-text-field>
118
- <v-switch
119
- v-if="editMode"
120
- :disabled="
121
- !question.choices[choice_index].is_answer &&
122
- question.answer !== null
123
- "
124
- v-model="question.choices[choice_index].is_answer"
125
- :label="`is answer`"
126
- @click="setAnswer(choice_index)"
127
- ></v-switch>
128
- <v-icon v-if="editMode" @click="deleteItem(choice)">
129
- mdi-delete
130
- </v-icon>
147
+ </v-text-field>
148
+ </v-col>
131
149
  </v-row>
132
150
  </div>
133
151
  <v-row
@@ -139,7 +157,7 @@
139
157
  v-if="editMode"
140
158
  @click="addChoice"
141
159
  class="ma-1 pa-5 justify-start"
142
- color="secondary"
160
+ color="primary"
143
161
  outlined
144
162
  >
145
163
  {{
@@ -196,10 +214,11 @@
196
214
  <script>
197
215
  import Dialog from '~/components/Dialog.vue'
198
216
  import { MathHelper } from '@windward/core/utils'
199
-
217
+ import TextEditor from '~/components/Text/TextEditor.vue'
218
+ import TextViewer from '~/components/Text/TextViewer.vue'
200
219
  export default {
201
220
  name: 'AnswerPanel',
202
- components: { Dialog },
221
+ components: { Dialog, TextEditor, TextViewer },
203
222
  props: {
204
223
  editMode: { type: Boolean, required: false, default: false },
205
224
  value: { type: Object, required: true, default: () => {} },
@@ -227,7 +246,7 @@ export default {
227
246
  deep: true,
228
247
  },
229
248
  },
230
- mounted() {
249
+ beforeMount() {
231
250
  if (!_.isEmpty(this.value)) {
232
251
  this.question = _.cloneDeep(this.value)
233
252
  }
@@ -247,25 +266,9 @@ export default {
247
266
  userInput: this.userInput,
248
267
  })
249
268
  },
250
- generateButtonOutline(index) {
251
- if (this.userInput === null) {
252
- return true
253
- }
254
- if (this.question.choices[index].is_answer) {
255
- return false
256
- }
257
- if (
258
- this.userInput !== this.question.answer &&
259
- index === this.userInput
260
- ) {
261
- return false
262
- } else {
263
- return true
264
- }
265
- },
266
269
  generateButtonColor(index) {
267
270
  if (this.userInput === null) {
268
- return 'answer_display'
271
+ return ''
269
272
  }
270
273
  if (this.question.choices[index].is_answer) {
271
274
  return 'success'
@@ -276,7 +279,7 @@ export default {
276
279
  ) {
277
280
  return 'error'
278
281
  } else {
279
- return 'answer_display'
282
+ return ''
280
283
  }
281
284
  },
282
285
  click() {
@@ -294,12 +297,12 @@ export default {
294
297
  this.emitUserInput()
295
298
  }
296
299
  },
297
- setAnswer(index) {
298
- if (this.question.answer === null) {
299
- this.question.answer = index
300
- } else if (this.question.answer === index) {
301
- this.question.answer = null
302
- }
300
+ onSetAnswer(answerIndex) {
301
+ const context = this
302
+ this.question.choices.forEach(function (value, index) {
303
+ context.question.choices[index].is_answer = false
304
+ })
305
+ this.question.choices[answerIndex].is_answer = true
303
306
  },
304
307
  addChoice() {
305
308
  this.question.choices.push({ text: '', is_answer: false })
@@ -319,20 +322,14 @@ export default {
319
322
  </script>
320
323
 
321
324
  <style scoped>
322
- .bucket {
323
- box-shadow: 0px 2px 3px #0000004a;
324
- color: black;
325
- cursor: pointer;
326
- padding: 0.3em;
327
- margin: 0.3em;
328
- vertical-align: middle;
329
- display: inline-block;
330
- }
331
325
  .answer_display {
332
- outline: var(--v-secondary-base) solid 2px;
326
+ outline: var(--v-primary-base) solid 2px;
333
327
  }
334
328
  .info-icon {
335
329
  position: relative;
336
330
  float: right;
337
331
  }
332
+ .clickable {
333
+ cursor: pointer !important;
334
+ }
338
335
  </style>