@windward/games 0.7.0 → 0.8.0

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 (25) hide show
  1. package/components/content/blocks/crosswordPuzzle/CrosswordPuzzle.vue +10 -2
  2. package/components/content/blocks/dragDrop/BucketGame.vue +6 -1
  3. package/components/content/blocks/dragDrop/SortingGame.vue +4 -2
  4. package/components/content/blocks/flashcards/FlashcardSlides.vue +2 -2
  5. package/components/content/blocks/matchingGame/MatchingGame.vue +34 -10
  6. package/components/content/blocks/multipleChoice/MultipleChoice.vue +10 -2
  7. package/components/content/blocks/multipleChoice/QuestionDialog.vue +4 -7
  8. package/components/content/blocks/quizshowGame/QuizShow.vue +0 -7
  9. package/components/content/blocks/slideshow/SlideShow.vue +6 -1
  10. package/components/settings/BucketGameSettingsManager.vue +6 -30
  11. package/components/settings/CrosswordPuzzleSettingsManager.vue +6 -28
  12. package/components/settings/FlashCardSlidesManager.vue +12 -34
  13. package/components/settings/MatchingGameManager.vue +27 -47
  14. package/components/settings/MultipleChoiceSettingsManager.vue +6 -30
  15. package/components/settings/QuizShowSettingsManager.vue +12 -62
  16. package/components/settings/SevenStrikesSettingsManager.vue +12 -47
  17. package/components/settings/SlideShowManager.vue +20 -47
  18. package/components/settings/SortingGameSettingsManager.vue +8 -44
  19. package/components/settings/WordJumbleSettingsManager.vue +10 -46
  20. package/i18n/en-US/shared/content_blocks.ts +1 -1
  21. package/i18n/en-US/shared/settings.ts +3 -0
  22. package/i18n/es-ES/shared/settings.ts +3 -0
  23. package/i18n/sv-SE/shared/settings.ts +4 -1
  24. package/package.json +2 -2
  25. package/test/settings/BucketGameManager.spec.js +0 -1
@@ -1,8 +1,16 @@
1
1
  <template>
2
2
  <v-container class="pa-0">
3
3
  <div>
4
- <h2>{{ block.metadata.config.title }}</h2>
5
- <p>{{ block.metadata.config.instructions }}</p>
4
+ <h2 v-if="block.metadata.config.title" tabindex="0">
5
+ {{ block.metadata.config.title }}
6
+ </h2>
7
+ <p
8
+ v-if="block.metadata.config.instructions"
9
+ tabindex="0"
10
+ class="pt-3"
11
+ >
12
+ {{ block.metadata.config.instructions }}
13
+ </p>
6
14
  </div>
7
15
  <v-alert v-if="wordMap.length === 0" type="info" class="text-center">
8
16
  <p>
@@ -2,6 +2,7 @@
2
2
  <div>
3
3
  <div>
4
4
  <h2
5
+ v-if="block.metadata.config.title"
5
6
  :aria-label="
6
7
  $t(
7
8
  'windward.games.components.content.blocks.bucket_game.aria_title'
@@ -12,7 +13,11 @@
12
13
  {{ block.metadata.config.title }}
13
14
  </h2>
14
15
 
15
- <p tabindex="0">
16
+ <p
17
+ v-if="block.metadata.config.instructions"
18
+ tabindex="0"
19
+ class="pt-3"
20
+ >
16
21
  {{ block.metadata.config.instructions }}
17
22
  </p>
18
23
  <h4 v-if="!render" class="d-flex justify-center align-center">
@@ -1,7 +1,9 @@
1
1
  <template>
2
2
  <div>
3
- <h2>{{ block.metadata.config.title }}</h2>
4
- <p>
3
+ <h2 v-if="block.metadata.config.title" tabindex="0">
4
+ {{ block.metadata.config.title }}
5
+ </h2>
6
+ <p v-if="block.metadata.config.instructions" tabindex="0" class="pt-3">
5
7
  {{ block.metadata.config.instructions }}
6
8
  </p>
7
9
  <v-container :key="'feedback'" :class="feedbackClass()">
@@ -1,10 +1,10 @@
1
1
  <template>
2
2
  <div>
3
- <h2 v-if="block.metadata.config.title">
3
+ <h2 v-if="block.metadata.config.title" tabindex="0">
4
4
  {{ block.metadata.config.title }}
5
5
  </h2>
6
6
 
7
- <p v-if="block.metadata.config.instructions">
7
+ <p v-if="block.metadata.config.instructions" tabindex="0" class="pt-3">
8
8
  {{ block.metadata.config.instructions }}
9
9
  </p>
10
10
  <br />
@@ -2,6 +2,7 @@
2
2
  <div>
3
3
  <div>
4
4
  <h2
5
+ v-if="block.metadata.config.title"
5
6
  :aria-label="
6
7
  $t(
7
8
  'windward.games.components.content.blocks.matching_game.match_game_title'
@@ -12,17 +13,21 @@
12
13
  {{ block.metadata.config.title }}
13
14
  </h2>
14
15
 
15
- <p>
16
+ <p
17
+ v-if="block.metadata.config.instructions"
18
+ tabindex="0"
19
+ class="pt-3"
20
+ >
16
21
  {{ block.metadata.config.instructions }}
17
22
  </p>
18
23
  <v-container :class="status">
19
- <v-row class="d-flex justify-center pa-2">{{
24
+ <v-alert class="d-flex justify-center pa-2">{{
20
25
  feedback
21
26
  ? feedback
22
27
  : $t(
23
28
  'windward.games.components.content.blocks.bucket_game.form.feedback.feedback_here'
24
29
  )
25
- }}</v-row>
30
+ }}</v-alert>
26
31
  <v-row class="d-flex justify-center pa-2">
27
32
  <v-btn
28
33
  v-if="status === 'successOutline'"
@@ -35,7 +40,9 @@
35
40
  v-if="status === 'errorOutline'"
36
41
  class="d-flex justify-center align-center"
37
42
  @click="onExitFeedback"
38
- ><v-icon class="icon--error">mdi-close-circle</v-icon>
43
+ ><v-btn class="error" elevation="0">{{
44
+ $t('shared.forms.try_again')
45
+ }}</v-btn>
39
46
  </v-container>
40
47
  </v-row>
41
48
  </v-container>
@@ -249,7 +256,10 @@
249
256
  v-for="(answer, aindex) in block.metadata.config
250
257
  .answerObjects"
251
258
  :key="aindex"
252
- class="pa-2 ma-2 answerCard container-outline"
259
+ :class="
260
+ 'pa-2 ma-2 answerCard container-outline ' +
261
+ answerColor(answer)
262
+ "
253
263
  outlined
254
264
  >
255
265
  <v-icon>mdi-drag-vertical</v-icon>
@@ -403,6 +413,7 @@ export default {
403
413
  },
404
414
  startingIndex: 0,
405
415
  flattenedPrompts: '',
416
+ droppedElement: null,
406
417
  }
407
418
  },
408
419
  watch: {
@@ -421,6 +432,15 @@ export default {
421
432
  this.setMainPrompt()
422
433
  },
423
434
  methods: {
435
+ answerColor(element) {
436
+ if (
437
+ !_.isEmpty(this.droppedElement) &&
438
+ element.display === this.droppedElement.display
439
+ ) {
440
+ return this.status
441
+ }
442
+ return ''
443
+ },
424
444
  shuffle(array) {
425
445
  let currentIndex = array.length,
426
446
  randomIndex
@@ -491,10 +511,12 @@ export default {
491
511
  }
492
512
  //set feedback information here
493
513
  if (_.isUndefined(target) || _.isEmpty(target)) {
494
- console.log('dragged to nowhere')
514
+ this.droppedElement = null
495
515
  } else if (draggedElement.id !== target.answer.id) {
496
516
  this.feedback = this.block.metadata.config.feedback_incorrect
497
517
  this.status = 'errorOutline'
518
+ this.allowDrag = false
519
+ this.droppedElement = draggedElement
498
520
  } else if (draggedElement.id === target.answer.id) {
499
521
  this.feedback = !_.isEmpty(target.matchExplanation)
500
522
  ? target.matchExplanation
@@ -502,6 +524,7 @@ export default {
502
524
  this.solvedQuestions.push(target)
503
525
  this.status = 'successOutline'
504
526
  this.allowDrag = false
527
+ this.droppedElement = draggedElement
505
528
  if (
506
529
  this.solvedQuestions.length === this.flattenedPrompts.length
507
530
  ) {
@@ -516,6 +539,7 @@ export default {
516
539
  onExitFeedback() {
517
540
  this.status = 'default'
518
541
  this.allowDrag = true
542
+ this.droppedElement = null
519
543
  this.feedback = this.$t(
520
544
  'windward.games.components.content.blocks.matching_game.default_feedback'
521
545
  )
@@ -527,6 +551,7 @@ export default {
527
551
  this.status = 'default'
528
552
  this.mainPrompt = this.shufflePrompts.shift()
529
553
  this.allowDrag = true
554
+ this.droppedElement = null
530
555
  this.feedback = this.$t(
531
556
  'windward.games.components.content.blocks.matching_game.default_feedback'
532
557
  )
@@ -576,18 +601,17 @@ export default {
576
601
  transition: 0.5s box-shadow;
577
602
  }
578
603
  .successOutline {
579
- border: 4px solid var(--v-success-base);
580
- color: var(--v-success-base);
604
+ border: 4px solid var(--v-success-base) !important;
581
605
  }
582
606
  .errorOutline {
583
- border: 4px solid var(--v-error-base);
584
- color: var(--v-error-base);
607
+ border: 4px solid var(--v-error-base) !important;
585
608
  }
586
609
  .card_text {
587
610
  font-size: large;
588
611
  }
589
612
  .answerCard {
590
613
  min-width: 23%;
614
+ cursor: grab;
591
615
  }
592
616
  .icon--error {
593
617
  color: var(--v-error-base);
@@ -2,8 +2,16 @@
2
2
  <v-container class="pa-0">
3
3
  <v-row>
4
4
  <v-col>
5
- <h2>{{ block.metadata.config.title }}</h2>
6
- <p class="mb-0">{{ block.metadata.config.instructions }}</p>
5
+ <h2 v-if="block.metadata.config.title" tabindex="0">
6
+ {{ block.metadata.config.title }}
7
+ </h2>
8
+ <p
9
+ v-if="block.metadata.config.instructions"
10
+ tabindex="0"
11
+ class="pt-3"
12
+ >
13
+ {{ block.metadata.config.instructions }}
14
+ </p>
7
15
  </v-col>
8
16
  </v-row>
9
17
  <v-carousel height="auto" :hide-delimiters="hideDeliminators">
@@ -11,7 +11,7 @@
11
11
  "
12
12
  :autofocus="true"
13
13
  rows="2"
14
- :rules="validation.textRules"
14
+ :rules="$Validation.getRule('exists')"
15
15
  prepend-inner-icon="mdi-help"
16
16
  :disabled="disabled"
17
17
  ></v-textarea>
@@ -23,7 +23,7 @@
23
23
  )
24
24
  "
25
25
  rows="2"
26
- :rules="validation.textRules"
26
+ :rules="$Validation.getRule('exists')"
27
27
  prepend-inner-icon="mdi-lightbulb-on-10"
28
28
  :disabled="disabled"
29
29
  ></v-textarea>
@@ -35,7 +35,7 @@
35
35
  )
36
36
  "
37
37
  rows="2"
38
- :rules="validation.textRules"
38
+ :rules="$Validation.getRule('exists')"
39
39
  prepend-inner-icon="mdi-comment"
40
40
  :disabled="disabled"
41
41
  ></v-textarea>
@@ -92,7 +92,7 @@
92
92
  )
93
93
  "
94
94
  rows="2"
95
- :rules="validation.textRules"
95
+ :rules="$Validation.getRule('exists')"
96
96
  :disabled="disabled"
97
97
  ></v-textarea>
98
98
  </v-col>
@@ -200,9 +200,6 @@ export default {
200
200
  return {
201
201
  question: {},
202
202
  validation: {
203
- textRules: [
204
- (v) => !!v || this.$t('shared.forms.errors.required'),
205
- ],
206
203
  optionRules: [
207
204
  (v) => {
208
205
  return (
@@ -26,13 +26,6 @@
26
26
  <p tabindex="0">
27
27
  <TextViewer v-model="block.metadata.config.instructions" />
28
28
  </p>
29
- <p tabindex="0">
30
- {{
31
- $t(
32
- 'windward.games.components.content.blocks.quizshow_game.basic_instructions'
33
- )
34
- }}
35
- </p>
36
29
 
37
30
  <v-container
38
31
  class="d-flex flex-row flex-wrap flex-fill pa-0"
@@ -2,6 +2,7 @@
2
2
  <div>
3
3
  <div class="header-description pa-0">
4
4
  <h2
5
+ v-if="block.metadata.config.title"
5
6
  :aria-label="
6
7
  $t(
7
8
  'windward.games.components.content.blocks.slideshow.slideshow_title'
@@ -12,7 +13,11 @@
12
13
  {{ block.metadata.config.title }}
13
14
  </h2>
14
15
 
15
- <p tabindex="0" class="pt-3">
16
+ <p
17
+ v-if="block.metadata.config.instructions"
18
+ tabindex="0"
19
+ class="pt-3"
20
+ >
16
21
  {{ block.metadata.config.instructions }}
17
22
  </p>
18
23
  </div>
@@ -3,10 +3,11 @@
3
3
  <v-container class="pa-0">
4
4
  <v-text-field
5
5
  ref="title"
6
+ id="block-settings-title"
6
7
  v-model="block.metadata.config.title"
7
- :rules="validation.titleRule"
8
+ :rules="$Validation.getRule('block.title')"
9
+ :counter="$Validation.getLimit('block.title')"
8
10
  outlined
9
- :counter="50"
10
11
  :autofocus="true"
11
12
  :label="
12
13
  $t(
@@ -16,11 +17,12 @@
16
17
  :disabled="render"
17
18
  ></v-text-field>
18
19
  <v-textarea
20
+ id="block-settings-instructions"
19
21
  v-model="block.metadata.config.instructions"
20
22
  outlined
21
23
  auto-grow
22
- :rules="validation.instructionsRule"
23
- :counter="255"
24
+ :rules="$Validation.getRule('block.instructions')"
25
+ :counter="$Validation.getLimit('block.instructions')"
24
26
  :label="
25
27
  $t(
26
28
  'windward.games.components.settings.bucket_game.form.instructions'
@@ -319,32 +321,6 @@ export default {
319
321
  [colors.lightGreen.lighten4, colors.teal.lighten4],
320
322
  [colors.lightBlue.lighten4, colors.deepPurple.lighten3],
321
323
  ],
322
- validation: {
323
- titleRule: [
324
- (v) => {
325
- if (v && v.length >= 50) {
326
- return this.$t(
327
- 'windward.games.shared.settings.errors.input_limitations',
328
- [50]
329
- )
330
- } else {
331
- return true
332
- }
333
- },
334
- ],
335
- instructionsRule: [
336
- (v) => {
337
- if (v && v.length >= 255) {
338
- return this.$t(
339
- 'windward.games.shared.settings.errors.input_limitations',
340
- [255]
341
- )
342
- } else {
343
- return true
344
- }
345
- },
346
- ],
347
- },
348
324
  }
349
325
  },
350
326
  methods: {
@@ -3,9 +3,10 @@
3
3
  <v-container class="pa-0">
4
4
  <v-text-field
5
5
  ref="title"
6
+ id="block-settings-title"
6
7
  v-model="block.metadata.config.title"
7
- :counter="50"
8
- :rules="validation.titleRule"
8
+ :rules="$Validation.getRule('block.title')"
9
+ :counter="$Validation.getLimit('block.title')"
9
10
  outlined
10
11
  :autofocus="true"
11
12
  :label="
@@ -16,11 +17,12 @@
16
17
  :disabled="render"
17
18
  ></v-text-field>
18
19
  <v-textarea
20
+ id="block-settings-instructions"
19
21
  outlined
20
22
  auto-grow
21
23
  v-model="block.metadata.config.instructions"
22
- :rules="validation.instructionRule"
23
- :counter="255"
24
+ :rules="$Validation.getRule('block.instructions')"
25
+ :counter="$Validation.getLimit('block.instructions')"
24
26
  :label="
25
27
  $t(
26
28
  'windward.games.components.settings.bucket_game.form.instructions'
@@ -178,30 +180,6 @@ export default {
178
180
  valid: true,
179
181
  loading: false,
180
182
  validation: {
181
- titleRule: [
182
- (v) => {
183
- if (v && v.length >= 50) {
184
- return this.$t(
185
- 'windward.games.shared.settings.errors.input_limitations',
186
- [50]
187
- )
188
- } else {
189
- return true
190
- }
191
- },
192
- ],
193
- instructionRule: [
194
- (v) => {
195
- if (v && v.length >= 255) {
196
- return this.$t(
197
- 'windward.games.shared.settings.errors.input_limitations',
198
- [255]
199
- )
200
- } else {
201
- return true
202
- }
203
- },
204
- ],
205
183
  wordRule: [
206
184
  (v) => {
207
185
  if (v && v.length >= 20) {
@@ -3,10 +3,11 @@
3
3
  <v-container class="pa-0">
4
4
  <v-text-field
5
5
  ref="title"
6
+ id="block-settings-title"
6
7
  v-model="block.metadata.config.title"
8
+ :rules="$Validation.getRule('block.title')"
9
+ :counter="$Validation.getLimit('block.title')"
7
10
  outlined
8
- :counter="50"
9
- :rules="validation.shortInputRules"
10
11
  :label="
11
12
  $t(
12
13
  'windward.games.components.settings.bucket_game.form.title'
@@ -15,9 +16,10 @@
15
16
  :disabled="render"
16
17
  ></v-text-field>
17
18
  <v-textarea
19
+ id="block-settings-instructions"
18
20
  v-model="block.metadata.config.instructions"
19
- :rules="validation.instructionRule"
20
- :counter="255"
21
+ :rules="$Validation.getRule('block.instructions')"
22
+ :counter="$Validation.getLimit('block.instructions')"
21
23
  outlined
22
24
  auto-grow
23
25
  :label="
@@ -116,8 +118,8 @@
116
118
  "
117
119
  outlined
118
120
  auto-grow
119
- :rules="validation.shortInputRules"
120
- :counter="50"
121
+ :rules="$Validation.getRule('shortInput')"
122
+ :counter="$Validation.getLimit('shortInput')"
121
123
  :label="
122
124
  $t(
123
125
  'windward.games.components.settings.flashcard.form.header'
@@ -162,13 +164,14 @@
162
164
  .imageAsset
163
165
  "
164
166
  mimes="image/png,image/jpeg"
167
+ outlined
165
168
  :assets.sync="block.assets"
166
169
  :disabled="render"
167
170
  >
168
171
  <template #title>
169
172
  {{
170
173
  $t(
171
- 'windward.games.components.settings.flashcard.form.image.title'
174
+ 'windward.games.shared.settings.file_picker.image'
172
175
  )
173
176
  }}
174
177
  </template>
@@ -233,13 +236,14 @@
233
236
  .imageAsset
234
237
  "
235
238
  mimes="image/png,image/jpeg"
239
+ outlined
236
240
  :assets.sync="block.assets"
237
241
  :disabled="render"
238
242
  >
239
243
  <template #title>
240
244
  {{
241
245
  $t(
242
- 'windward.games.components.settings.flashcard.form.image.title'
246
+ 'windward.games.shared.settings.file_picker.image'
243
247
  )
244
248
  }}
245
249
  </template>
@@ -368,32 +372,6 @@ export default {
368
372
  return {
369
373
  loading: false,
370
374
  valid: true,
371
- validation: {
372
- shortInputRules: [
373
- (v) => {
374
- if (v && v.length >= 50) {
375
- return this.$t(
376
- 'windward.games.shared.settings.errors.input_limitations',
377
- [50]
378
- )
379
- } else {
380
- return true
381
- }
382
- },
383
- ],
384
- instructionRule: [
385
- (v) => {
386
- if (v && v.length >= 255) {
387
- return this.$t(
388
- 'windward.games.shared.settings.errors.input_limitations',
389
- [255]
390
- )
391
- } else {
392
- return true
393
- }
394
- },
395
- ],
396
- },
397
375
  }
398
376
  },
399
377
  beforeMount() {
@@ -3,11 +3,12 @@
3
3
  <v-container class="pa-0">
4
4
  <v-text-field
5
5
  ref="title"
6
+ id="block-settings-title"
6
7
  v-model="block.metadata.config.title"
7
- :rules="validation.shortInputRules"
8
+ :rules="$Validation.getRule('block.title')"
9
+ :counter="$Validation.getLimit('block.title')"
8
10
  :autofocus="true"
9
11
  outlined
10
- :counter="50"
11
12
  :label="
12
13
  $t(
13
14
  'windward.games.components.settings.matching_game.form.title'
@@ -16,11 +17,12 @@
16
17
  :disabled="render"
17
18
  ></v-text-field>
18
19
  <v-textarea
20
+ id="block-settings-instructions"
19
21
  v-model="block.metadata.config.instructions"
20
- :rules="validation.instructionRule"
22
+ :rules="$Validation.getRule('block.instructions')"
23
+ :counter="$Validation.getLimit('block.instructions')"
21
24
  outlined
22
25
  auto-grow
23
- :counter="255"
24
26
  :label="
25
27
  $t(
26
28
  'windward.games.components.settings.matching_game.form.instructions'
@@ -68,8 +70,8 @@
68
70
  block.metadata.config.answerObjects[index]
69
71
  .display
70
72
  "
71
- :counter="50"
72
- :rules="validation.shortInputRules"
73
+ :rules="$Validation.getRule('shortInput')"
74
+ :counter="$Validation.getLimit('shortInput')"
73
75
  outlined
74
76
  :disabled="render"
75
77
  ></v-text-field>
@@ -175,8 +177,14 @@
175
177
  index
176
178
  ][indexPrompt].prompt
177
179
  "
178
- :counter="200"
179
- :rules="validation.promptRule"
180
+ :rules="
181
+ $Validation.getRule('longInput')
182
+ "
183
+ :counter="
184
+ $Validation.getLimit(
185
+ 'longInput'
186
+ )
187
+ "
180
188
  :label="
181
189
  $t(
182
190
  'windward.games.components.settings.matching_game.form.prompt_body'
@@ -259,11 +267,20 @@
259
267
  index
260
268
  ][indexPrompt].file
261
269
  "
270
+ outlined
262
271
  :assets.sync="block.assets"
263
272
  class="content-block-asset"
264
273
  mimes="image/png,image/jpeg"
265
274
  :disabled="render"
266
- ></ContentBlockAsset>
275
+ >
276
+ <template #title>
277
+ {{
278
+ $t(
279
+ 'windward.games.shared.settings.file_picker.image'
280
+ )
281
+ }}
282
+ </template>
283
+ </ContentBlockAsset>
267
284
  </v-container>
268
285
  <v-container class="pa-0">
269
286
  <v-text-field
@@ -278,6 +295,7 @@
278
295
  )
279
296
  "
280
297
  outlined
298
+ :disabled="render"
281
299
  ></v-text-field>
282
300
  </v-container>
283
301
  </v-container>
@@ -396,44 +414,6 @@ export default {
396
414
  return {
397
415
  valid: true,
398
416
  loading: false,
399
- validation: {
400
- shortInputRules: [
401
- (v) => {
402
- if (v && v.length >= 50) {
403
- return this.$t(
404
- 'windward.games.shared.settings.errors.input_limitations',
405
- [50]
406
- )
407
- } else {
408
- return true
409
- }
410
- },
411
- ],
412
- instructionRule: [
413
- (v) => {
414
- if (v && v.length >= 255) {
415
- return this.$t(
416
- 'windward.games.shared.settings.errors.input_limitations',
417
- [255]
418
- )
419
- } else {
420
- return true
421
- }
422
- },
423
- ],
424
- promptRule: [
425
- (v) => {
426
- if (v && v.length >= 200) {
427
- return this.$t(
428
- 'windward.games.shared.settings.errors.input_limitations',
429
- [50]
430
- )
431
- } else {
432
- return true
433
- }
434
- },
435
- ],
436
- },
437
417
  }
438
418
  },
439
419
  mounted() {},
@@ -2,11 +2,12 @@
2
2
  <div>
3
3
  <v-container class="pa-0">
4
4
  <v-text-field
5
+ id="block-settings-title"
5
6
  v-model="block.metadata.config.title"
6
7
  outlined
7
8
  :autofocus="true"
8
- :rules="validation.titleRule"
9
- :counter="50"
9
+ :rules="$Validation.getRule('block.title')"
10
+ :counter="$Validation.getLimit('block.title')"
10
11
  :label="
11
12
  $t(
12
13
  'windward.games.components.settings.multiple_choice.title_placeholder'
@@ -15,11 +16,12 @@
15
16
  :disabled="render"
16
17
  ></v-text-field>
17
18
  <v-textarea
19
+ id="block-settings-instructions"
18
20
  v-model="block.metadata.config.instructions"
19
21
  outlined
20
- :rules="validation.instructionRule"
22
+ :rules="$Validation.getRule('block.instructions')"
23
+ :counter="$Validation.getLimit('block.instructions')"
21
24
  auto-grow
22
- :counter="255"
23
25
  :label="
24
26
  $t(
25
27
  'windward.games.components.settings.multiple_choice.instructions'
@@ -157,32 +159,6 @@ export default {
157
159
  isNotEditing: false,
158
160
  valid: true,
159
161
  loading: false,
160
- validation: {
161
- titleRule: [
162
- (v) => {
163
- if (v && v.length >= 50) {
164
- return this.$t(
165
- 'windward.games.shared.settings.errors.input_limitations',
166
- [50]
167
- )
168
- } else {
169
- return true
170
- }
171
- },
172
- ],
173
- instructionRule: [
174
- (v) => {
175
- if (v && v.length >= 255) {
176
- return this.$t(
177
- 'windward.games.shared.settings.errors.input_limitations',
178
- [50]
179
- )
180
- } else {
181
- return true
182
- }
183
- },
184
- ],
185
- },
186
162
  }
187
163
  },
188
164
  mounted() {
@@ -1,9 +1,10 @@
1
1
  <template>
2
2
  <div>
3
3
  <v-text-field
4
+ id="block-settings-title"
4
5
  v-model="block.metadata.config.title"
5
- :rules="validation.shortInputRules"
6
- :counter="50"
6
+ :rules="$Validation.getRule('block.title')"
7
+ :counter="$Validation.getLimit('block.title')"
7
8
  outlined
8
9
  :label="
9
10
  $t(
@@ -24,11 +25,12 @@
24
25
  ></v-checkbox>
25
26
  <br />
26
27
  <v-textarea
28
+ id="block-settings-instructions"
27
29
  outlined
28
30
  auto-grow
29
31
  v-model="block.metadata.config.instructions"
30
- :rules="validation.instructionRule"
31
- :counter="255"
32
+ :rules="$Validation.getRule('block.instructions')"
33
+ :counter="$Validation.getLimit('block.instructions')"
32
34
  :label="
33
35
  $t(
34
36
  'windward.games.components.settings.multiple_choice.instructions'
@@ -75,8 +77,12 @@
75
77
  index - 1
76
78
  ]
77
79
  "
78
- :rules="validation.shortInputRules"
79
- :counter="50"
80
+ :rules="
81
+ $Validation.getRule('shortInput')
82
+ "
83
+ :counter="
84
+ $Validation.getLimit('shortInput')
85
+ "
80
86
  :label="
81
87
  $tc(
82
88
  'windward.games.components.settings.quizshow_game.form.category',
@@ -241,62 +247,6 @@ export default {
241
247
  },
242
248
  data() {
243
249
  return {
244
- validation: {
245
- lengthRules: [
246
- (v) => !!v || this.$t('shared.forms.errors.required'),
247
- (v) =>
248
- (!!v && v.length >= 1) ||
249
- this.$t('shared.forms.errors.required'),
250
- (v) => {
251
- if (!!v && v <= 10) {
252
- return true
253
- } else {
254
- return this.$t('shared.forms.errors.number_lt', [
255
- 10,
256
- ])
257
- }
258
- },
259
- ],
260
- pointsRules: [
261
- (v) => !!v || this.$t('shared.forms.errors.required'),
262
- (v) =>
263
- (!!v && v.length >= 1) ||
264
- this.$t('shared.forms.errors.required'),
265
- (v) => {
266
- if (!!v && v <= 9999) {
267
- return true
268
- } else {
269
- return this.$t('shared.forms.errors.number_lt', [
270
- 9999,
271
- ])
272
- }
273
- },
274
- ],
275
- shortInputRules: [
276
- (v) => {
277
- if (v && v.length >= 50) {
278
- return this.$t(
279
- 'windward.games.shared.settings.errors.input_limitations',
280
- [50]
281
- )
282
- } else {
283
- return true
284
- }
285
- },
286
- ],
287
- instructionRule: [
288
- (v) => {
289
- if (v && v.length >= 255) {
290
- return this.$t(
291
- 'windward.games.shared.settings.errors.input_limitations',
292
- [255]
293
- )
294
- } else {
295
- return true
296
- }
297
- },
298
- ],
299
- },
300
250
  loading: false,
301
251
  cursor: 'changePointer',
302
252
  quizShowSettings: {
@@ -3,10 +3,11 @@
3
3
  <v-container class="pa-0">
4
4
  <v-text-field
5
5
  ref="title"
6
+ id="block-settings-title"
6
7
  v-model="block.metadata.config.title"
7
- :rules="validation.shortInputRules"
8
+ :rules="$Validation.getRule('block.title')"
9
+ :counter="$Validation.getLimit('block.title')"
8
10
  outlined
9
- :counter="50"
10
11
  :autofocus="true"
11
12
  :label="
12
13
  $t(
@@ -16,9 +17,10 @@
16
17
  :disabled="render"
17
18
  ></v-text-field>
18
19
  <v-textarea
20
+ id="block-settings-instructions"
19
21
  v-model="block.metadata.config.instructions"
20
- :counter="255"
21
- :rules="validation.instructionRule"
22
+ :rules="$Validation.getRule('block.instructions')"
23
+ :counter="$Validation.getLimit('block.instructions')"
22
24
  outlined
23
25
  auto-grow
24
26
  :label="
@@ -65,8 +67,8 @@
65
67
  v-model="
66
68
  block.metadata.config.words[index].value
67
69
  "
68
- :rules="validation.shortInputRules"
69
- :counter="50"
70
+ :rules="$Validation.getRule('shortInput')"
71
+ :counter="$Validation.getLimit('shortInput')"
70
72
  outlined
71
73
  :autofocus="true"
72
74
  :disabled="render"
@@ -82,8 +84,8 @@
82
84
  v-model="
83
85
  block.metadata.config.words[index].hint
84
86
  "
85
- :rules="validation.clueRule"
86
- :counter="155"
87
+ :rules="$Validation.getRule('mediumInput')"
88
+ :counter="$Validation.getLimit('mediumInput')"
87
89
  outlined
88
90
  class="pt-4"
89
91
  :disabled="render"
@@ -169,7 +171,8 @@ export default {
169
171
  )
170
172
  }
171
173
  if (
172
- _.isEmpty(this.block.metadata.config.instructions) && this.block.id &&
174
+ _.isEmpty(this.block.metadata.config.instructions) &&
175
+ this.block.id &&
173
176
  !Uuid.test(this.block.id)
174
177
  ) {
175
178
  this.block.metadata.config.instructions = this.$t(
@@ -197,44 +200,6 @@ export default {
197
200
  return {
198
201
  valid: true,
199
202
  loading: false,
200
- validation: {
201
- shortInputRules: [
202
- (v) => {
203
- if (v && v.length >= 50) {
204
- return this.$t(
205
- 'windward.games.shared.settings.errors.input_limitations',
206
- [50]
207
- )
208
- } else {
209
- return true
210
- }
211
- },
212
- ],
213
- instructionRule: [
214
- (v) => {
215
- if (v && v.length >= 255) {
216
- return this.$t(
217
- 'windward.games.shared.settings.errors.input_limitations',
218
- [255]
219
- )
220
- } else {
221
- return true
222
- }
223
- },
224
- ],
225
- clueRule: [
226
- (v) => {
227
- if (v && v.length >= 155) {
228
- return this.$t(
229
- 'windward.games.shared.settings.errors.input_limitations',
230
- [155]
231
- )
232
- } else {
233
- return true
234
- }
235
- },
236
- ],
237
- },
238
203
  }
239
204
  },
240
205
  methods: {
@@ -2,10 +2,11 @@
2
2
  <div>
3
3
  <v-container class="pa-0">
4
4
  <v-text-field
5
+ id="block-settings-title"
5
6
  v-model="block.metadata.config.title"
6
7
  outlined
7
- :rules="validation.shortInputRules"
8
- :counter="50"
8
+ :rules="$Validation.getRule('block.title')"
9
+ :counter="$Validation.getLimit('block.title')"
9
10
  :label="
10
11
  $t(
11
12
  'windward.games.components.settings.slideshow.form.title'
@@ -14,11 +15,12 @@
14
15
  :disabled="render"
15
16
  ></v-text-field>
16
17
  <v-textarea
18
+ id="block-settings-instructions"
17
19
  v-model="block.metadata.config.instructions"
18
20
  outlined
19
21
  auto-grow
20
- :rules="validation.instructionRule"
21
- :counter="255"
22
+ :rules="$Validation.getRule('block.instructions')"
23
+ :counter="$Validation.getLimit('block.instructions')"
22
24
  :label="
23
25
  $t(
24
26
  'windward.games.components.settings.slideshow.form.instructions'
@@ -56,8 +58,8 @@
56
58
  <v-container>
57
59
  <v-text-field
58
60
  v-model="block.metadata.config.slides[index].header"
59
- :rules="validation.shortInputRules"
60
- :counter="50"
61
+ :rules="$Validation.getRule('shortInput')"
62
+ :counter="$Validation.getLimit('shortInput')"
61
63
  :autofocus="true"
62
64
  outlined
63
65
  :label="
@@ -71,8 +73,8 @@
71
73
  v-model="
72
74
  block.metadata.config.slides[index].description
73
75
  "
74
- :rules="validation.clueRule"
75
- :counter="155"
76
+ :rules="$Validation.getRule('mediumInput')"
77
+ :counter="$Validation.getLimit('mediumInput')"
76
78
  outlined
77
79
  :label="
78
80
  $t(
@@ -90,7 +92,16 @@
90
92
  :assets.sync="block.assets"
91
93
  mimes="image/png,image/jpeg"
92
94
  :disabled="render"
93
- ></ContentBlockAsset>
95
+ outlined
96
+ >
97
+ <template #title>
98
+ {{
99
+ $t(
100
+ 'windward.games.shared.settings.file_picker.image'
101
+ )
102
+ }}
103
+ </template>
104
+ </ContentBlockAsset>
94
105
 
95
106
  <v-text-field
96
107
  v-if="
@@ -205,44 +216,6 @@ export default {
205
216
  valid: true,
206
217
  debounce: null,
207
218
  loading: false,
208
- validation: {
209
- shortInputRules: [
210
- (v) => {
211
- if (v && v.length >= 50) {
212
- return this.$t(
213
- 'windward.games.shared.settings.errors.input_limitations',
214
- [50]
215
- )
216
- } else {
217
- return true
218
- }
219
- },
220
- ],
221
- instructionRule: [
222
- (v) => {
223
- if (v && v.length >= 255) {
224
- return this.$t(
225
- 'windward.games.shared.settings.errors.input_limitations',
226
- [255]
227
- )
228
- } else {
229
- return true
230
- }
231
- },
232
- ],
233
- clueRule: [
234
- (v) => {
235
- if (v && v.length >= 155) {
236
- return this.$t(
237
- 'windward.games.shared.settings.errors.input_limitations',
238
- [155]
239
- )
240
- } else {
241
- return true
242
- }
243
- },
244
- ],
245
- },
246
219
  }
247
220
  },
248
221
  methods: {
@@ -3,11 +3,12 @@
3
3
  <v-container class="pa-0">
4
4
  <v-text-field
5
5
  ref="title"
6
+ id="block-settings-title"
6
7
  v-model="block.metadata.config.title"
7
8
  outlined
8
9
  :autofocus="true"
9
- :rules="validation.shortInputRules"
10
- :counter="50"
10
+ :rules="$Validation.getRule('block.title')"
11
+ :counter="$Validation.getLimit('block.title')"
11
12
  :label="
12
13
  $t(
13
14
  'windward.games.components.settings.bucket_game.form.title'
@@ -16,11 +17,12 @@
16
17
  :disabled="render"
17
18
  ></v-text-field>
18
19
  <v-textarea
20
+ id="block-settings-instructions"
19
21
  v-model="block.metadata.config.instructions"
20
22
  outlined
21
23
  auto-grow
22
- :rules="validation.instructionRule"
23
- :counter="255"
24
+ :rules="$Validation.getRule('block.instructions')"
25
+ :counter="$Validation.getLimit('block.instructions')"
24
26
  :label="
25
27
  $t(
26
28
  'windward.games.components.settings.bucket_game.form.instructions'
@@ -63,8 +65,8 @@
63
65
  </p>
64
66
  <v-textarea
65
67
  v-model="block.metadata.config.answer[index].value"
66
- :rules="validation.sortableWordRule"
67
- :counter="155"
68
+ :rules="$Validation.getRule('mediumInput')"
69
+ :counter="$Validation.getLimit('mediumInput')"
68
70
  outlined
69
71
  :autofocus="true"
70
72
  :disabled="render"
@@ -193,44 +195,6 @@ export default {
193
195
  },
194
196
  ],
195
197
  cursor: null,
196
- validation: {
197
- shortInputRules: [
198
- (v) => {
199
- if (v && v.length >= 50) {
200
- return this.$t(
201
- 'windward.games.shared.settings.errors.input_limitations',
202
- [50]
203
- )
204
- } else {
205
- return true
206
- }
207
- },
208
- ],
209
- instructionRule: [
210
- (v) => {
211
- if (v && v.length >= 255) {
212
- return this.$t(
213
- 'windward.games.shared.settings.errors.input_limitations',
214
- [255]
215
- )
216
- } else {
217
- return true
218
- }
219
- },
220
- ],
221
- sortableWordRule: [
222
- (v) => {
223
- if (v && v.length >= 155) {
224
- return this.$t(
225
- 'windward.games.shared.settings.errors.input_limitations',
226
- [155]
227
- )
228
- } else {
229
- return true
230
- }
231
- },
232
- ],
233
- },
234
198
  }
235
199
  },
236
200
  methods: {
@@ -3,9 +3,10 @@
3
3
  <v-container class="pa-0">
4
4
  <v-text-field
5
5
  ref="title"
6
+ id="block-settings-title"
6
7
  v-model="block.metadata.config.title"
7
- :counter="50"
8
- :rules="validation.shortInputRules"
8
+ :rules="$Validation.getRule('block.title')"
9
+ :counter="$Validation.getLimit('block.title')"
9
10
  outlined
10
11
  :autofocus="true"
11
12
  :label="
@@ -16,9 +17,10 @@
16
17
  :disabled="render"
17
18
  ></v-text-field>
18
19
  <v-textarea
20
+ id="block-settings-instructions"
19
21
  v-model="block.metadata.config.instructions"
20
- :rules="validation.instructionRule"
21
- :counter="255"
22
+ :rules="$Validation.getRule('block.instructions')"
23
+ :counter="$Validation.getLimit('block.instructions')"
22
24
  outlined
23
25
  auto-grow
24
26
  :label="
@@ -67,8 +69,8 @@
67
69
  v-model="
68
70
  block.metadata.config.words[index].value
69
71
  "
70
- :rules="validation.shortInputRules"
71
- :counter="50"
72
+ :rules="$Validation.getRule('shortInput')"
73
+ :counter="$Validation.getLimit('shortInput')"
72
74
  outlined
73
75
  :disabled="render"
74
76
  ></v-text-field>
@@ -85,8 +87,8 @@
85
87
  v-model="
86
88
  block.metadata.config.words[index].hint
87
89
  "
88
- :rules="validation.hintRule"
89
- :counter="155"
90
+ :rules="$Validation.getRule('mediumInput')"
91
+ :counter="$Validation.getLimit('mediumInput')"
90
92
  outlined
91
93
  :disabled="render"
92
94
  ></v-textarea>
@@ -191,44 +193,6 @@ export default {
191
193
  return {
192
194
  valid: true,
193
195
  loading: false,
194
- validation: {
195
- shortInputRules: [
196
- (v) => {
197
- if (v && v.length >= 50) {
198
- return this.$t(
199
- 'windward.games.shared.settings.errors.input_limitations',
200
- [50]
201
- )
202
- } else {
203
- return true
204
- }
205
- },
206
- ],
207
- instructionRule: [
208
- (v) => {
209
- if (v && v.length >= 255) {
210
- return this.$t(
211
- 'windward.games.shared.settings.errors.input_limitations',
212
- [255]
213
- )
214
- } else {
215
- return true
216
- }
217
- },
218
- ],
219
- hintRule: [
220
- (v) => {
221
- if (v && v.length >= 155) {
222
- return this.$t(
223
- 'windward.games.shared.settings.errors.input_limitations',
224
- [155]
225
- )
226
- } else {
227
- return true
228
- }
229
- },
230
- ],
231
- },
232
196
  }
233
197
  },
234
198
  methods: {
@@ -4,7 +4,7 @@ export default {
4
4
  bucket: 'Bucket',
5
5
  sort: 'Sorting',
6
6
  matching_game: 'Matching',
7
- quizshow: 'Quizshow',
7
+ quizshow: 'Quiz Show',
8
8
  slideshow: 'Slideshow',
9
9
  multiple_choice: 'Multiple Choice',
10
10
  word_jumble: 'Word Jumble',
@@ -14,4 +14,7 @@ export default {
14
14
  errors: {
15
15
  input_limitations: 'Must be less than {0} characters.'
16
16
  },
17
+ file_picker: {
18
+ image: 'Place Image'
19
+ }
17
20
  }
@@ -14,4 +14,7 @@ export default {
14
14
  errors: {
15
15
  input_limitations: 'Måste vara mindre än {0} tecken.',
16
16
  },
17
+ file_picker: {
18
+ image: 'Colocar imagen'
19
+ }
17
20
  }
@@ -12,6 +12,9 @@ export default {
12
12
  crossword_puzzle_manager: 'Korsordshanterare',
13
13
  },
14
14
  errors: {
15
- input_limitations: 'Måste vara mindre än {0} tecken.'
15
+ input_limitations: 'Måste vara mindre än {0} tecken.',
16
+ },
17
+ file_picker: {
18
+ image: 'Placera bild',
16
19
  },
17
20
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windward/games",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "Windward UI Plugin Games",
5
5
  "main": "plugin.js",
6
6
  "scripts": {
@@ -21,7 +21,7 @@
21
21
  "license": "MIT",
22
22
  "homepage": "https://bitbucket.org/mindedge/windward-ui-plugin-games#readme",
23
23
  "dependencies": {
24
- "@windward/core": "^0.3.0",
24
+ "@windward/core": "^0.8.0",
25
25
  "eslint": "^8.11.0",
26
26
  "lodash": "^4.17.21",
27
27
  "prettier": "^2.6.0",
@@ -73,7 +73,6 @@ describe('Bucket game manager', () => {
73
73
  {
74
74
  bucket_index: 0,
75
75
  display: '',
76
- display_value: '',
77
76
  feedback: '',
78
77
  expand: true,
79
78
  id: 2,