@windward/games 0.0.1
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.
- package/.editorconfig +13 -0
- package/.eslintrc.js +11 -0
- package/.prettierrc +4 -0
- package/README.md +43 -0
- package/babel.config.js +1 -0
- package/components/content/CrudTable.vue +295 -0
- package/components/content/DataTableRowHandler.vue +113 -0
- package/components/content/DatableEditor.vue +223 -0
- package/components/content/blocks/BaseContentBlock.vue +8 -0
- package/components/content/blocks/dragDrop/BucketGame.vue +520 -0
- package/components/content/blocks/dragDrop/SortingGame.vue +303 -0
- package/components/content/blocks/flashcards/CardFace.vue +112 -0
- package/components/content/blocks/flashcards/Flashcard.vue +150 -0
- package/components/content/blocks/flashcards/FlashcardSlides.vue +121 -0
- package/components/content/blocks/matchingGame/MatchingGame.vue +545 -0
- package/components/content/blocks/quizshowGame/AnswerPanel.vue +338 -0
- package/components/content/blocks/quizshowGame/Gridview.vue +260 -0
- package/components/content/blocks/quizshowGame/QuizShow.vue +516 -0
- package/components/content/blocks/quizshowGame/feedbackIcons.vue +41 -0
- package/components/content/blocks/slideshow/SlideShow.vue +175 -0
- package/components/settings/BucketGameSettingsManager.vue +683 -0
- package/components/settings/FlashCardSlidesManager.vue +489 -0
- package/components/settings/MatchingGameManager.vue +775 -0
- package/components/settings/QuizShowSettingsManager.vue +408 -0
- package/components/settings/SlideShowManager.vue +248 -0
- package/components/settings/SortingGameSettingsManager.vue +286 -0
- package/i18n/en-US/components/content/blocks/bucket_game.ts +39 -0
- package/i18n/en-US/components/content/blocks/flashcard.ts +5 -0
- package/i18n/en-US/components/content/blocks/index.ts +15 -0
- package/i18n/en-US/components/content/blocks/matching_game.ts +26 -0
- package/i18n/en-US/components/content/blocks/quizshow_game.ts +35 -0
- package/i18n/en-US/components/content/blocks/slideshow.ts +13 -0
- package/i18n/en-US/components/content/blocks/sorting_game.ts +5 -0
- package/i18n/en-US/components/content/crud_table.ts +6 -0
- package/i18n/en-US/components/content/index.ts +7 -0
- package/i18n/en-US/components/index.ts +9 -0
- package/i18n/en-US/components/navigation/index.ts +5 -0
- package/i18n/en-US/components/settings/bucket_game.ts +35 -0
- package/i18n/en-US/components/settings/flashcard.ts +26 -0
- package/i18n/en-US/components/settings/index.ts +13 -0
- package/i18n/en-US/components/settings/matching_game.ts +15 -0
- package/i18n/en-US/components/settings/quizshow_game.ts +14 -0
- package/i18n/en-US/components/settings/slideshow.ts +11 -0
- package/i18n/en-US/index.ts +15 -0
- package/i18n/en-US/modules/index.ts +5 -0
- package/i18n/en-US/pages/index.ts +5 -0
- package/i18n/en-US/shared/content_blocks.ts +14 -0
- package/i18n/en-US/shared/index.ts +7 -0
- package/i18n/en-US/shared/settings.ts +10 -0
- package/i18n/en-US.ts +5 -0
- package/jest.config.js +18 -0
- package/package.json +51 -0
- package/plugin.js +150 -0
- package/test/blocks/dragDrop/BucketGame.spec.js +26 -0
- package/test/blocks/dragDrop/SortingGame.spec.js +47 -0
- package/test/blocks/flashcards/CardFace.spec.js +21 -0
- package/test/blocks/flashcards/FlashCardSlides.spec.js +24 -0
- package/test/blocks/flashcards/Flashcard.spec.js +24 -0
- package/test/blocks/matchingGame/MatchingGame.spec.js +26 -0
- package/test/blocks/quizShow/quizShow.spec.js +31 -0
- package/test/blocks/slideshow/slideshow.spec.js +24 -0
- package/test/mocks.js +2 -0
- package/test/settings/BucketGameManager.spec.js +125 -0
- package/test/settings/FlashCardSlidesManager.spec.js +24 -0
- package/test/settings/MatchingGameManager.spec.js +30 -0
- package/test/settings/SlideShowManager.spec.js +30 -0
- package/test/settings/SortingGameManager.spec.js +71 -0
- package/tsconfig.json +20 -0
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<br />
|
|
4
|
+
<v-form ref="form" v-if="!loading">
|
|
5
|
+
<v-text-field
|
|
6
|
+
v-model="block.metadata.config.title"
|
|
7
|
+
:counter="50"
|
|
8
|
+
maxlength="50"
|
|
9
|
+
:label="
|
|
10
|
+
$t(
|
|
11
|
+
'plugin.games.components.settings.quizshow_game.form.title'
|
|
12
|
+
)
|
|
13
|
+
"
|
|
14
|
+
></v-text-field>
|
|
15
|
+
<br />
|
|
16
|
+
<v-checkbox
|
|
17
|
+
v-model="block.metadata.config.responsive"
|
|
18
|
+
:label="
|
|
19
|
+
$t(
|
|
20
|
+
'plugin.games.components.settings.quizshow_game.form.responsive'
|
|
21
|
+
)
|
|
22
|
+
"
|
|
23
|
+
></v-checkbox>
|
|
24
|
+
<br />
|
|
25
|
+
<textEditor v-model="block.metadata.config.instructions" />
|
|
26
|
+
<br />
|
|
27
|
+
|
|
28
|
+
<v-card elevation="0" outlined>
|
|
29
|
+
<v-subheader
|
|
30
|
+
>{{
|
|
31
|
+
$t(
|
|
32
|
+
'plugin.games.components.settings.quizshow_game.form.max_categories'
|
|
33
|
+
)
|
|
34
|
+
}}
|
|
35
|
+
</v-subheader>
|
|
36
|
+
<v-slider
|
|
37
|
+
v-model="block.metadata.config.maxCategories"
|
|
38
|
+
:tick-labels="[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]"
|
|
39
|
+
step="1"
|
|
40
|
+
min="1"
|
|
41
|
+
max="10"
|
|
42
|
+
thumb-label
|
|
43
|
+
ticks="always"
|
|
44
|
+
tick-size="4"
|
|
45
|
+
@change="onChange('categories')"
|
|
46
|
+
></v-slider>
|
|
47
|
+
</v-card>
|
|
48
|
+
<br />
|
|
49
|
+
<v-card elevation="0" outlined>
|
|
50
|
+
<v-subheader
|
|
51
|
+
>{{
|
|
52
|
+
$t(
|
|
53
|
+
'plugin.games.components.settings.quizshow_game.form.max_rows'
|
|
54
|
+
)
|
|
55
|
+
}}
|
|
56
|
+
</v-subheader>
|
|
57
|
+
<v-slider
|
|
58
|
+
v-model="block.metadata.config.maxRows"
|
|
59
|
+
:tick-labels="[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]"
|
|
60
|
+
step="1"
|
|
61
|
+
min="1"
|
|
62
|
+
max="10"
|
|
63
|
+
thumb-label
|
|
64
|
+
ticks="always"
|
|
65
|
+
tick-size="4"
|
|
66
|
+
@change="onChange('rows')"
|
|
67
|
+
></v-slider>
|
|
68
|
+
</v-card>
|
|
69
|
+
<v-expansion-panels outlined tile flat>
|
|
70
|
+
<v-expansion-panel>
|
|
71
|
+
<v-expansion-panel-header>
|
|
72
|
+
<template v-slot:default="{ open }">
|
|
73
|
+
<v-row no-gutters>
|
|
74
|
+
{{
|
|
75
|
+
$t(
|
|
76
|
+
'plugin.games.components.settings.quizshow_game.form.categories'
|
|
77
|
+
)
|
|
78
|
+
}}
|
|
79
|
+
</v-row>
|
|
80
|
+
</template>
|
|
81
|
+
<template v-slot:actions>
|
|
82
|
+
<v-icon
|
|
83
|
+
:color="
|
|
84
|
+
expansionColor(
|
|
85
|
+
block.metadata.config.categories,
|
|
86
|
+
block.metadata.config.maxCategories
|
|
87
|
+
)
|
|
88
|
+
"
|
|
89
|
+
>
|
|
90
|
+
{{
|
|
91
|
+
expansionIcon(
|
|
92
|
+
block.metadata.config.categories,
|
|
93
|
+
block.metadata.config.maxCategories
|
|
94
|
+
)
|
|
95
|
+
}}
|
|
96
|
+
</v-icon>
|
|
97
|
+
</template>
|
|
98
|
+
</v-expansion-panel-header>
|
|
99
|
+
<v-expansion-panel-content>
|
|
100
|
+
<v-text-field
|
|
101
|
+
v-for="index in Number(
|
|
102
|
+
block.metadata.config.maxCategories
|
|
103
|
+
)"
|
|
104
|
+
:key="'cat' + index"
|
|
105
|
+
v-model="
|
|
106
|
+
block.metadata.config.categories[index - 1]
|
|
107
|
+
"
|
|
108
|
+
:counter="255"
|
|
109
|
+
maxlength="255"
|
|
110
|
+
:label="
|
|
111
|
+
$t(
|
|
112
|
+
'plugin.games.components.settings.quizshow_game.form.category'
|
|
113
|
+
) +
|
|
114
|
+
' ' +
|
|
115
|
+
index
|
|
116
|
+
"
|
|
117
|
+
outlined
|
|
118
|
+
></v-text-field>
|
|
119
|
+
</v-expansion-panel-content>
|
|
120
|
+
</v-expansion-panel>
|
|
121
|
+
|
|
122
|
+
<br />
|
|
123
|
+
|
|
124
|
+
<v-expansion-panel>
|
|
125
|
+
<v-expansion-panel-header>
|
|
126
|
+
<template v-slot:default="{ open }">
|
|
127
|
+
<v-row no-gutters>
|
|
128
|
+
{{
|
|
129
|
+
$t(
|
|
130
|
+
'plugin.games.components.settings.quizshow_game.form.points_per_row'
|
|
131
|
+
)
|
|
132
|
+
}}
|
|
133
|
+
</v-row>
|
|
134
|
+
</template>
|
|
135
|
+
<template v-slot:actions>
|
|
136
|
+
<v-icon
|
|
137
|
+
:color="
|
|
138
|
+
expansionColor(
|
|
139
|
+
block.metadata.config.points,
|
|
140
|
+
block.metadata.config.maxRows
|
|
141
|
+
)
|
|
142
|
+
"
|
|
143
|
+
>
|
|
144
|
+
{{
|
|
145
|
+
expansionIcon(
|
|
146
|
+
block.metadata.config.points,
|
|
147
|
+
block.metadata.config.maxRows
|
|
148
|
+
)
|
|
149
|
+
}}
|
|
150
|
+
</v-icon>
|
|
151
|
+
</template>
|
|
152
|
+
</v-expansion-panel-header>
|
|
153
|
+
<v-expansion-panel-content>
|
|
154
|
+
<v-text-field
|
|
155
|
+
v-for="index in Number(
|
|
156
|
+
block.metadata.config.maxRows
|
|
157
|
+
)"
|
|
158
|
+
:key="'row' + index"
|
|
159
|
+
v-model="block.metadata.config.points[index - 1]"
|
|
160
|
+
type="number"
|
|
161
|
+
min="1"
|
|
162
|
+
max="9999"
|
|
163
|
+
@input="onPointsChange(index - 1)"
|
|
164
|
+
:rules="validation.pointsRules"
|
|
165
|
+
:label="
|
|
166
|
+
$t(
|
|
167
|
+
'plugin.games.components.settings.quizshow_game.form.row'
|
|
168
|
+
) +
|
|
169
|
+
' ' +
|
|
170
|
+
index
|
|
171
|
+
"
|
|
172
|
+
outlined
|
|
173
|
+
></v-text-field>
|
|
174
|
+
</v-expansion-panel-content>
|
|
175
|
+
</v-expansion-panel>
|
|
176
|
+
</v-expansion-panels>
|
|
177
|
+
|
|
178
|
+
<br />
|
|
179
|
+
</v-form>
|
|
180
|
+
<div v-if="loading" class="text-center">
|
|
181
|
+
<v-progress-circular
|
|
182
|
+
:size="70"
|
|
183
|
+
:width="7"
|
|
184
|
+
color="primary"
|
|
185
|
+
indeterminate
|
|
186
|
+
></v-progress-circular>
|
|
187
|
+
</div>
|
|
188
|
+
</div>
|
|
189
|
+
</template>
|
|
190
|
+
|
|
191
|
+
<script>
|
|
192
|
+
import TextEditor from '~/components/Text/TextEditor.vue'
|
|
193
|
+
import BaseContentSettings from '~/components/Content/Tool/BaseContentSettings.js'
|
|
194
|
+
export default {
|
|
195
|
+
name: 'QuizShowSettingsManager',
|
|
196
|
+
extends: BaseContentSettings,
|
|
197
|
+
components: {
|
|
198
|
+
TextEditor,
|
|
199
|
+
},
|
|
200
|
+
watch: {
|
|
201
|
+
'block.metadata.config.maxCategories'(newValue, oldValue) {
|
|
202
|
+
this.quizShowSettings.maxCategories = _.isArray(
|
|
203
|
+
this.block.metadata.config.categories
|
|
204
|
+
)
|
|
205
|
+
? this.block.metadata.config.categories.length
|
|
206
|
+
: oldValue
|
|
207
|
+
},
|
|
208
|
+
'block.metadata.config.maxRows'(newValue, oldValue) {
|
|
209
|
+
this.quizShowSettings.maxRows = _.isArray(
|
|
210
|
+
this.block.metadata.config.points
|
|
211
|
+
)
|
|
212
|
+
? this.block.metadata.config.points.length
|
|
213
|
+
: oldValue
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
data() {
|
|
217
|
+
return {
|
|
218
|
+
validation: {
|
|
219
|
+
lengthRules: [
|
|
220
|
+
(v) => !!v || this.$t('shared.forms.errors.required'),
|
|
221
|
+
(v) =>
|
|
222
|
+
(!!v && v.length >= 1) ||
|
|
223
|
+
this.$t('shared.forms.errors.required'),
|
|
224
|
+
(v) => {
|
|
225
|
+
if (!!v && v <= 10) {
|
|
226
|
+
return true
|
|
227
|
+
} else {
|
|
228
|
+
return this.$t('shared.forms.errors.number_lt', [
|
|
229
|
+
10,
|
|
230
|
+
])
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
],
|
|
234
|
+
pointsRules: [
|
|
235
|
+
(v) => !!v || this.$t('shared.forms.errors.required'),
|
|
236
|
+
(v) =>
|
|
237
|
+
(!!v && v.length >= 1) ||
|
|
238
|
+
this.$t('shared.forms.errors.required'),
|
|
239
|
+
(v) => {
|
|
240
|
+
if (!!v && v <= 9999) {
|
|
241
|
+
return true
|
|
242
|
+
} else {
|
|
243
|
+
return this.$t('shared.forms.errors.number_lt', [
|
|
244
|
+
9999,
|
|
245
|
+
])
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
],
|
|
249
|
+
},
|
|
250
|
+
loading: false,
|
|
251
|
+
quizShowSettings: {
|
|
252
|
+
title: '',
|
|
253
|
+
responsive: true,
|
|
254
|
+
instructions: '',
|
|
255
|
+
maxCategories: 4,
|
|
256
|
+
maxRows: 4,
|
|
257
|
+
categories: [' ', ' ', ' ', ' '],
|
|
258
|
+
points: ['100', '200', '300', '400'],
|
|
259
|
+
},
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
computed: {},
|
|
263
|
+
beforeMount() {
|
|
264
|
+
if (_.isEmpty(this.block.metadata.config)) {
|
|
265
|
+
this.block.metadata.config = _.cloneDeep(this.quizShowSettings)
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
methods: {
|
|
269
|
+
expansionIcon(element, elementMax) {
|
|
270
|
+
let icon = ''
|
|
271
|
+
switch (element.length) {
|
|
272
|
+
case 0:
|
|
273
|
+
icon = 'mdi-alert-circle'
|
|
274
|
+
break
|
|
275
|
+
|
|
276
|
+
default:
|
|
277
|
+
icon = 'mdi-chevron-down'
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
return icon
|
|
281
|
+
},
|
|
282
|
+
expansionColor(element, elementMax) {
|
|
283
|
+
let color = ''
|
|
284
|
+
switch (element.length) {
|
|
285
|
+
case 0:
|
|
286
|
+
color = 'error'
|
|
287
|
+
break
|
|
288
|
+
case elementMax:
|
|
289
|
+
color = 'success'
|
|
290
|
+
break
|
|
291
|
+
default:
|
|
292
|
+
color = ''
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
return color
|
|
296
|
+
},
|
|
297
|
+
changeMaxCategories() {
|
|
298
|
+
if (this.block.metadata.config.maxCategories > 10) {
|
|
299
|
+
this.block.metadata.config.maxCategories = 10
|
|
300
|
+
} else if (
|
|
301
|
+
!_.isNumber(this.block.metadata.config.maxCategories) ||
|
|
302
|
+
this.block.metadata.config.maxCategories < 1
|
|
303
|
+
) {
|
|
304
|
+
this.block.metadata.config.maxCategories = 1
|
|
305
|
+
}
|
|
306
|
+
const max = this.block.metadata.config.maxCategories
|
|
307
|
+
if (this.block.metadata.config.categories.length > 0) {
|
|
308
|
+
this.block.metadata.config.categories =
|
|
309
|
+
this.block.metadata.config.categories
|
|
310
|
+
.map(function (element, index) {
|
|
311
|
+
if (max > index) {
|
|
312
|
+
return element
|
|
313
|
+
}
|
|
314
|
+
})
|
|
315
|
+
.filter((cat) => cat != null)
|
|
316
|
+
}
|
|
317
|
+
this.block.metadata.config.categories =
|
|
318
|
+
this.block.metadata.config.categories.concat(
|
|
319
|
+
...Array(
|
|
320
|
+
this.block.metadata.config.maxCategories -
|
|
321
|
+
this.block.metadata.config.categories.length
|
|
322
|
+
)
|
|
323
|
+
)
|
|
324
|
+
},
|
|
325
|
+
changeMaxRows() {
|
|
326
|
+
if (this.block.metadata.config.maxRows > 10) {
|
|
327
|
+
this.block.metadata.config.maxRows = 10
|
|
328
|
+
} else if (
|
|
329
|
+
!_.isNumber(this.block.metadata.config.maxRows) ||
|
|
330
|
+
this.block.metadata.config.maxRows < 1
|
|
331
|
+
) {
|
|
332
|
+
this.block.metadata.config.maxRows = 1
|
|
333
|
+
}
|
|
334
|
+
const maxRows = this.block.metadata.config.maxRows
|
|
335
|
+
if (this.block.metadata.config.points.length > 0) {
|
|
336
|
+
this.block.metadata.config.points =
|
|
337
|
+
this.block.metadata.config.points
|
|
338
|
+
.map(function (element, index) {
|
|
339
|
+
if (maxRows > index) {
|
|
340
|
+
return element
|
|
341
|
+
}
|
|
342
|
+
})
|
|
343
|
+
.filter((point) => point != null)
|
|
344
|
+
}
|
|
345
|
+
this.block.metadata.config.points =
|
|
346
|
+
this.block.metadata.config.points.concat(
|
|
347
|
+
...Array(
|
|
348
|
+
this.block.metadata.config.maxRows -
|
|
349
|
+
this.block.metadata.config.points.length
|
|
350
|
+
)
|
|
351
|
+
)
|
|
352
|
+
},
|
|
353
|
+
onPointsChange(index) {
|
|
354
|
+
this.block.metadata.config.points[index] = _.toNumber(
|
|
355
|
+
this.block.metadata.config.points[index]
|
|
356
|
+
)
|
|
357
|
+
if (this.block.metadata.config.points[index] > 9999) {
|
|
358
|
+
this.block.metadata.config.points[index] = 9999
|
|
359
|
+
} else if (
|
|
360
|
+
!_.isNumber(this.block.metadata.config.points[index]) ||
|
|
361
|
+
this.block.metadata.config.points[index] < 1
|
|
362
|
+
) {
|
|
363
|
+
this.block.metadata.config.points[index] = 1
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
onChange(input) {
|
|
367
|
+
this.$toast.info(
|
|
368
|
+
this.$t(
|
|
369
|
+
'plugin.games.components.settings.quizshow_game.form.confirm_change_text'
|
|
370
|
+
),
|
|
371
|
+
{
|
|
372
|
+
icon: 'mdi-help',
|
|
373
|
+
duration: null,
|
|
374
|
+
action: [
|
|
375
|
+
{
|
|
376
|
+
text: this.$t('shared.forms.cancel'),
|
|
377
|
+
onClick: (e, toastObject) => {
|
|
378
|
+
toastObject.goAway(0)
|
|
379
|
+
if (input === 'categories') {
|
|
380
|
+
this.block.metadata.config.maxCategories =
|
|
381
|
+
this.quizShowSettings.maxCategories
|
|
382
|
+
} else if (input === 'rows') {
|
|
383
|
+
this.block.metadata.config.maxRows =
|
|
384
|
+
this.quizShowSettings.maxRows
|
|
385
|
+
}
|
|
386
|
+
},
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
text: this.$t('shared.forms.confirm'),
|
|
390
|
+
// router navigation
|
|
391
|
+
onClick: (e, toastObject) => {
|
|
392
|
+
if (input === 'categories') {
|
|
393
|
+
this.changeMaxCategories()
|
|
394
|
+
} else if (input === 'rows') {
|
|
395
|
+
this.changeMaxRows()
|
|
396
|
+
}
|
|
397
|
+
toastObject.goAway(0)
|
|
398
|
+
},
|
|
399
|
+
},
|
|
400
|
+
],
|
|
401
|
+
}
|
|
402
|
+
)
|
|
403
|
+
},
|
|
404
|
+
},
|
|
405
|
+
}
|
|
406
|
+
</script>
|
|
407
|
+
|
|
408
|
+
<style scoped></style>
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div>
|
|
4
|
+
<v-form ref="form" v-model="valid" v-if="!loading">
|
|
5
|
+
<v-text-field
|
|
6
|
+
v-model="block.metadata.config.title"
|
|
7
|
+
:counter="50"
|
|
8
|
+
maxlength="50"
|
|
9
|
+
:label="
|
|
10
|
+
$t(
|
|
11
|
+
'plugin.games.components.settings.slideshow.form.title'
|
|
12
|
+
)
|
|
13
|
+
"
|
|
14
|
+
></v-text-field>
|
|
15
|
+
<br />
|
|
16
|
+
<v-textarea
|
|
17
|
+
outlined
|
|
18
|
+
auto-grow
|
|
19
|
+
v-model="block.metadata.config.instructions"
|
|
20
|
+
:counter="255"
|
|
21
|
+
maxlength="255"
|
|
22
|
+
:label="
|
|
23
|
+
$t(
|
|
24
|
+
'plugin.games.components.settings.slideshow.form.instructions'
|
|
25
|
+
)
|
|
26
|
+
"
|
|
27
|
+
></v-textarea>
|
|
28
|
+
<br />
|
|
29
|
+
</v-form>
|
|
30
|
+
<div v-if="loading" class="text-center">
|
|
31
|
+
<v-progress-circular
|
|
32
|
+
:size="70"
|
|
33
|
+
:width="7"
|
|
34
|
+
color="primary"
|
|
35
|
+
indeterminate
|
|
36
|
+
></v-progress-circular>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
<div>
|
|
40
|
+
<v-layout class="d-flex">
|
|
41
|
+
<v-toolbar flat class="toolbar">
|
|
42
|
+
<v-text-field
|
|
43
|
+
class="shrink pt-7 pr-2"
|
|
44
|
+
:label="
|
|
45
|
+
$t(
|
|
46
|
+
'plugin.games.components.content.blocks.slideshow.amount_of_slides'
|
|
47
|
+
)
|
|
48
|
+
"
|
|
49
|
+
:placeholder="
|
|
50
|
+
$t(
|
|
51
|
+
'plugin.games.components.content.blocks.slideshow.amount_of_slides'
|
|
52
|
+
)
|
|
53
|
+
"
|
|
54
|
+
outlined
|
|
55
|
+
dense
|
|
56
|
+
type="number"
|
|
57
|
+
:value="block.metadata.config.slides.length"
|
|
58
|
+
:disabled="true"
|
|
59
|
+
></v-text-field>
|
|
60
|
+
<v-btn @click="onAddSlide" color="primary">
|
|
61
|
+
{{
|
|
62
|
+
$t(
|
|
63
|
+
'plugin.games.components.content.blocks.slideshow.add_slide'
|
|
64
|
+
)
|
|
65
|
+
}}
|
|
66
|
+
</v-btn>
|
|
67
|
+
</v-toolbar>
|
|
68
|
+
</v-layout>
|
|
69
|
+
<div>
|
|
70
|
+
<v-container>
|
|
71
|
+
<v-expansion-panels flat>
|
|
72
|
+
<draggable
|
|
73
|
+
:list="block.metadata.config.slides"
|
|
74
|
+
:disabled="false"
|
|
75
|
+
class="flex-fill"
|
|
76
|
+
:group="{
|
|
77
|
+
name: 'people',
|
|
78
|
+
pull: 'clone',
|
|
79
|
+
put: false,
|
|
80
|
+
}"
|
|
81
|
+
>
|
|
82
|
+
<v-expansion-panel
|
|
83
|
+
v-for="(slide, index) in block.metadata.config
|
|
84
|
+
.slides"
|
|
85
|
+
:key="index"
|
|
86
|
+
>
|
|
87
|
+
<v-expansion-panel-header>
|
|
88
|
+
<v-container>
|
|
89
|
+
<v-row
|
|
90
|
+
align="center"
|
|
91
|
+
justify="space-between"
|
|
92
|
+
>
|
|
93
|
+
<h3>
|
|
94
|
+
{{
|
|
95
|
+
$t(
|
|
96
|
+
'plugin.games.components.content.blocks.slideshow.slides.slide',
|
|
97
|
+
[index + 1]
|
|
98
|
+
)
|
|
99
|
+
}}
|
|
100
|
+
</h3>
|
|
101
|
+
<v-btn
|
|
102
|
+
@click="onDeleteSlide(index)"
|
|
103
|
+
color="primary"
|
|
104
|
+
>
|
|
105
|
+
<v-icon> mdi-delete</v-icon>
|
|
106
|
+
<span class="sr-only">{{
|
|
107
|
+
$t('shared.forms.delete')
|
|
108
|
+
}}</span>
|
|
109
|
+
</v-btn>
|
|
110
|
+
</v-row>
|
|
111
|
+
</v-container>
|
|
112
|
+
</v-expansion-panel-header>
|
|
113
|
+
<v-expansion-panel-content>
|
|
114
|
+
<v-text-field
|
|
115
|
+
v-model="slide['header']"
|
|
116
|
+
:autofocus="true"
|
|
117
|
+
outlined
|
|
118
|
+
:label="
|
|
119
|
+
$t(
|
|
120
|
+
'plugin.games.components.content.blocks.slideshow.slides.slide_header'
|
|
121
|
+
)
|
|
122
|
+
"
|
|
123
|
+
></v-text-field>
|
|
124
|
+
<v-text-field
|
|
125
|
+
v-model="slide['description']"
|
|
126
|
+
outlined
|
|
127
|
+
:label="
|
|
128
|
+
$t(
|
|
129
|
+
'plugin.games.components.content.blocks.slideshow.slides.slide_description'
|
|
130
|
+
)
|
|
131
|
+
"
|
|
132
|
+
></v-text-field>
|
|
133
|
+
<v-text-field
|
|
134
|
+
v-model="slide['image_alt']"
|
|
135
|
+
outlined
|
|
136
|
+
:label="
|
|
137
|
+
$t(
|
|
138
|
+
'plugin.games.components.content.blocks.slideshow.slides.image_alt'
|
|
139
|
+
)
|
|
140
|
+
"
|
|
141
|
+
></v-text-field>
|
|
142
|
+
<ContentBlockAsset
|
|
143
|
+
id="content-block-asset"
|
|
144
|
+
v-model="slide['image']"
|
|
145
|
+
mimes="image/png,image/jpeg"
|
|
146
|
+
></ContentBlockAsset>
|
|
147
|
+
</v-expansion-panel-content>
|
|
148
|
+
</v-expansion-panel>
|
|
149
|
+
</draggable>
|
|
150
|
+
</v-expansion-panels>
|
|
151
|
+
</v-container>
|
|
152
|
+
</div>
|
|
153
|
+
</div>
|
|
154
|
+
</div>
|
|
155
|
+
</template>
|
|
156
|
+
<script>
|
|
157
|
+
import BaseContentSettings from '~/components/Content/Tool/BaseContentSettings.js'
|
|
158
|
+
import draggable from 'vuedraggable'
|
|
159
|
+
import _ from 'lodash'
|
|
160
|
+
import ContentBlockAsset from '~/components/Content/ContentBlockAsset.vue'
|
|
161
|
+
|
|
162
|
+
export default {
|
|
163
|
+
name: 'SlideShowManager',
|
|
164
|
+
extends: BaseContentSettings,
|
|
165
|
+
components: {
|
|
166
|
+
draggable,
|
|
167
|
+
ContentBlockAsset,
|
|
168
|
+
},
|
|
169
|
+
beforeMount() {
|
|
170
|
+
if (_.isEmpty(this.block)) {
|
|
171
|
+
this.block = {}
|
|
172
|
+
}
|
|
173
|
+
if (_.isEmpty(this.block.body)) {
|
|
174
|
+
this.block.body = 'Slideshow'
|
|
175
|
+
}
|
|
176
|
+
if (_.isEmpty(this.block.metadata)) {
|
|
177
|
+
this.block.metadata = {}
|
|
178
|
+
}
|
|
179
|
+
if (_.isEmpty(this.block.metadata.config)) {
|
|
180
|
+
this.block.metadata.config = {}
|
|
181
|
+
}
|
|
182
|
+
if (_.isEmpty(this.block.metadata.config.title)) {
|
|
183
|
+
this.block.metadata.config.title = ''
|
|
184
|
+
}
|
|
185
|
+
if (_.isEmpty(this.block.metadata.config.instructions)) {
|
|
186
|
+
this.block.metadata.config.instructions = ''
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (_.isEmpty(this.block.metadata.config.slides)) {
|
|
190
|
+
this.block.metadata.config.slides = []
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
beforeDestroy() {
|
|
194
|
+
if (this.debouncer) {
|
|
195
|
+
clearTimeout(this.debouncer)
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
data() {
|
|
199
|
+
return {
|
|
200
|
+
valid: true,
|
|
201
|
+
debounce: null,
|
|
202
|
+
loading: false,
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
methods: {
|
|
206
|
+
onAddSlide() {
|
|
207
|
+
let defaultSlide = {
|
|
208
|
+
id: this.block.metadata.config.slides.length + 1,
|
|
209
|
+
header: '',
|
|
210
|
+
description: '',
|
|
211
|
+
image: null,
|
|
212
|
+
image_alt: '',
|
|
213
|
+
}
|
|
214
|
+
this.block.metadata.config.slides.push(defaultSlide)
|
|
215
|
+
},
|
|
216
|
+
onDeleteSlide(index) {
|
|
217
|
+
this.$toast.info(this.$t('shared.forms.confirm_delete_text'), {
|
|
218
|
+
icon: 'mdi-help',
|
|
219
|
+
duration: null,
|
|
220
|
+
action: [
|
|
221
|
+
{
|
|
222
|
+
text: this.$t('shared.forms.cancel'),
|
|
223
|
+
onClick: (e, toastObject) => {
|
|
224
|
+
toastObject.goAway(0)
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
text: this.$t('shared.forms.confirm'),
|
|
229
|
+
// router navigation
|
|
230
|
+
onClick: (e, toastObject) => {
|
|
231
|
+
this.block.metadata.config.slides.splice(index, 1)
|
|
232
|
+
toastObject.goAway(0)
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
],
|
|
236
|
+
})
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
}
|
|
240
|
+
</script>
|
|
241
|
+
<style scoped>
|
|
242
|
+
.v-progress-circular {
|
|
243
|
+
margin: 1rem;
|
|
244
|
+
}
|
|
245
|
+
#content-block-asset {
|
|
246
|
+
max-width: 251px;
|
|
247
|
+
}
|
|
248
|
+
</style>
|