@windward/games 0.0.7 → 0.0.9

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.
@@ -1,250 +1,221 @@
1
1
  <template>
2
2
  <div>
3
- <br />
4
3
  <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
- :label="
9
- $t(
10
- 'plugin.games.components.settings.bucket_game.form.title'
11
- )
12
- "
13
- ref="title"
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
- :label="
22
- $t(
23
- 'plugin.games.components.settings.bucket_game.form.instructions'
24
- )
25
- "
26
- ></v-textarea>
27
- <br />
28
- <v-container class="background pa-0">
29
- <v-expansion-panels flat>
30
- <v-expansion-panel>
31
- <v-expansion-panel-header class="pa-0">
32
- <h3>
33
- {{
34
- $t(
35
- 'plugin.games.components.settings.bucket_game.form.buckets'
36
- )
37
- }}
38
- </h3>
39
- </v-expansion-panel-header>
40
- <v-expansion-panel-content>
41
- <v-container
42
- v-for="(item, index) in block.metadata.config
43
- .bucket_titles"
44
- :key="'bucket_' + index"
45
- fluid
46
- grid-list
47
- class="cardOutline"
48
- elevation="0"
49
- outlined
50
- tile
4
+ <v-container class="pa-0">
5
+ <v-text-field
6
+ v-model="block.metadata.config.title"
7
+ outlined
8
+ :counter="50"
9
+ :autofocus="true"
10
+ :label="
11
+ $t(
12
+ 'plugin.games.components.settings.bucket_game.form.title'
13
+ )
14
+ "
15
+ ref="title"
16
+ ></v-text-field>
17
+ <v-textarea
18
+ outlined
19
+ auto-grow
20
+ v-model="block.metadata.config.instructions"
21
+ :counter="255"
22
+ :label="
23
+ $t(
24
+ 'plugin.games.components.settings.bucket_game.form.instructions'
25
+ )
26
+ "
27
+ ></v-textarea>
28
+ </v-container>
29
+ <v-divider class="my-4 primary"></v-divider>
30
+ <v-container class="pa-0">
31
+ <p>
32
+ {{
33
+ $t(
34
+ 'plugin.games.components.settings.bucket_game.form.buckets'
35
+ )
36
+ }}
37
+ </p>
38
+ <draggable
39
+ v-model="block.metadata.config.bucket_titles"
40
+ group="containers"
41
+ >
42
+ <v-container
43
+ v-for="(item, index) in block.metadata.config
44
+ .bucket_titles"
45
+ :key="'bucket_' + index"
46
+ class="container-card-outline"
47
+ elevation="0"
48
+ outlined
49
+ tile
50
+ >
51
+ <v-layout row wrap outlined>
52
+ <v-flex xs10 :class="bottomBorder(index)">
53
+ <p
54
+ class="text-truncate mb-0 p-header"
55
+ @click="onOpenEditor(index)"
56
+ v-on:keyup.enter="onOpenEditor(index)"
57
+ @mouseover="onHover"
58
+ @mouseleave="onHoverLeave"
59
+ :class="cursor"
60
+ tabindex="0"
61
+ >
62
+ <v-icon>mdi-drag-vertical</v-icon>
63
+ <span class="span-text-ellipsis">
64
+ {{
65
+ item.title
66
+ ? block.metadata.config
67
+ .bucket_titles[index]
68
+ .title
69
+ : $t(
70
+ 'plugin.games.components.settings.bucket_game.form.click_here'
71
+ )
72
+ }}
73
+ </span>
74
+ </p>
75
+ </v-flex>
76
+ <v-flex
77
+ xs2
78
+ class="btn-header-delete d-flex justify-center"
79
+ :class="bottomBorder(index)"
51
80
  >
52
- <v-layout row wrap outlined>
53
- <v-flex xs10 :class="bottomBorder(index)">
54
- <p
55
- class="text-truncate pa-0 ma-0 pTagContainer"
56
- @click="onOpenEditor(index)"
57
- v-on:keyup.enter="
58
- onOpenEditor(index)
59
- "
60
- @mouseover="onHover"
61
- @mouseleave="onHoverLeave"
62
- :class="cursor"
63
- tabindex="0"
64
- >
65
- <v-icon class="pl-2"
66
- >mdi-drag-vertical</v-icon
67
- >
68
- <span class="ellipsisText">
69
- {{
70
- item.title
71
- ? block.metadata.config
72
- .bucket_titles[
73
- index
74
- ].title
75
- : $t(
76
- 'plugin.games.components.settings.bucket_game.form.click_here'
77
- )
78
- }}
79
- </span>
80
- </p>
81
- </v-flex>
82
- <v-flex
83
- xs2
84
- class="sideBorder d-flex justify-center"
85
- :class="bottomBorder(index)"
81
+ <v-icon
82
+ @click="onConfirmDeleteBucket(index)"
83
+ class="btn-delete-icon"
84
+ >mdi-delete-outline</v-icon
85
+ >
86
+ </v-flex>
87
+ <v-container v-if="item.expand">
88
+ <v-flex xs12>
89
+ <p class="p-label">
90
+ {{
91
+ $t(
92
+ 'plugin.games.components.content.blocks.bucket_game.name'
93
+ )
94
+ }}
95
+ </p>
96
+ <v-text-field
97
+ outlined
98
+ :autofocus="true"
99
+ v-model="
100
+ block.metadata.config.bucket_titles[
101
+ index
102
+ ].title
103
+ "
104
+ ></v-text-field>
105
+ </v-flex>
106
+ <v-flex xs12>
107
+ <p class="p-label">
108
+ {{
109
+ $t(
110
+ 'plugin.games.components.settings.bucket_game.form.color'
111
+ )
112
+ }}
113
+ </p>
114
+ <v-color-picker
115
+ v-model="item.color"
116
+ hide-canvas
117
+ hide-inputs
118
+ hide-sliders
119
+ show-swatches
120
+ :swatches="swatches"
121
+ swatches-max-height="130"
122
+ ></v-color-picker>
123
+ </v-flex>
124
+ <v-flex xs12>
125
+ <p class="p-label">
126
+ {{
127
+ $t(
128
+ 'plugin.games.components.content.blocks.bucket_game.answers'
129
+ )
130
+ }}
131
+ </p>
132
+ </v-flex>
133
+ <template>
134
+ <v-container
135
+ v-for="(bucket, indexBucket) in block
136
+ .metadata.config.bucket_answers[
137
+ index
138
+ ]"
139
+ :key="indexBucket"
140
+ class="container-card-outline"
86
141
  >
87
- <v-icon
88
- @click="
89
- onConfirmDeleteBucket(index)
90
- "
91
- >mdi-delete-outline</v-icon
92
- >
93
- </v-flex>
94
- <v-container v-if="item.expand">
95
- <v-flex xs12 class="pt-4">
96
- <p
97
- color="primary"
98
- class="labelChanges"
99
- >
100
- {{
101
- $t(
102
- 'plugin.games.components.content.blocks.bucket_game.name'
142
+ <v-layout row wrap outlined>
143
+ <v-flex
144
+ xs10
145
+ :class="
146
+ bottomBorder(
147
+ indexBucket,
148
+ true,
149
+ index
103
150
  )
104
- }}
105
- </p>
106
- <v-text-field
107
- v-if="item.expand"
108
- outlined
109
- :autofocus="true"
110
- v-model="
111
- block.metadata.config
112
- .bucket_titles[index]
113
- .title
114
151
  "
115
- ></v-text-field>
116
- </v-flex>
117
- <v-flex xs12 class="pt-4">
118
- <p
119
- color="primary"
120
- class="labelChanges"
121
- >
122
- {{
123
- $t(
124
- 'plugin.games.components.settings.bucket_game.form.color'
125
- )
126
- }}
127
- </p>
128
- <v-color-picker
129
- v-model="item.color"
130
- hide-canvas
131
- hide-inputs
132
- hide-sliders
133
- show-swatches
134
- :swatches="swatches"
135
- swatches-max-height="130"
136
- ></v-color-picker>
137
- </v-flex>
138
- <v-flex xs12 class="pt-4">
139
- <p
140
- color="primary"
141
- class="labelChanges"
142
- >
143
- {{
144
- $t(
145
- 'plugin.games.components.content.blocks.bucket_game.answers'
146
- )
147
- }}
148
- </p>
149
- </v-flex>
150
- <template
151
- v-for="(
152
- bucket, indexBucket
153
- ) in block.metadata.config
154
- .bucket_answers[index]"
155
- >
156
- <v-container
157
- :key="indexBucket"
158
- class="pa-0 d-flex flex-wrap align-center cardOutline"
159
152
  >
160
- <v-flex
161
- xs10
162
- :class="
163
- bottomBorder(
164
- indexBucket,
165
- true,
166
- index
153
+ <p
154
+ class="text-truncate pa-0 ma-0 p-header"
155
+ @click="
156
+ onOpenEditor(
157
+ index,
158
+ indexBucket
159
+ )
160
+ "
161
+ v-on:keyup.enter="
162
+ onOpenEditor(
163
+ index,
164
+ indexBucket
167
165
  )
168
166
  "
169
- class="rightSideBorder"
167
+ @mouseover="onHover"
168
+ @mouseleave="onHoverLeave"
169
+ :class="cursor"
170
+ tabindex="0"
170
171
  >
171
- <p
172
- class="text-truncate pa-0 ma-0 pTagContainer"
173
- @click="
174
- onOpenEditor(
175
- index,
176
- indexBucket
177
- )
178
- "
179
- v-on:keyup.enter="
180
- onOpenEditor(
181
- index,
182
- indexBucket
183
- )
184
- "
185
- @mouseover="onHover"
186
- @mouseleave="
187
- onHoverLeave
188
- "
189
- :class="cursor"
190
- tabindex="0"
172
+ <v-icon class="pl-2"
173
+ >mdi-drag-vertical</v-icon
191
174
  >
192
- <v-icon class="pl-2"
193
- >mdi-drag-vertical</v-icon
194
- >
195
- <span
196
- class="ellipsisText"
197
- >
198
- {{
199
- bucket.display
200
- ? bucket.display
201
- : $t(
202
- 'plugin.games.components.settings.bucket_game.form.click_here'
203
- )
204
- }}
205
- </span>
206
- </p>
207
- </v-flex>
208
- <v-flex
209
- xs2
210
- class="d-flex justify-center setHeight"
211
- :class="
212
- bottomBorder(
175
+ <span
176
+ class="span-text-ellipsis"
177
+ >
178
+ {{
179
+ bucket.display
180
+ ? bucket.display
181
+ : $t(
182
+ 'plugin.games.components.settings.bucket_game.form.click_here'
183
+ )
184
+ }}
185
+ </span>
186
+ </p>
187
+ </v-flex>
188
+ <v-flex
189
+ xs2
190
+ class="d-flex justify-center btn-header-delete"
191
+ :class="
192
+ bottomBorder(
193
+ indexBucket,
194
+ true,
195
+ index
196
+ )
197
+ "
198
+ >
199
+ <v-icon
200
+ @click="
201
+ onConfirmDelete(
213
202
  indexBucket,
214
- true,
215
203
  index
216
204
  )
217
205
  "
206
+ class="btn-delete-icon"
207
+ >mdi-delete-outline</v-icon
218
208
  >
219
- <v-icon
220
- @click="
221
- onConfirmDelete(
222
- indexBucket,
223
- index
209
+ </v-flex>
210
+ <v-container v-if="bucket.expand">
211
+ <v-flex xs12>
212
+ <p class="p-label">
213
+ {{
214
+ $t(
215
+ 'plugin.games.components.content.blocks.bucket_game.form.answer'
224
216
  )
225
- "
226
- >mdi-delete-outline</v-icon
227
- >
228
- </v-flex>
229
- <v-flex
230
- xs12
231
- v-if="bucket.expand"
232
- class="pa-4"
233
- >
234
- <v-row
235
- class="ma-1 d-flex align-center justify-space-between"
236
- >
237
- <div
238
- color="primary mb-0"
239
- class="labelChanges d-flex align-center"
240
- >
241
- {{
242
- $t(
243
- 'plugin.games.components.content.blocks.bucket_game.form.answer'
244
- )
245
- }}
246
- </div>
247
- </v-row>
217
+ }}
218
+ </p>
248
219
  <v-text-field
249
220
  outlined
250
221
  :autofocus="true"
@@ -257,20 +228,13 @@
257
228
  .display
258
229
  "
259
230
  ></v-text-field>
260
- <v-row
261
- class="ma-1 d-flex align-center justify-space-between"
262
- >
263
- <div
264
- color="primary mb-0"
265
- class="labelChanges d-flex align-center"
266
- >
267
- {{
268
- $t(
269
- 'plugin.games.components.content.blocks.bucket_game.form.value'
270
- )
271
- }}
272
- </div>
273
- </v-row>
231
+ <p class="p-label">
232
+ {{
233
+ $t(
234
+ 'plugin.games.components.content.blocks.bucket_game.form.value'
235
+ )
236
+ }}
237
+ </p>
274
238
  <v-text-field
275
239
  outlined
276
240
  v-model="
@@ -282,20 +246,13 @@
282
246
  .display_value
283
247
  "
284
248
  ></v-text-field>
285
- <v-row
286
- class="ma-1 d-flex align-center justify-space-between"
287
- >
288
- <div
289
- color="primary mb-0"
290
- class="labelChanges d-flex align-center"
291
- >
292
- {{
293
- $t(
294
- 'plugin.games.components.content.blocks.bucket_game.form.feedback.feedback'
295
- )
296
- }}
297
- </div>
298
- </v-row>
249
+ <p class="p-label">
250
+ {{
251
+ $t(
252
+ 'plugin.games.components.content.blocks.bucket_game.form.feedback.feedback'
253
+ )
254
+ }}
255
+ </p>
299
256
  <v-text-field
300
257
  outlined
301
258
  v-model="
@@ -309,74 +266,62 @@
309
266
  ></v-text-field>
310
267
  </v-flex>
311
268
  </v-container>
312
- </template>
313
- <p
314
- @mouseover="onHover"
315
- @mouseleave="onHoverLeave"
316
- @click="onAddBucketAnswer(index)"
317
- v-on:keyup.enter="
318
- onAddBucketAnswer(index)
319
- "
320
- class="fullWidth"
321
- :class="cursor"
322
- tabindex="0"
323
- >
324
- <v-icon class="primary mr-2"
325
- >mdi-plus</v-icon
326
- >
327
- {{
328
- $t(
329
- 'plugin.games.components.settings.bucket_game.form.add_answer'
330
- )
331
- }}
332
- </p>
269
+ </v-layout>
333
270
  </v-container>
334
- </v-layout>
271
+ </template>
272
+ <v-row justify="center" class="my-4">
273
+ <v-btn
274
+ color="primary"
275
+ @click="onAddBucketAnswer(index)"
276
+ >
277
+ <v-icon>mdi-plus</v-icon>
278
+ {{
279
+ $t(
280
+ 'plugin.games.components.settings.bucket_game.form.add_answer'
281
+ )
282
+ }}
283
+ </v-btn>
284
+ </v-row>
335
285
  </v-container>
336
- <p
337
- @mouseover="onHover"
338
- @mouseleave="onHoverLeave"
339
- @click="onAddBucket"
340
- v-on:keyup.enter="onAddBucket"
341
- class="fullWidth"
342
- :class="cursor"
343
- tabindex="0"
344
- >
345
- <v-icon class="primary mr-2">mdi-plus</v-icon>
346
- {{
347
- $t(
348
- 'plugin.games.components.settings.bucket_game.form.add_bucket'
349
- )
350
- }}
351
- </p>
352
- <br />
353
- </v-expansion-panel-content>
354
- </v-expansion-panel>
355
- </v-expansion-panels>
286
+ </v-layout>
287
+ </v-container>
288
+ </draggable>
289
+ </v-container>
290
+ <v-container class="pa-0">
291
+ <v-row justify="center" class="my-4">
292
+ <v-btn color="primary" @click="onAddBucket">
293
+ <v-icon>mdi-plus</v-icon>
294
+ {{
295
+ $t(
296
+ 'plugin.games.components.settings.bucket_game.form.add_bucket'
297
+ )
298
+ }}
299
+ </v-btn>
300
+ </v-row>
301
+ <v-textarea
302
+ class="pt-4"
303
+ outlined
304
+ auto-grow
305
+ v-model="block.metadata.config.feedback_correct"
306
+ :counter="255"
307
+ :label="
308
+ $t(
309
+ 'plugin.games.components.settings.bucket_game.form.feedback.correct'
310
+ )
311
+ "
312
+ ></v-textarea>
313
+ <v-textarea
314
+ outlined
315
+ auto-grow
316
+ v-model="block.metadata.config.feedback_incorrect"
317
+ :counter="255"
318
+ :label="
319
+ $t(
320
+ 'plugin.games.components.settings.bucket_game.form.feedback.incorrect'
321
+ )
322
+ "
323
+ ></v-textarea>
356
324
  </v-container>
357
- <v-textarea
358
- class="pt-4"
359
- outlined
360
- auto-grow
361
- v-model="block.metadata.config.feedback_correct"
362
- :counter="255"
363
- :label="
364
- $t(
365
- 'plugin.games.components.settings.bucket_game.form.feedback.correct'
366
- )
367
- "
368
- ></v-textarea>
369
- <v-textarea
370
- outlined
371
- auto-grow
372
- v-model="block.metadata.config.feedback_incorrect"
373
- :counter="255"
374
- :label="
375
- $t(
376
- 'plugin.games.components.settings.bucket_game.form.feedback.incorrect'
377
- )
378
- "
379
- ></v-textarea>
380
325
  </v-form>
381
326
  <div v-if="loading" class="text-center">
382
327
  <v-progress-circular
@@ -398,6 +343,8 @@ import {
398
343
  } from '@windward/core/utils'
399
344
  import colors from 'vuetify/lib/util/colors'
400
345
  import BaseContentSettings from '~/components/Content/Tool/BaseContentSettings.js'
346
+ import draggable from 'vuedraggable'
347
+
401
348
  export default {
402
349
  name: 'BucketGameSettingsManager',
403
350
  extends: BaseContentSettings,
@@ -405,6 +352,7 @@ export default {
405
352
  MathExpressionEditor,
406
353
  MathLiveWrapper,
407
354
  ContentViewer,
355
+ draggable,
408
356
  },
409
357
  beforeMount() {
410
358
  if (_.isEmpty(this.block)) {
@@ -417,16 +365,22 @@ export default {
417
365
  this.block.metadata.config = {}
418
366
  }
419
367
  if (_.isEmpty(this.block.metadata.config.title)) {
420
- this.block.metadata.config.title = ''
368
+ this.block.metadata.config.title = this.$t(
369
+ 'plugin.games.components.content.blocks.bucket_game.game_title'
370
+ )
421
371
  }
422
372
  if (_.isEmpty(this.block.metadata.config.instructions)) {
423
373
  this.block.metadata.config.instructions = ''
424
374
  }
425
375
  if (_.isEmpty(this.block.metadata.config.feedback_correct)) {
426
- this.block.metadata.config.feedback_correct = ''
376
+ this.block.metadata.config.feedback_correct = this.$t(
377
+ 'plugin.games.components.settings.bucket_game.form.feedback.correct_default'
378
+ )
427
379
  }
428
380
  if (_.isEmpty(this.block.metadata.config.feedback_incorrect)) {
429
- this.block.metadata.config.feedback_incorrect = ''
381
+ this.block.metadata.config.feedback_incorrect = this.$t(
382
+ 'plugin.games.components.settings.bucket_game.form.feedback.incorrect_default'
383
+ )
430
384
  }
431
385
  if (_.isEmpty(this.block.metadata.config.bucket_titles)) {
432
386
  this.block.metadata.config.bucket_titles = []
@@ -447,6 +401,7 @@ export default {
447
401
  dialog: false,
448
402
  loading: false,
449
403
  cursor: '',
404
+ panel: 0,
450
405
  swatches: [
451
406
  [colors.grey.lighten1, colors.blueGrey.lighten5],
452
407
  [colors.brown.lighten3, colors.red.lighten3],
@@ -497,7 +452,7 @@ export default {
497
452
  )
498
453
  },
499
454
  onHover(index) {
500
- this.cursor = 'changePointer'
455
+ this.cursor = 'change-pointer'
501
456
  },
502
457
  onHoverLeave() {
503
458
  this.cursor = ''
@@ -508,7 +463,7 @@ export default {
508
463
  this.block.metadata.config.bucket_answers[mainIndex][index]
509
464
  .expand === true
510
465
  ) {
511
- return 'bottomBorder'
466
+ return 'container-header-border'
512
467
  } else {
513
468
  return null
514
469
  }
@@ -517,7 +472,7 @@ export default {
517
472
  this.block.metadata.config.bucket_titles[index].expand ===
518
473
  true
519
474
  ) {
520
- return 'bottomBorder'
475
+ return 'container-header-border'
521
476
  } else {
522
477
  return null
523
478
  }
@@ -622,62 +577,44 @@ export default {
622
577
  </script>
623
578
 
624
579
  <style scoped>
625
- .v-progress-circular {
626
- margin: 1rem;
580
+ .btn-delete-icon {
581
+ color: var(--v-primary-base);
627
582
  }
628
- .changePointer {
629
- cursor: pointer !important;
583
+ .btn-header-delete {
584
+ border-left: 1px solid var(--v-primary-base);
630
585
  }
631
- .v-expansion-panel-content >>> .v-expansion-panel-content__wrap {
632
- padding: 0 !important;
586
+ .btn-header-delete:hover {
587
+ background-color: rgb(243, 243, 243);
633
588
  }
634
- .pTagContainer {
589
+ .p-header {
635
590
  height: 45px;
636
591
  display: flex;
637
592
  align-items: center;
638
593
  }
639
- #contentBlockAsset {
640
- max-width: 251px;
641
- }
642
- .customButton {
643
- min-width: 34px !important;
594
+ .p-header:hover {
595
+ background-color: rgb(243, 243, 243);
644
596
  }
645
- .itemHeight {
646
- display: flex;
647
- align-content: center;
648
- justify-content: space-between;
649
- }
650
- .bottomBorder {
651
- border-bottom: 2px solid var(--v-primary-base);
652
- }
653
- .setHeight {
654
- height: 47px;
655
- }
656
- .fullWidth {
657
- display: flex;
658
- justify-content: center;
659
- align-items: center;
660
- font-weight: bold;
597
+ .p-label {
661
598
  font-size: 16px;
599
+ font-weight: 500;
662
600
  }
663
- .cardOutline {
664
- border: solid 2px var(--v-primary-base);
601
+ .container-header-border {
602
+ border-bottom: 1px solid var(--v-primary-base);
603
+ }
604
+ .container-card-outline {
605
+ border: solid 1px var(--v-primary-base);
665
606
  border-radius: 3px !important;
666
607
  margin-bottom: 8px;
667
608
  }
668
- .sideBorder {
669
- border-left: 2px solid var(--v-primary-base);
670
- }
671
- .rightSideBorder {
672
- border-right: 2px solid var(--v-primary-base);
673
- }
674
- .labelChanges {
675
- font-size: 16px;
676
- font-weight: 500;
677
- }
678
- .ellipsisText {
609
+ .span-text-ellipsis {
679
610
  white-space: nowrap;
680
611
  overflow: hidden;
681
612
  text-overflow: ellipsis;
682
613
  }
614
+ .v-progress-circular {
615
+ margin: 1rem;
616
+ }
617
+ .change-pointer {
618
+ cursor: pointer !important;
619
+ }
683
620
  </style>