@windward/games 0.3.0 → 0.5.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 (39) hide show
  1. package/components/content/CrudTable.vue +8 -4
  2. package/components/content/DatableEditor.vue +1 -0
  3. package/components/content/blocks/crosswordPuzzle/CrosswordPuzzle.vue +3 -2
  4. package/components/content/blocks/dragDrop/BucketGame.vue +9 -4
  5. package/components/content/blocks/dragDrop/SortingGame.vue +2 -1
  6. package/components/content/blocks/flashcards/CardFace.vue +48 -9
  7. package/components/content/blocks/flashcards/Flashcard.vue +26 -17
  8. package/components/content/blocks/flashcards/FlashcardSlides.vue +10 -5
  9. package/components/content/blocks/matchingGame/MatchingGame.vue +327 -304
  10. package/components/content/blocks/multipleChoice/MultipleChoice.vue +6 -2
  11. package/components/content/blocks/multipleChoice/QuestionDialog.vue +2 -0
  12. package/components/content/blocks/quizshowGame/AnswerPanel.vue +3 -1
  13. package/components/content/blocks/quizshowGame/Gridview.vue +1 -0
  14. package/components/content/blocks/quizshowGame/QuizShow.vue +6 -3
  15. package/components/content/blocks/sevenStrikes/SevenStikes.vue +8 -2
  16. package/components/content/blocks/slideshow/SlideShow.vue +31 -22
  17. package/components/content/blocks/wordJumble/WordJumble.vue +8 -3
  18. package/components/settings/BucketGameSettingsManager.vue +5 -1
  19. package/components/settings/CrosswordPuzzleSettingsManager.vue +1 -0
  20. package/components/settings/FlashCardSlidesManager.vue +165 -107
  21. package/components/settings/MatchingGameManager.vue +57 -27
  22. package/components/settings/MultipleChoiceSettingsManager.vue +1 -0
  23. package/components/settings/QuizShowSettingsManager.vue +3 -0
  24. package/components/settings/SevenStrikesSettingsManager.vue +1 -0
  25. package/components/settings/SlideShowManager.vue +32 -12
  26. package/components/settings/SortingGameSettingsManager.vue +1 -0
  27. package/components/settings/WordJumbleSettingsManager.vue +1 -0
  28. package/i18n/en-US/components/content/blocks/slideshow.ts +1 -3
  29. package/i18n/en-US/components/settings/matching_game.ts +4 -0
  30. package/i18n/en-US/components/settings/seven_strikes.ts +1 -1
  31. package/i18n/es-ES/components/content/blocks/slideshow.ts +0 -2
  32. package/i18n/es-ES/components/settings/matching_game.ts +4 -0
  33. package/i18n/es-ES/components/settings/seven_strikes.ts +1 -1
  34. package/i18n/sv-SE/components/content/blocks/slideshow.ts +0 -2
  35. package/i18n/sv-SE/components/settings/matching_game.ts +4 -0
  36. package/i18n/sv-SE/components/settings/seven_strikes.ts +1 -1
  37. package/package.json +1 -1
  38. package/test/blocks/flashcards/CardFace.spec.js +2 -0
  39. package/test/blocks/flashcards/Flashcard.spec.js +1 -0
@@ -11,7 +11,7 @@
11
11
  <v-toolbar-title> {{ title }}</v-toolbar-title>
12
12
  <v-divider class="mx-4" inset vertical></v-divider>
13
13
  <v-spacer></v-spacer>
14
- <v-btn color="primary" dark class="mb-2" @click="addNew">
14
+ <v-btn color="primary" elevation="0" dark class="mb-2" @click="addNew">
15
15
  {{
16
16
  $t(
17
17
  'windward.games.components.content.crud_table.add_row'
@@ -27,6 +27,7 @@
27
27
  <template #activator="{ on, attrs }">
28
28
  <v-btn
29
29
  color="primary"
30
+ elevation="0"
30
31
  dark
31
32
  class="mb-2"
32
33
  v-bind="attrs"
@@ -71,12 +72,13 @@
71
72
  <v-spacer></v-spacer>
72
73
  <v-btn
73
74
  color="blue darken-1"
75
+ elevation="0"
74
76
  text
75
77
  @click="close"
76
78
  >
77
79
  {{ $t('shared.forms.cancel') }}
78
80
  </v-btn>
79
- <v-btn color="blue darken-1" text @click="save">
81
+ <v-btn color="blue darken-1" elevation="0" text @click="save">
80
82
  {{ $t('shared.forms.save') }}
81
83
  </v-btn>
82
84
  </v-card-actions>
@@ -91,12 +93,14 @@
91
93
  <v-spacer></v-spacer>
92
94
  <v-btn
93
95
  color="blue darken-1"
96
+ elevation="0"
94
97
  text
95
98
  @click="closeDelete"
96
99
  >{{ $t('shared.forms.cancel') }}
97
100
  </v-btn>
98
101
  <v-btn
99
102
  color="blue darken-1"
103
+ elevation="0"
100
104
  text
101
105
  @click="deleteItemConfirm"
102
106
  >{{ $t('shared.forms.confirm') }}
@@ -127,7 +131,7 @@
127
131
  @input="onDropCallback"
128
132
  >
129
133
  <template #item.actions="{ item }">
130
- <v-btn outlined v-if="useModal">
134
+ <v-btn outlined elevation="0" v-if="useModal">
131
135
  <span class="sr-only">
132
136
  {{ $t('shared.forms.edit') }}</span
133
137
  >
@@ -139,7 +143,7 @@
139
143
  mdi-pencil
140
144
  </v-icon>
141
145
  </v-btn>
142
- <v-btn outlined>
146
+ <v-btn outlined elevation="0">
143
147
  <span class="sr-only">
144
148
  {{ $t('shared.forms.delete') }}</span
145
149
  >
@@ -25,6 +25,7 @@
25
25
  ></v-text-field>-->
26
26
  <v-btn
27
27
  color="primary"
28
+ elevation="0"
28
29
  class="col-md-12 white--text"
29
30
  @click="addNew"
30
31
  >
@@ -1,7 +1,7 @@
1
1
  <template>
2
- <v-container>
2
+ <v-container class="pa-0">
3
3
  <div>
4
- <h3>{{ block.metadata.config.title }}</h3>
4
+ <h2>{{ block.metadata.config.title }}</h2>
5
5
  <p>{{ block.metadata.config.instructions }}</p>
6
6
  </div>
7
7
  <v-alert v-if="wordMap.length === 0" type="info" class="text-center">
@@ -86,6 +86,7 @@
86
86
  <v-col cols="12" class="d-flex justify-center">
87
87
  <v-btn
88
88
  color="primary"
89
+ elevation="0"
89
90
  outlined
90
91
  class="ma-3"
91
92
  @click="onSetUpData"
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div>
3
3
  <div>
4
- <h3
4
+ <h2
5
5
  :aria-label="
6
6
  $t(
7
7
  'windward.games.components.content.blocks.bucket_game.aria_title'
@@ -10,7 +10,7 @@
10
10
  tabindex="0"
11
11
  >
12
12
  {{ block.metadata.config.title }}
13
- </h3>
13
+ </h2>
14
14
 
15
15
  <p tabindex="0">
16
16
  {{ block.metadata.config.instructions }}
@@ -37,6 +37,7 @@
37
37
  v-if="status === 'successOutline'"
38
38
  class="mr-5"
39
39
  color="success"
40
+ elevation="0"
40
41
  @click="continueGame"
41
42
  >{{ $t('shared.forms.continue') }}
42
43
  </v-btn>
@@ -216,7 +217,7 @@
216
217
  )
217
218
  "
218
219
  >
219
- <v-col align="end" tabindex="0">
220
+ <v-col align="end" tabindex="0" class="pa-0">
220
221
  {{
221
222
  $t(
222
223
  'windward.games.components.content.blocks.matching_game.of_complete_text_area',
@@ -232,7 +233,11 @@
232
233
  style="pointer-events: none"
233
234
  ></v-progress-linear>
234
235
  <br />
235
- <v-btn color="primary" outlined @click="onReset"
236
+ <v-btn
237
+ color="primary"
238
+ outlined
239
+ elevation="0"
240
+ @click="onReset"
236
241
  >{{ $t('shared.forms.reset') }}
237
242
  </v-btn>
238
243
  </v-col>
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div>
3
- <h3>{{ block.metadata.config.title }}</h3>
3
+ <h2>{{ block.metadata.config.title }}</h2>
4
4
  <p>
5
5
  {{ block.metadata.config.instructions }}
6
6
  </p>
@@ -92,6 +92,7 @@
92
92
  <v-btn
93
93
  v-if="onFail()"
94
94
  color="primary"
95
+ elevation="0"
95
96
  text
96
97
  @click="onContinueGame"
97
98
  >{{ $t('shared.forms.try_again') }} </v-btn
@@ -7,16 +7,16 @@
7
7
  </v-row>
8
8
  <br />
9
9
  <v-row
10
+ v-if="imagePublicUrl"
10
11
  no-gutters
11
12
  align="center"
12
13
  justify="center"
13
- v-if="settings.img !== ''"
14
14
  >
15
15
  <v-img
16
16
  contain
17
17
  :aspect-ratio="16 / 9"
18
- :src="settings.img"
19
- :alt="settings.altText"
18
+ :src="imagePublicUrl"
19
+ :alt="imageAlt"
20
20
  max-height="210"
21
21
  max-width="600"
22
22
  />
@@ -31,19 +31,22 @@
31
31
  </template>
32
32
 
33
33
  <script>
34
+ import _ from 'lodash'
34
35
  import { MathHelper, ContentViewer } from '@windward/core/utils'
36
+ import Uuid from '~/helpers/Uuid'
35
37
 
36
38
  export default {
37
39
  name: 'CardFace',
38
40
  components: { ContentViewer },
39
41
  props: {
40
- settings: { type: Object },
41
- side: { type: String },
42
+ settings: { type: Object, required: true },
43
+ side: { type: String, required: true },
44
+ assets: { type: Array, required: true },
42
45
  },
43
46
  computed: {
44
47
  textClass() {
45
48
  if (
46
- !this.settings.img &&
49
+ !this.settings.imageAsset &&
47
50
  this.settings.text &&
48
51
  this.settings.text.length < 100 &&
49
52
  this.side === 'front'
@@ -55,7 +58,7 @@ export default {
55
58
  return 'text-center card-content--bold'
56
59
  }
57
60
  if (
58
- !this.settings.img &&
61
+ !this.settings.imageAsset &&
59
62
  this.settings.text &&
60
63
  (MathHelper.containsMathML(this.settings.text.length) ||
61
64
  MathHelper.containsLatex(this.settings.text.length))
@@ -63,11 +66,47 @@ export default {
63
66
  return 'text-justify centered'
64
67
  }
65
68
 
66
-
67
69
  return 'px-6 text-justify'
68
70
  },
71
+ imageAsset() {
72
+ if (!this.settings.imageAsset) {
73
+ return null
74
+ }
75
+
76
+ let image = _.cloneDeep(this.settings.imageAsset)
77
+
78
+ // If the file is linked then resolve it first
79
+ // Otherwise it's a hard link that we can just return
80
+ if (image && image.file_asset_id !== null) {
81
+ image = this.getAssetByFileAssetId(image.file_asset_id)
82
+ }
83
+ return image
84
+ },
85
+ imagePublicUrl() {
86
+ return _.get(this.imageAsset, 'asset.public_url', '')
87
+ },
88
+ imageAlt() {
89
+ // Default to user defined alt but fallback to global alt
90
+ if (this.settings.imageAlt) {
91
+ return this.settings.imageAlt
92
+ } else {
93
+ return _.get(this.imageAsset, 'asset.metadata.props.alt', '')
94
+ }
95
+ },
96
+ },
97
+ methods: {
98
+ getAssetByFileAssetId(fileAssetId) {
99
+ // Not a uuid. Instant fail
100
+ if (!Uuid.test(fileAssetId)) {
101
+ return null
102
+ }
103
+ const foundAsset = this.assets.find((asset) => {
104
+ return _.get(asset, 'file_asset_id', null) === fileAssetId
105
+ })
106
+
107
+ return foundAsset || null
108
+ },
69
109
  },
70
- methods: {},
71
110
  }
72
111
  </script>
73
112
 
@@ -2,7 +2,11 @@
2
2
  <v-container style="height: 100%" class="div-container">
3
3
  <v-card outlined @click="toggleCard" v-show="value" :class="cardClass">
4
4
  <v-card-text>
5
- <card-face :settings="frontFace" side="front"></card-face>
5
+ <CardFace
6
+ side="front"
7
+ :settings="frontFace"
8
+ :assets="assets"
9
+ ></CardFace>
6
10
  </v-card-text>
7
11
  </v-card>
8
12
  <v-card outlined @click="toggleCard" v-show="!value" :class="cardClass">
@@ -12,7 +16,11 @@
12
16
  }}</v-row>
13
17
  </v-card-title>
14
18
  <v-card-text>
15
- <cardFace :settings="backFace" side="back"></cardFace>
19
+ <CardFace
20
+ side="back"
21
+ :settings="backFace"
22
+ :assets="assets"
23
+ ></CardFace>
16
24
  </v-card-text>
17
25
  </v-card>
18
26
  </v-container>
@@ -29,9 +37,10 @@ export default {
29
37
  }
30
38
  },
31
39
  props: {
40
+ value: { type: Boolean, required: false, default: false },
32
41
  options: { type: Object, default: {} },
33
42
  slide: { type: Number, required: true, default: 0 },
34
- value: { type: Boolean, required: false, default: false },
43
+ assets: { type: Array, required: true },
35
44
  },
36
45
 
37
46
  computed: {
@@ -41,11 +50,17 @@ export default {
41
50
  result = result + ' flipInY'
42
51
  }
43
52
 
44
- if (this.frontFace.img === '' && this.backFace.img === '') {
53
+ if (
54
+ this.frontFace.imageAsset === '' &&
55
+ this.backFace.imageAsset === ''
56
+ ) {
45
57
  result = result + ' flashcard--size-md'
46
58
  }
47
59
 
48
- if (this.frontFace.img !== '' || this.backFace.img !== '') {
60
+ if (
61
+ this.frontFace.imageAsset !== '' ||
62
+ this.backFace.imageAsset !== ''
63
+ ) {
49
64
  result = result + ' flashcard--size-lg'
50
65
  }
51
66
 
@@ -53,12 +68,9 @@ export default {
53
68
  },
54
69
  frontFace() {
55
70
  return {
56
- img:
57
- this.options.front.img && this.options.front.img.asset
58
- ? this.options.front.img.asset.public_url
59
- : '',
60
- altText: this.options.front.imgAltText
61
- ? this.options.front.imgAltText
71
+ imageAsset: this.options.front.imageAsset,
72
+ imageAlt: this.options.front.imageAlt
73
+ ? this.options.front.imageAlt
62
74
  : '',
63
75
  text: this.options.front.text,
64
76
  header: this.options.front.header,
@@ -69,12 +81,9 @@ export default {
69
81
  },
70
82
  backFace() {
71
83
  return {
72
- img:
73
- this.options.back.img && this.options.back.img.asset
74
- ? this.options.back.img.asset.public_url
75
- : '',
76
- altText: this.options.back.imgAltText
77
- ? this.options.back.imgAltText
84
+ imageAsset: this.options.back.imageAsset,
85
+ imageAlt: this.options.back.imageAlt
86
+ ? this.options.back.imageAlt
78
87
  : '',
79
88
  text: this.options.back.text,
80
89
  header: this.options.back.header,
@@ -1,8 +1,8 @@
1
1
  <template>
2
2
  <div>
3
- <h3 v-if="block.metadata.config.title">
3
+ <h2 v-if="block.metadata.config.title">
4
4
  {{ block.metadata.config.title }}
5
- </h3>
5
+ </h2>
6
6
 
7
7
  <p v-if="block.metadata.config.instructions">
8
8
  {{ block.metadata.config.instructions }}
@@ -13,6 +13,7 @@
13
13
  <v-btn
14
14
  variant="elevated"
15
15
  color="primary"
16
+ elevation="0"
16
17
  outlined
17
18
  fab
18
19
  small
@@ -25,6 +26,7 @@
25
26
  <v-btn
26
27
  variant="elevated"
27
28
  color="primary"
29
+ elevation="0"
28
30
  outlined
29
31
  fab
30
32
  small
@@ -38,12 +40,12 @@
38
40
  :key="index"
39
41
  >
40
42
  <v-sheet height="100%" tile>
41
- <flashcard
43
+ <Flashcard
44
+ v-model="block.metadata.config.cards[index].side"
42
45
  :options="card"
43
46
  :slide="block.metadata.config.currentSlide"
44
- v-model="block.metadata.config.cards[index].side"
45
- @click=""
46
47
  :key="seed + '-' + block.metadata.config.currentSlide"
48
+ :assets="block.assets"
47
49
  />
48
50
  </v-sheet>
49
51
  </v-carousel-item>
@@ -84,6 +86,9 @@ export default {
84
86
  )
85
87
  this.block.metadata.config.instructions = ''
86
88
  }
89
+ if (_.isEmpty(this.block.assets)) {
90
+ this.block.assets = []
91
+ }
87
92
 
88
93
  if (_.isEmpty(this.block.metadata.config.cards)) {
89
94
  this.block.metadata.config.cards = []